Hi,
I have a XamDataChart with ScatterSplineSeries that I create dynamically as described here: https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/105114/create-series-dynamically-via-mvvm-binding.
Now I need to add a crosshair layer to this, but I don't know how since the ScatterSplineSeries are created in the SeriesTemplate and I only need one crosshair layer for all the series.
Is there a solution to this? My application is strict MVVM.
BR,
Hilma Maria
Hello Hilma,
I have been investigating into the behavior you are looking to achieve, and unfortunately at the time of writing this, the CrosshairLayer won’t really help you here, as the data point tracking for the CrosshairLayer does not work for the “scatter” related series. It only works for the “category” series (e.g. LineSeries, ColumnSeries, etc.). Support for the scatter-related series is something that is in development internally and should be available in a future version.
With that said, if you are just looking to have crosshairs appear on the chart and follow the mouse, then it is worth noting that the XamDataChart has a built-in crosshair that can be enabled by setting the CrosshairVisibility property on the chart to “Visible.”
Please let me know if you have any other questions or concerns on this matter.
Ok. No, I need the crosshair to display the values on each series (both on x- and y- axis), like in the crosshair layer example in the Infragistics WPF Samples application.
Since i have other problems with the scatter spline series (see my question here: https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/122792/scattersplineseries-with-tooltip-between-markers) , maybe I need to change to a regular spline series with a category x axis instead.
Is it possible to use the crosshair layer with my dynamic series if I make that change?
It is possible to use the CrosshairLayer if you switch to a SplineSeries, but keep in mind that you will need to use a CategoryXAxis and NumericYAxis in order to do this, and so your data items will be evenly spaced and must be in a left-to-right consecutive format.
If this is acceptable for your application, I would recommend taking a look at the attached sample project in which I have modified the sample from the other forum thread that you originally linked to include a SplineSeries and a Crosshair and CategoryTooltipLayer as you mentioned you wanted to display values on the series.
XamDataChartSplineSeriesBinderCase.zip
Hi Andrew, thanks for your answer. Yes, working with a spline series is OK in this time so your attached solution works fine.