Configuring tooltips on Chart widget

Ben Rubinstein benr_mc at cogapp.com
Wed Dec 4 12:21:56 EST 2024


Has anyone been able to configure tooltips on the Chart widget?

My immediate requirement is a scatter plot, ideally with two different colours 
of markers, and with a custom tooltip on each marker.

If I try to edit the 'data labels' in the chart property inspector, my edits 
are immediately undone.

If I set the data points using the 'tsvData' property of the widget, and then 
set labels using the 'dataLabels' property, the scales of the widget are reset 
(so horizontal axis runs from 0 to 1.0, where before setting dataLabels, it 
ran 0 to 3,000). All the markers disappear (even if I deliberately add a 
datapoint within this range).

If I use the chartJsonData property, and include "options" as well as 
"datasets" in the JSON I submit, setting it has no effect. (Whereas removing 
that section from the JSON, setting the chartJsonData property does have an 
effect.)

If I use the chartJsonData property to set points including "x", "y" and 
"label" attributes for each, the data is accepted and the points appear in the 
expected place. But the tooltip on each point is the x and y values, e.g. 
"(30, 50)".

If I then use the chartOptionsData property I can modify scales, gridlines 
etc. But if I include a "plugins" attribute defining a "tooltip" callback in 
the JSON (definition copied from the interweb) then setting it has no visible 
effect (possibly an error is thrown somewhere). But, from then on when 
switching from tool mode to browser mode, the revErrorDisplay window pops open 
with a report of the form:
	LCB Error	array key does not exist
	Object	BensChartWidget
	LCB File	chartlc.lcb
	LCB Line	1873

Unfortunately, I can't locate a "chartlc.lcb" file in the package.

I'm a bit stumped. Is there a way to set a custom label for each point on a 
scatter chart using this widget?

TIA,

Ben



More information about the use-livecode mailing list