PDA

View Full Version : LineChart Store - Differencing lines by a property



pouniok
18 Jan 2010, 7:19 AM
Hi,

I'm facing a problem with my Line Chart.

I've measures, with a name, a value, a date and an ID.

When I load measures for an object, my store looks like this:


[{name: 'measure 1', val: 10, date: '10/10/09', id: 1},
{name: 'measure 2', val: 5, date: '10/10/09', id: 2},
{name: 'measure 1', val: 15, date: '12/10/09', id: 1},
{name: 'measure 1', val: 12, date: '13/10/09', id: 1},
{name: 'measure 1', val: 14, date: '15/10/09', id: 1},
{name: 'measure 2', val: 7, date: '12/10/09', id: 2}]


What I want to do is making a Line Chart with :
Y-Axis : Val
X-Axis : Date

And draw my two lines on it differenced by their ID.

But nowhere I'm able to find how to do that, and if I want to create series, I need to put values with a different name for each measure.

And as I don't know which measures I'll get, I would have to generate the record, series and data dynamically.

So I'm curious to know if there is an option to differentiate lines with a field of the record.

Thank for any help :)

21 Jan 2010, 5:14 AM
My first reaction is to format the data differently. It seems you might need to separate the data by IDs.

ID1 has a certain set of records, while ID2 does as well.

A two series line chart from my book: http://extjsinaction.com/examples/chapter10/linechart_basic_two_series.html

Look at the JSON being served and the source for that page.