Closed
Description
Description:
In the following example for a line series chart (where x-axis is DateTimeAxis
and y-axis is NumericAxis
) the following does not work as expected:
tooltipSettings: InteractiveTooltip(
textStyle: ChartTextStyle(color: Colors.black, fontSize: 11),
format: 'series.name: point.y',
borderWidth: 1,
borderColor: Colors.black,
color: Color.fromRGBO(255, 255, 255, 0.75),
)
The tooltip label correctly parses and replaces point.y
but does not do the same for series.name
it just keeps it as the string: 'series.name'
in the tool tip and does not update.
Issue Resolution:
Digging through the code, the following seems to be the culprit - series.name
is completely missing:
lib/src/chart/user_interaction/trackball_painter.dart
labelValue = chart
.trackballBehavior.tooltipSettings.format
.replaceAll('point.x', (x ?? xValue).toString())
.replaceAll('point.y',
_getLabelValue(yValue, cartesianSeries._yAxis))
.replaceAll('{', '')
.replaceAll('}', '');
Changing to this to the following (adding series.name
replacement), solved the issue:
labelValue = chart
.trackballBehavior.tooltipSettings.format
.replaceAll('point.x', (x ?? xValue).toString())
.replaceAll('point.y',
_getLabelValue(yValue, cartesianSeries._yAxis))
.replaceAll('{', '')
.replaceAll('}', '')
.replaceAll('series.name', cartesianSeries.name);
Metadata
Metadata
Assignees
Labels
No labels