How does echarts click on the legend to show the broken line and hide the other broken lines?

something like this, but this is done with highcharts, and I now need to modify it on echarts: https://code.hcharts.cn/rench.

Feb.28,2021

Thank you both for your ideas, which have been solved:

var myCharts = echarts.init(document.getElementById("section"));

var triggerAction = function(action, selected) {
  legend = [];

  for (name in selected) {
    if (selected.hasOwnProperty(name)) {
      legend.push({
        name: name
      });
    }
  }

  myCharts.dispatchAction({
    type: action,
    batch: legend
  });
};

//
var isFirstUnSelect = function(selected) {
  var unSelectedCount = 0;
  for (name in selected) {
    if (!selected.hasOwnProperty(name)) {
      continue;
    }

    if (selected[name] == false) {
      unSelectedCountPP;
    }
  }

  return unSelectedCount == 1;
};

//
var onOff = true;

myCharts.on('legendselectchanged', function(obj) {
  var selected = obj.selected;
  var legend = obj.name;
  //  legendToggleSelect Action  legendselectchanged Event
  //   selected 
  if (selected != undefined && isFirstUnSelect(selected) && onOff) {
    triggerAction('legendToggleSelect', selected);
    onOff = false;
  }
});

look at the API in the event section similar to this legendselectchanged


the event selected by the legendselected: example component with the legendSelect legend, that is, when you click to show the legend, the trigger takes effect.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea8d9e-1f0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea8d9e-1f0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?