Edit this page

legendItemClick

Fires when an legend item is clicked, before the selected series visibility is toggled. Can be cancelled.

Event Data

e.pointIndex Number

The point index.

e.preventDefault Function

If invoked the default action (toggle series visibility) will be prevented.

e.sender kendo.dataviz.ui.Chart

The widget instance which fired the event.

e.series Object

The series options.

e.seriesIndex Number

The series index.

e.text String

The name of the series.

e.element Object

The DOM element of the plot area.

Example - subscribe to the "legendItemClick" event during initialization

<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    series: [
      { data: [6, 2, 3], name: "Task 1" },
      { data: [1, 5, 2], name: "Task 2" }
    ],
    legendItemClick: function(e){
        console.log("Clicked an item with text: " + e.text);

      //prevent toggling the series visibility on legend item click
      e.preventDefault();
    }
  });
</script>

Example - subscribe to the "legendItemClick" event after initialization

<div id="chart"></div>
<script>
  function chart_legendClick(e){
    console.log("Clicked an item with text: " + e.text);

    //prevent toggling the series visibility on legend item click
    e.preventDefault();
  }
  $("#chart").kendoChart({
    series: [
      { data: [6, 2, 3], name: "Task 1" },
      { data: [1, 5, 2], name: "Task 2" }
    ]
  });
  var chart = $("#chart").data("kendoChart");      
  chart.bind("legendItemClick", chart_legendClick);
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy