This is a migrated thread and some comments may be shown as answers.

How to use multiple lines with date categories?

2 Answers 52 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Michaël
Top achievements
Rank 1
Michaël asked on 20 Nov 2014, 02:35 PM
Hi,

I have a data that is formatted like that:

{
    "a": [
         {
             "date": "2014-01-01",
             "value": 1
         },
         {
             "date": "2014-01-02",
             "value": 5
         }
    ],
    "b": [
         {
             "date": "2014-01-01",
             "value": 3
         },
         {
             "date": "2014-01-02",
             "value": 6
         }
    ]
}

I want to render, on the same chart, one line per type ("a" and "b"). However, I don't know how to write the code for that. The problem comes to the fact that it seems Kendo Chart requires to set the data source to enable the "date" category axis. However, the data source only supports one set of data.

Which config should I write to make this work? I could potentially re-work my JSON so that categories are sideloaded, but I like the idea of having this like this, as it would allows me to have missing data for some data set.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 24 Nov 2014, 11:28 AM
Hi Michaƫl,

Kendo UI Chart cannot be bound to the current data set and in order to achieve the expected result you should modify it. For your convenience I prepared a simple example - please check it and let me know if this fits the current requirements or I can assist you further. 

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Michaël
Top achievements
Rank 1
answered on 24 Nov 2014, 01:10 PM
Hi,

Thanks for your answer. Unfortunately I think this won't work for my use case, because each data category is sent in another hash and I cannot modify it.

Anyway, what I will do is simply embedding the dates in a different property of my response :).
Tags
Charts
Asked by
Michaël
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Michaël
Top achievements
Rank 1
Share this question
or