Duplicate but different Cat Axis items

5 posts, 1 answers
  1. Ed
    Ed avatar
    168 posts
    Member since:
    Sep 2013

    Posted 28 May 2015 Link to this post

    I have a column chart where the data coming from the DB has some valid data that confuses Kendo. The data for the Category Axis is a list of merchants. There happens to be a few merchants with the exact same name, but different merchant IDs. How can I show "duplicate" merchant names in the category axis? Is there a way to identify uniqueness by the merchant id and not the merchant name, where merchant name is displayed on the category axis?
    Thanks,
    --Ed
  2. EZ
    EZ avatar
    65 posts
    Member since:
    May 2015

    Posted 29 May 2015 Link to this post

    If your data looks something like this:

     

    [ {
                   "merchant": "Acme",
                   "id": "1",
                   "value": 3,
                   "userColor": "#ffd600"
               }, {
                   "merchant": "Acme",
                   "id": "2",
                   "value": 7,
                   "userColor": "#ffd600"
               }, {
                   "merchant": "merch 2",
                   "id": "3",
                   "value": 12,
                   "userColor": "#ffd600"
               }, {
                   "merchant": "merch 3",
                   "id": "4",
                   "value": 15,
                   "userColor": "#ffd600"
               }, ...

     

    Then the chart will show similarly named categories with no problems:

     

    Dojo DEMO

  3. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 01 Jun 2015 Link to this post

    Hello,

    Using a categoryAxis.field will deal with duplicate category names, as shown by Erik. In this mode categories and series points will be listed in order.

    If series.categoryField is in use then duplicate categories will be merged. Series points will be aggregated accordingly. This is mostly useful when the series are bound from different data sets that have categories in common.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  4. Ed
    Ed avatar
    168 posts
    Member since:
    Sep 2013

    Posted 01 Jun 2015 in reply to T. Tsonev Link to this post

    Hello,

    Yes, you are correct that series.categoryField is in use and this is why the duplicate categories are merged based on category name. How can I specify unique categories based on a field other than what is displayed on the chart? I want to merge duplicate categories based on one field (let's say it is CategoryId) and display the categories on the chart using a second field (let's call it CategoryName).

    Thanks,

    --Ed

  5. Answer
    T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 03 Jun 2015 Link to this post

    Hello Ed,

    You can specify any field for the category binding. What appears on screen can be customized via templates:

    categoryAxis: {
      labels: {
        tempate: "#= dataItem.myRealCategory #"
      }
    }

    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top