PDA

View Full Version : How to generate dynamic axis and series in Line Chart.



hr.sheik
6 Mar 2013, 3:31 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:

[{date: '10/10/09', name: 'measure 1', val: 10, Units:'million/mm3', id: 1},
{date: '10/10/09', name: 'measure 2', val: 5, Units:'pg', id: 2},
{date: '12/10/09', name: 'measure 1', val: 15, Units:'million/mm3', id: 1},
{date: '13/10/09', name: 'measure 1', val: 12, Units:'million/mm3', id: 1},
{date: '15/10/09', name: 'measure 1', val: 14, Units:'million/mm3', id: 1},
{date: '12/10/09', name: 'measure 2', val: 7, Units:'pg', 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 name or 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

mitchellsimoens
8 Mar 2013, 7:00 AM
If you want 2 lines then you need 2 different line series but each would need to use a different axis field.

Also, you have duplicate id values so you would have to set your idProperty on your model to a field that is unique or nonexistent.

hr.sheik
8 Mar 2013, 7:26 AM
Thanks for the reply,
but i could not identify y field, and as I don't know which measures I'll get, I would have to generate the series and data dynamically.
I am new to sencha, please provide me solution to plot the line and differentiate lines with a field(name field in store) of the record.

Thanks for the help.