Programmatically Hide Series

3 posts, 1 answers
  1. Daniel
    Daniel avatar
    11 posts
    Member since:
    Mar 2012

    Posted 15 Jul 2014 Link to this post

    Hey guys,

    Currently if you have a chart and you display the legend, you are able to click items in the legend to show/hide them.  Was wondering if there is a way to do this without the legend displaying, say maybe by clicking a button.

    The below example shows the basic chart with a legend and how it can toggle the series by clicking it in the legend:

    http://trykendoui.telerik.com/aPUR/2
  2. Answer
    Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 17 Jul 2014 Link to this post

    Hi Daniel,

    You have two options:
    1) You can use _legendItemClick with first parameter seriesIndex:
    $("#chart").getKendoChart()._legendItemClick(0);
    2) Set visible false to the series that you want to hide and call chart's redraw():
    $("#chart").getKendoChart().options.series[0].visible = false;
    $("#chart").getKendoChart().redraw();

    I hope this helps. 

    Regards,
    Hristo Germanov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Daniel
    Daniel avatar
    11 posts
    Member since:
    Mar 2012

    Posted 26 Aug 2014 Link to this post

    Worked like a charm! Thanks!
Back to Top