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

Could it possible to add Crosshair feature to chart? #490

Closed
AndrewKhloptsau opened this issue May 25, 2022 · 3 comments
Closed

Could it possible to add Crosshair feature to chart? #490

AndrewKhloptsau opened this issue May 25, 2022 · 3 comments
Labels
enhancement New feature or request new feature

Comments

@AndrewKhloptsau
Copy link

Hello everyone! Could it possible to add crosshair feature to chart? It's very useful thing with custom axes.
image
More information https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxChart/Configuration/crosshair/

@beto-rodriguez beto-rodriguez added enhancement New feature or request new feature labels May 31, 2022
@beto-rodriguez
Copy link
Owner

Hi an thanks for the issue!

This is a great feature that is missing currently in the library, I will keep this issue open to track this implementation.

@AndrewKhloptsau
Copy link
Author

image
I wrote custom crosshair, maybe it will be helpful.
So the main points for custom crosshair:

  1. Creating lines is really easy with using RectangularSection when Xi==Xj and Yi==Yj.
  2. Crosshair subscribes to MouseMove CartesianChart event.
  3. I recommend using Animation for it, so without animation the movement of the crosshair will be "jump"
  4. The worst thing is CrosshairLabel, because i didn't find any useful way how to create custom label on chart Axis. So for creating Labels i had to use ColumnSeries DataLabel with Fill=Color.Empty and recalculate position for labels (ObservablePoint coordinates) on each chart update. Also for correct scaling Y Label position i had to create a new invisible Y Axis and bind ColumnSeries to it (ScalesYAt) and update MinLimit = _mainY.VisibleDataBounds.Min and MaxLimit = _mainY.VisibleDataBounds.Max for this axis on each data update.

Note: DataLabelPadding don't work very well in this case (you can see it on screenshot) and i haven't fixed it yet.

@beto-rodriguez
Copy link
Owner

This is going to be included in the next version of the library.

Sample here:
https://github.com/beto-rodriguez/LiveCharts2/blob/dev/samples/ViewModelsSamples/Axes/Style/ViewModel.cs

micael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new feature
Projects
None yet
Development

No branches or pull requests

2 participants