Support for key for lines on chart

Is there any support for showing key for the strip lines color ?
example attached:


1 Reply 1 reply marked as answer

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

Hi Voss,

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