Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line Series Trackball Tooltip Format Series Name #24

Closed
walsha2 opened this issue Sep 15, 2019 · 2 comments
Closed

Line Series Trackball Tooltip Format Series Name #24

walsha2 opened this issue Sep 15, 2019 · 2 comments

Comments

@walsha2
Copy link

walsha2 commented Sep 15, 2019

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);
@JayavigneshwaranG
Copy link
Collaborator

Hi @walsha2 ,

Sorry for the inconvenience.
We are able to reproduce the reported issue at our end and we have fixed this now. Published the fix to pub. So please use the latest version packages(1.0.0-beta.5).
Now series.name will be replaced with the appropriate value in the tooltip.

We are closing this issue. But you can reopen this if you face any concerns.

Thanks,
Jayavigneshwaran

@walsha2
Copy link
Author

walsha2 commented Sep 19, 2019

@JayavigneshwaranG confirmed - this is now fixed with the latest release. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants