How to show legends for stripLines ?

Currently I am using multiple line chart with Angular its showing legends for both axis but I want that legend for stripLines also. how can I achieve this ?

Attachment: Capture_6d7eef9a.zip

1 Reply 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team February 23, 2021 01:44 PM UTC

Hi Ashok,

Greetings from Syncfusion.

As of now, we don't have legend support for chart axis striplines. We have done a workaround to acheive your requirement. We suggest you use annotations to display the customized texts, shapes etc. In the sample, we have used chartMouseClick event to enable and disable the striplines while clicking the legend item.

public annotations: Object = [
    {
      x: "20%",
      y: "120%",
      coordinateUnits: "Pixel",
      region: "Series",
      content:
        '<div id="chart_annotation0" style="color:blue;"><div style="margin-right:5px;width:15px;display: inline-block; border: solid blue;"></div>Low Critical</div>'
    }
   //...
]
 public onChartMouseClick(args: IMouseEventArgs): void {
    var annotationId = args.target;
    if (annotationId.indexOf("chart_annotation") >= 0) {
      var stripIndex = args.target.charAt(args.target.length - 1);
      this.chart.primaryYAxis.stripLines[stripIndex].visible = 
             this.chart.primaryYAxis.stripLines[stripIndex].visible  ? false : true;
    }
  }



Please revert us if you have any concerns.

Regards,
Durga G


Marked as answer
Loader.
Up arrow icon