PDA

View Full Version : Custom line chart series.



KnowledgeSeeker
10 Jun 2014, 3:30 AM
I have a line chart in my application. I am able to add multiple series to it. My requirement is to create series for the selected time period. For example, my store has data for 5 years(2008, 2009, 2010, 2011, 2012). For every year there are 3 columns [Data1, Data2, Data3]. I am able to create series for Data1, Data2 and Data3. The problem is I have to create series for Data2 and Data3 for only 3 and 4 years respectively. For Data2 I need to create series for 2010, 2011 and 2012. Similarly for Data3 I need to create series for 2009, 2010, 2011 and 2012. How can that be achieved? Here is the sample JSON I have for my store.


[
{
"Year": "2008",
"Data1": 100,
"Data2": 200,
"Data3": 300,
},
{
"Year": "2009",
"Data1": 110,
"Data2": 210,
"Data3": 310,
},
{
"Year": "2010",
"Data1": 120,
"Data2": 220,
"Data3": 320,
},
{
"Year": "2011",
"Data1": 130,
"Data2": 230,
"Data3": 330,
},
{
"Year": "2012",
"Data1": 140,
"Data2": 240,
"Data3": 340,
}



]

scottmartin
10 Jun 2014, 8:53 AM
It might help to get a visual of what you are trying to do.

You can create gaps like this:
http://jsfiddle.net/tqdJ8/

And you can create lines like shown here:
https://fiddle.sencha.com/#fiddle/15d

KnowledgeSeeker
10 Jun 2014, 10:18 PM
Thanks Scott. Exactly what I was looking for. I had to use convert function in my model to return false/undefined for the values to be skipped.