Home Forums Chart Support Second Y axis should be visible but the datasets related to Y2 to be invisible Reply To: Second Y axis should be visible but the datasets related to Y2 to be invisible

#22153

Manoj,

You can hide legends as you hide the dataSeries, but once the legend is hidden on click, you wouldn’t be able to regain that legend.
Along with setting dataSeries visibility to false in toggleDataSeries method, set showInLegend property of that dataSeries to false.

  if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
    e.dataSeries.visible = false;
    e.dataSeries.showInLegend = false;
  } else {
    e.dataSeries.visible = true;
  }

__
Priyanka M S
Team CanvasJS