Javascript-Exception using a formatter function in donut chart
JavaOldie opened this issue · comments
I tried to configure a donut chart with a formatter-function for the total-value and data-values.
Whenever I do this, I'm getting a Javascript-Exception in the browser when the chart is being rendered:
TypeError: t3.value.formatter is not a function
My environment:
- Vaadin v23.3.6
- Apexcharts-Flow v23.0.0
- Chorme and Mozilla Browser
This error was already described in issue #92 and the issue was closed with version 2.x of the library.
Using something like:
PlotOptionsBuilder.get().withPie(
PieBuilder.get().withDonut(
DonutBuilder.get().withLabels(
LabelsBuilder.get().withShow(true)
.withName(
NameBuilder.get().withColor("#000000").withFontSize("12px").build())
.withValue(
ValueBuilder.get().withFontSize("14px").withFormatter("function(v) { return 'Test'; }").build())
.withTotal(
TotalBuilder.get().withShow(_showDonutTotal).withLabel(_pieChartData.getTitel()).build())
.build()).build()).build()).build();
I'm still getting the same error as described in #92. The Tooltip-Formatter works like expected.
Am I doing something wrong?
This happens because on the JavaScript site the formatter is not evaluated as a function. It will be handled as a String, leading to the error.
I don't know if you still need this or if you are still using this library, but I will try to include it in a PR :)