decode values displayed as series values on Chart

2 posts, 1 answers
  1. Answer
    Alex VonBrand
    Alex VonBrand avatar
    10 posts
    Member since:
    Sep 2008

    Posted 14 May 2013 Link to this post

    I have a column chart with series values of 0, 1,2,3,4.
    Rather than display the numbers, I would like to decode the numbers to a string value, e.g.  instead of 1 as a label display something like 'low', instead of 2 display 'medium' etc.  I have tried to get this to work with templates but have been unsuccessful.

    something like

        series: [{
                            type: "column",
                            aggregate: "avg",
                            field: 'value',
                            labels: {
                                template: "#if(value == 4) { # ${'exceed'} # } else { # ${value} #} #"
     
                        }
                        }],

     The chart ignores the template and just displays the numbers 1,2 etc.
    Is it possible to do what I want to do.
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2622 posts

    Posted 16 May 2013 Link to this post

    Hi Alex,

    You could achieve the desired result using template for the series.labels and execute custom logic in this template. For your convenience here is a simple jsBin example which demonstrates a possible implementation.
     
    Regards,
    Iliana Nikolova
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top