Home Forums Chart Support Legend taking generic text

Legend taking generic text

Viewing 2 posts - 1 through 2 (of 2 total)
  • #34181

    Hey, I am learning canvasjs. I have created donut chart (Link). I want to add legends. So, I have added “showInLegend: true”. But, it’s showing DataPoint: 1 and DataPoint: 2, instead of labels. Please guide me.

    #34187

    @usha,

    You can show custom text in legend-items by setting legendText property (which falls back to name property of dataPoint). You can achieve this by passing legendText property along with label for each dataPoint as shown in the below code-snippet.

    dataPoints.push({
    	label: (points[0]),
    	legendText: (points[0]),
    	y: parseFloat(points[1])
    });

    Legend-Text in Datapoint Level

    If you are still facing issue, kindly create JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code / chart-options being used, understand the scenario better and help you resolve.


    Vishwas R
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.