How to add label to circular web chart

I have created a chart using a WebChartCircularDataset. It looks fine with segments of different colors and hovering the mouse over a segment pops up a little window showing the color and quantity. I have not been able to get the chart to show a label for each colored segment. I built the chart with

var ds As new WebChartCircularDataset(“Energy Usage”, ChartData, ChartColors)
ChartPie.AddDataset(ds)
ChartPie.AddLabels(ChartLabel)

where ChartLabel is an array of the names that should be associated with the colors. I tried replacing “Energy Usage” in the dataset constructor and it failed to compile. Neither my ChartLabel array nor the “Energy Usage” title appear anywhere in the finished chart. I was expecting something like the legend at the top of the example chart where there is a label for each of the colors.

@Dean_Davidge,

I created a dashboard of many charts about a month ago.

From memory, “AddLabels” expects a string - and will not parse an array of labels.

I suggest you convert your array of labels into a string, then I expect it will work fine.

Kind regards, Andrew

ChartLabel is an array of strings. That is what is shown in the LR under WebChartCircularDataset… But that may not mean much as the AddLabels method is shown in the Sample Code, but AddLabels is not shown as a method of the DataSet. Looks to me like this may be a planned for feature that has not been implemented yet.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.