MVVM Chart Label Template...

3 posts, 0 answers
  1. Robin
    Robin avatar
    46 posts
    Member since:
    Jul 2012

    Posted 31 Jul 2013 Link to this post

    I am trying to build a chart using kendo mvvm but can't seem to figure out how to template the labels on the chart (category axis, value axis, and series labels).

    This is ideally what I would like the chart to look like
    http://jsbin.com/uvarit/4/edit

    And can get the chart to render
    http://jsbin.com/obojiz/2/edit

    I just can't figure out how to add the label templates in. Needing to delimit a string within a string within a string, some sort of Stringception or something.

    Thanks.
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2622 posts

    Posted 02 Aug 2013 Link to this post

    Hello Robin,

    In order to achieve this you should define the template in the labels object, however you should escape the quotes:
    <div id="chartTotals"
      //....
       data-category-axis="{field: 'Date', labels: { visible: true, rotation: '45', template: '#=kendo.toString(value, \'MM/dd/yyyy\')#' }}"
      //....
    >
    For your convenience I updated the jsBin example

    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. Robin
    Robin avatar
    46 posts
    Member since:
    Jul 2012

    Posted 02 Aug 2013 Link to this post

    Thank you for the reply, this works great.
Back to Top