View Full Version : Line Chart

28 Oct 2010, 1:33 AM
I need to make one line chart such that it can contain multiple lines for different items (one line for earch item). Basically i want to compare some items seeing the line graph (like we see population of 3-4 cities in a graph and judge the population at different point of time on x axis) . i have seen example of line chart for one item only.

Can you pls help

28 Oct 2010, 3:29 AM
So you just want multiple series, e.g. like this (http://developer.yahoo.com/yui/examples/charts/charts-quickstart.html)?

28 Oct 2010, 5:52 AM
So you just want multiple series, e.g. like this (http://developer.yahoo.com/yui/examples/charts/charts-quickstart.html)?

Thanks Condor

28 Oct 2010, 6:01 AM
they are using YAHOO.util.DataSource here
Do ExtJS provide DataSource like this??, i am not able to search in API..
Please guide

28 Oct 2010, 6:09 AM
Ext uses Ext.data.Store for the same thing.

For information on how to use Ext.chart.Chart you should check the Ext API docs.

However, sometimes you have to look at the original YUI Chart docs (mainly for style options).

28 Oct 2010, 7:39 AM
FYI, "Learning Ext JS 3.2" contains an explanation of multiple series, and complex charting - with examples.

28 Oct 2010, 10:11 AM
yes i am able to do it using series with static data like this

var store1 = Ext.data.JsonStore({
fields:[name, pop1, pop2],
data : [
{name:'A',pop1:16,pop2:24 },
{name:'B',pop1:13,pop2:22 } ,
{name:'C',pop1:11,pop2:27 }

.. but not dynamically...

i have a javascript array var arr = [['P',12,2],['Q',21,3],['R',33,22]]
and i want to load this store1 with this arr dynamically.

i am doing it like store1.loadData(arr);

but its not working chart is blank no lines. It should give 2 lines

28 Oct 2010, 10:22 PM
You need an ArrayStore and not a JsonStore for that data.

1 Nov 2010, 1:49 AM
thanks i could do it

1 Nov 2010, 11:57 PM
Now i am able to make charts. i am facing a new problem here. I got a TabPanel having 3 panels. all the three panels contain graph
first is having Bar Chart, second and third series Line chart. when i get the response the tab 1 loads and barchart shows. when i click on tab2 the series line chart also shows . but when i click on tab 3 . series line chart is not showing.

only one of 2 series line charts is showing at a time. for tab 2 and tab 3, Whatever Tab i click first is showing the series line chart other one is blank.

Please suggest what could be the problem.

2 Nov 2010, 12:24 AM
And you are not accidentially using the same store for both charts on tab 2 and 3?

ps. Charts on tabs are notorious for having problems initializing. I suggest waiting with loading the store until the activate event of the panel.

2 Nov 2010, 4:00 AM
Hi, i am using different stores here. i have tried listeners on Tabpanel (beforetabchage) and on charts(beforerender and beforeshow) but behaviour is strange.. sometimes both are not visible, sometimes only one is visible .

its just strange. i will try in different panels in vbox layout instead of tabpanel

Thanks condor for your support

2 Nov 2010, 4:18 AM
Try using the activate event of the tabpanel items (or the tabchange event of the tabpanel).