Some minor problems with the charts

1- Doughnut 2D / Pie 2D Charts:

When choosing a doughnut or pie chart, the “Legend” is not displayed even if the chart advanced property checkbox (Legend > Display > ✔ ) is checked.
It took me a while of experimentation and failure until I had the idea of making it visible through the code as follows:
// Server Events > Chart_Rendered:
public void Chart_Rendered(ChartJsRenderer renderer)
{
// Example:
var data = renderer.Data;
var options = renderer.Options;
DbChart chart = renderer.Chart;
if (chart.ID == “xxx”) { // Check chart ID
// Change layout.padding option
// Refer https://www.chartjs.org/docs/latest/ for possible options
renderer.Options = Merge(options, new Dictionary <string,dynamic>
{
{“legend”, new Dictionary <string,dynamic> {{“display”, true}}}
});
}
}
After doing so, the legend appeared immediately. so I think that checkbox is not properly associated.


2- Bar 2D Chart:

The option (Custom sort sequence) is not working, and it always appears in alphabetic order, although :

  • I have read the help file very well
  • I have double-checked that spelling of my categories is correct, as it appears on the chart (including letter case)
  • I have selected (X ASC) in the Sort Type option
  • I am sure there are no spaces before or after the comma
    it always shows in alphabetical order…

Example of my custom category labels sorting:

Delayed Tasks,Active Tasks,Completed,Canceled,Archived


Thank you for your help

Enable Tools → Advanced Settings → Debug. Check the JSON for the chart to see if the required setting is set correctly.

A very helpful suggestion, it exposed all of the actual/final chart properties! thank you, Michael!

1- I can see clearly from the JSON that the legend is set to false even though I’ve checked that checkbox, it only turns into true when I set the legend via code as I’ve mentioned before.

2- I can see that my labels are still ordered alphabetically even though I have added my own custom order, it looks like this:
{
“type”: “bar”,
“data”: {
“labels”: [
“Active Tasks”,
“Archived”,
“Canceled”,
“Completed”,
“Delayed Tasks”
],
… etc
while my “Custom sort sequence” is:
Delayed Tasks,Active Tasks,Completed,Canceled,Archived

thank you for taking the time to review that advanced properties panel for charts.