WebChart Labels missing

The content of the label disappeared on mouse-over WebChart Tooltip in XOJO 2021 r2.1. Why? Does anyone know a workaround to resolve it? (perhaps with javascript in Chart.js)
For exaple:

Var sales() As Double = Array(345890.0, 421934, 456908, 567987)
Var colors() As Color = Array(Color.Red, Color.Green, Color.Yellow, Color.Blue)
Var ds As New WebChartCircularDataset("Sales", sales, Colors)
Me.AddDataset(ds)
Me.AddLabels("Q1", "Q2", "Q3", "Q4")

“Q1”, “Q2”, “Q3”, “Q4” disappeared on mouse-over in Chart zone/area Tooltip (It was enabled in XOJO 2021 r1) because it was great and useful.
Thank you for any help

Here is a Screenshot to understand the problem:


This info (label describing the series) is very important in complex Charts with many data and colors

I’ve opened a NEW case in XOJO FEEDBACK
Summary: WebChart Labels in mouse-over-area Pop-up/Tooltip
Link: <feedback://showreport?report_id=66052>
User “Robin Lauryssen-Mitchell” has updated case #66052 TO REPRODUCIBLE
»»File(s) attached: 66052_2021r2.1_Win10Edge.png, 66052_2021r1.0_Win10Edge.png, 66052.xojo_binary_project.gz (Sample project and screen captures)

Hi @Calvi_Tecnologie_srl_Calvi,

It looks like the new version overrides the default label callback, in order to format the number.

Here is a workaround to bring back the previous behaviour, add this to the Shown event of your page:

Const js = "Chart.helpers.each(Chart.instances, function(c) { c.options.tooltips.callbacks.label = function(t,e){return e.datasets[t.datasetIndex].label + ': ' + t.value||''}; c.update() });"
Session.ExecuteJavaScript(js)
1 Like

Gracias Ricardo

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