How to use multiple lines with date categories?

3 posts, 0 answers
  1. Michaël
    Michaël avatar
    44 posts
    Member since:
    Feb 2014

    Posted 20 Nov 2014 Link to this post

    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. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2622 posts

    Posted 24 Nov 2014 Link to this post

    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!
     
  3. Michaël
    Michaël avatar
    44 posts
    Member since:
    Feb 2014

    Posted 24 Nov 2014 in reply to Iliana Nikolova Link to this post

    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 :).
Back to Top