You must be logged in to post your query.
Home › Forums › Chart Support › canvas legend not showing properly
Tagged: Canvas legends
Hi, I am having an issue regarding legends in my chart.my data is absolutely dynamic so i am i am setting the option[i].data[j].name =”some dynamic value”.while loading i can debug and see the option being loaded with the dynamic data in the legend.Even while rendering the option in chart,it’s showing the correct data but after the loading of the chart only the first legend is showing. This i copied from the console the value of the option during run time..
Chart options : axisX : {intervalType: “hour”, labelMaxWidth: 180, labelAngle: 0, labelFontFamily: “verdana0”, labelFontSize: 7, …} data : Array(5) 0 : {type: “line”, dataPoints: Array(440), name: “ABCD”, showInLegend: true} 1 : {type: “line”, dataPoints: Array(441), name: “efgh”, showInLegend: true} 2 : {type: “line”, dataPoints: Array(439), name: “W”, showInLegend: true} 3 : {type: “line”, dataPoints: Array(0)} 4 : {type: “line”, dataPoints: Array(0)} length : 5 __proto__ : Array(0) title : {text: “WT”, fontSize: 15} zoomEnabled : true __proto__ : Object render : ƒ () __proto__ : Object
As shown above the first 3series has 3legend names.But after chart rendering only the first legend is being shown in the ui.Please refer to the below image for reference for the ui.Also the label is getting vanished for x axis.
If i set showLegend=true in both the data definition of the option statically as well as while dynamically updating the option,then the labels are showing,but then also the legends r not showing correctly.Please refer to the below image.
Please help.
@desen17,
Please take a look at this example in our gallery on dynamic updating of chart and legend text. If this doesn’t solve your requirement, can you kindly share a jsfiddle or sample project(share over google-drive or one-drive) reproducing the issue you are facing, so that we can look into your code, understand the scenario better and help you out?
__ Priyanka M S Team CanvasJS
You must be logged in to reply to this topic. Login/Register