I want to customize the legend at the bottom of my pie chart so it looks as the following:
(Ignore the '-------', those are just to simulate different string lengths).
I am having problems with the following:
|
legendRender: function(args){
if(count > jBHChartData.length)
count = 0;
var yVal = jBHChartData[count].y + "%";
var id = jBHChartData[count].id;
args.text = args.text + yVal +" " + id;
count = count + 1;
} |
Thanks for the solution Durga, sorry for the late reply. Other projects took priority over the holidays, just got back working on this.
The problem I have is that my category names are not the same length. I added the dashes --------- as a way to simulate the different lengths of my categories.
also,
I found the following code to dynamically add the percentage size of a slice onto the tooltip (it even updates when I remove visibility of a slice!), my question if there is a way to implement this on the legend labels as well?:
tooltipRender: function(args) {
var value = args.point.y / args.series.sumOfPoints * 100;
args.text = args.point.x + '' + Math.ceil(value) + '' + '%';
},
I couldn't find a way to access the sumOfPoints on the legendRender.
|
load: function(args){
var data = args.chart.series[0].dataSource;
for (var i = 0; i < data.length; i++)
sumOfPoints = sumOfPoints + data[i].y;
},
legendRender: function(args){
var value = jBHChartData[count].y / sumOfPoints * 100;
args.text = args.text + '' + Math.ceil(value) + '' + '%';
} |
Thank you! I will give that a try.
Is there a solution for the column problem? I can't remove the dashes "-------" on my example. They represent other data that I had to remove to share this example. My legend looks like the following screenshot, but I would want them to split on 2 even columns:
I need to do same size columns without removing the "---------" characters.
Here is the code I am working with
https://stackblitz.com/edit/sdu3jv?file=index.js
Hi Enrique,
We are glad to announce that our Essential Studio 2022 Volume 1 release v20.1.0.47 is rolled out and is available for download under the following link.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Durga Gopalakrishnan.