PDA

View Full Version : Get Chart series title form Json



zenrast
27 Feb 2014, 6:25 AM
Im having this array:

date, numberOfSales1, numberOfSales2, numberOfSales3, numberOfSales4

numberOfSalesX in a number of sales for specific company.

The problem is that i dont know in advance what those company names will be, so i cannot statically
set the series "title" to something.

So i was thinking to make something like this

date, companyName1, numberOfSales1, companyName2, numberOfSales2, companyName3, numberOfSales3, companyName4, numberOfSales4

So i for serie1 i would read nuberOfSales1 as "xField" and companyName1 as "title".

Is this the way i should go?



I would like to

scottmartin
27 Feb 2014, 5:55 PM
As long as you can read the data, then you should be fine as you suggest. You can always use setTitle() to set the title at runtime.

zenrast
2 Mar 2014, 4:12 AM
Hmm... your answer leads me to a new question.

How do i create a Store/Model with dynamic number of fields?

Because my line:
date, companyName1, numberOfSales1, companyName2, numberOfSales2, companyName3, numberOfSales3, companyName4, numberOfSales4...

...could have a changeable number of "companies".

mrprabu
3 Mar 2014, 6:59 AM
Could you explain in detail or share your code?