Hi,
I have a binding for CursorPosition in CrosshairLayer:
<Setter Property="CursorPosition" Value="{Binding DataCursorPosition, Mode=OneWay}" /> If I change the zoom it is placed not over data point, if not zoomed works fine.updating cursor cursor in ViewModel:
DataCursorPosition = (double)(dataPoint.Time.Ticks - minTime.Ticks) / (maxTime.Ticks - minTime.Ticks);
Best regards,Krzysztof
Hello Krzysztof,
I have been investigating into the behavior you are seeing, but I cannot seem to reproduce the behavior where zooming does not place the CrosshairLayer on the data point. One thing that may be a problem with the code you are using in this case though, is that the CursorPosition property take a Point object – not a double, and so I’m not sure that your binding to DataCursorPosition will work in this case unless you are converting it somehow?
I am attaching the sample project I used to test this. In the sample, the crosshair stays locked to the data point I have defined and am calculating the position of.
Please let me know if you have any other questions or concerns on this matter.
XamDataChartCrosshairPositionBinding.zip
Hi Andrew,
yes, sorry, I was too quick and 'shorten' too much the code and in fact there is DataCursorPosition = new Point(<calculated position>, 1)but I went through the properties of xamDataChart and at the end looks like it is caused by PlotAreaMargin ...
We have set it to 20I'm trying to figure out how to adjust position with WindowRect and this marginBest regards,Krzysztof
It may be worth noting in this case that if you are trying to get the CrosshairLayer to snap to your data points, you can set the UseInterpolation property of the CrosshairLayer to false. This will prevent the CrosshairLayer from moving from the points in the plot area, as it will snap to the actual points instead.
Unfortunately it does not help, when zooming in and out it will cause that cursor snap from one datapoint to another depending
We have two crosshair layers, the 'default' one with interpolation off, and second which we call 'data cursor' crosshairlayer, as you can see when I hover over right data point, the 'default' layer is snapping correctly, when I click this datapoint, because of that plotareamargin, position is snapped to the left data point (green). When I will zoom in/out it will snap to another data point (or moving zoombar also will cause it)
So it must be also somehow adjusted by WindowRect X and Width and the 'default' layer can handle it somehow
Setting PlotAreaMargin to 0 (or left/right to 0) is solving it but some of the data markers are cut off, but maybe I will figure out how to do the margins in another way if there is no way to calculate the position.
Best regardsKrzysztof
If your data points are being cut off, it is worth noting that if you are using a TimeXAxis or CategoryDateTimeXAxis, you can set the MinimumValue and MaximumValue of the axis to something slightly outside of the data that is plotted. This would prevent the markers from being cut on the left and right.
Similarly, the NumericYAxis also has a MinimumValue and MaximumValue property that can do something similar to prevent the markers from being cut from the top and bottom.
Thank you for your update on this matter. I am glad the workaround is working for you on this matter.
I have asked our development teams to examine this further, and so I believe this behavior should be fixed in a future version, allowing the calculations to take into account the applied PlotAreaMargin.
To ensure this receives attention, I have logged it in our internal tracking systems with a development ID of 274655. I will be linking this to a private support case that I have created for you so you can be notified when a fix or other resolution is made. This case has an ID of C-00226551, and you can access it after signing into your account, here: https://account.infragistics.com/support-cases.
yes, that's how I fixed it for now. As for workaround it is ok, but would be nice to fix it in the futureBest regards,Krzysztof