Pre loader

Shifted rollover selection points

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi,

I’m testing SciChart for a new application that will make big use of charts and stumbled upon a small problem with the rollover. I have a small, but noticeable shift between the rollover selection point and the data point, and can’t figure out where that is coming from.

It is visible here:

Here’s how I have defined the SciChartSurface, the data and series are coming from a ViewModel that populate an observable collection of ISeriesViewModel.

       <sc:SciChartSurface SeriesSource="{Binding SeriesViewModels}" ZoomExtentsCommand="{Binding ZoomExtentsGraph}">

            <sc:SciChartSurface.XAxis>
                <sc:NumericAxis AutoRange="Once" TextFormatting="E" GrowBy="0.1, 0.1"/>
            </sc:SciChartSurface.XAxis>

            <sc:SciChartSurface.YAxis>
                <sc:NumericAxis AutoRange="Once" TextFormatting="E" GrowBy="0.1, 0.1"/>
            </sc:SciChartSurface.YAxis>

            <sc:SciChartSurface.ChartModifier>
                <sc:ModifierGroup>
                    <sc:LegendModifier x:Name="legendModifier" GetLegendDataFor="AllSeries"/>
                    <sc:RubberBandXyZoomModifier IsEnabled="True" IsAnimated="True" />
                    <sc:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
                    <sc:RolloverModifier DrawVerticalLine="False" SourceMode="AllSeries" TooltipLabelTemplate="{StaticResource RolloverLabelTemplate}"/>
                    <sc:MouseWheelZoomModifier />
                </sc:ModifierGroup>
            </sc:SciChartSurface.ChartModifier>
        </sc:SciChartSurface>

Here’s the code where I add the series to the observable collection.

        private void SetDataPoints()
        {
            for (int i = 0; i < data.W.Length; i++)
            {
                Color serieColor = GetRandomColor();

                XyDataSeries<double, double> dataSerie = new XyDataSeries<double, double>()
                {
                    SeriesName = String.Format("Data point {0}", i)
                };
                XyScatterRenderableSeries renderSerie = new XyScatterRenderableSeries();
                renderSerie.PointMarker = new EllipsePointMarker()
                {
                    Width = 9,
                    Height = 9,
                    Fill = serieColor
                };

                renderSerie.SeriesColor = serieColor;

                for (int j = 0; j < data.Q.Length; j++)
                {
                    dataSerie.Append(data.W[i], data.Q[j]);
                }

                seriesViewModel.Add(new ChartSeriesViewModel(dataSerie, renderSerie));
            }
        }

Also, is there a way to automatically add colors to the points that would “look good” with the selected theme? I want each serie to have its own color, but selecting colors at random makes that sometimes the colors are difficult to read with the black theme.

I would also like to have, for each serie, a different type of PointMarker so that they can be distinguished by something beside the color alone, is there a way to set pre-defined marker types?

Thanks in advance.

  • You must to post comments
0
0

Hi there,

Ok regarding your first question: offset. There are two things to consider here. One is Rollover is a WPF FrameworkElement and the scatter points are a bitmap (which must be snapped to integer pixels). There may be a small offset as a result. I would suggest to minimise the offset, make the Rollover size larger. That way it will look like your hovered points ‘grow’ a little.

Also .. it is possible there is a small bug in v2.1.1 (which we have addressed in our internal builds) related to padding of the RenderSurface. Check it again when v2.2 is out.

Regarding point-markers, please see this article: http://http://www.scichart.com/documentation/webframe.html#PointMarkers%20(Data-Point%20Annotations).html

We have four types of PointMarker and also a SpritePointMarker, although the sprite one does not support per-point binding. You can also inherit PointMarkerBase and draw directly to the RenderContext provided but this isn’t a published API, more used for internal use.

Regarding series colors, sorry there is no auto color selector for many series.

Best regards,
Andrew

  • xhahn
    Thanks for your reply, now it opened another question. Is there a way to define the RolloverMarkerTemplate from the code, or to change the rollover marker dynamically? Alternatively, is there a way to define a set of series and rollover marker templates in a declarative way (from the XAML) and use them when I dynamically create the series, in a MVVM way of course... For example, I would like to define, let's say 10 different types of point markers with different colors, and when I add a new data serie, make it take the first one, then the next the second and so on until it loops.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies