Pre loader

Tag: Xaxis data range

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 votes
0 answers

I’m encountering some odd behaviour when I rescale my graph to modify the range of the X axis. For certain data series, the line disappears from the chart.

e.g. I have a data series that’s 2899 points long, with X values ranging from -6.17 to 22.81, so I change my X axis range to be from -8 to 24 to fit it all in. When I change the VisibleRange of the SciChartSurface.XAxis, then the line disappears. If I don’t rescale the visible range then the portion that would be visible is rendered fine.

The funny thing about it is, if I remove the last point from the series before adding to the chart, it draws fine, even after I rescale the visible range! The same goes for if I add another point to the end (e.g. even if that point is identical to the existing last point).

Now if I hover the mouse (Rollover) over the chart, the spot to highlight the point in the line still appears as if the graph was still there. It’s like it’s there but invisible.

I’ve tried setting DebugWhyDoesntSciChartRender to true, but this fires only when the chart is initially drawn and no series’ have been added yet, so I get

SciChartSurface didn’t render, RendererErrorCode: [RendererErrorCode: [Because the SciChartSurface.RenderableSeries collection is null or empty. Please ensure that you have set some RenderableSeries with RenderableSeries.DataSeries assigned, or you have set Axis.VisibleRange for all axes in order to view a blank chart.]
RendererErrorCode: [Because none of the SciChartSurface.RenderableSeries has a DataSeries assigned]

However I add the DataSeries’ after this, and when I do that, or rescale the axis, no error is reported.

Here is my XAML code to show the chart:

        Annotations="{Binding Annotations}"
        GridLinesPanelStyle="{StaticResource GridLinesPanelStyle}"
        RenderableSeries="{s:SeriesBinding ChartSeries}"
        Style="{StaticResource SurfaceStyle}">

            <s:HighQualityRenderSurface />

                AxisTitle="{Binding XAxis.Label}"
                DrawLabels="{Binding XAxis.ShowLabels}"
                DrawMajorGridLines="{Binding XAxis.MajorGridLines}"
                DrawMinorGridLines="{Binding XAxis.MinorGridLines}"
                LabelProvider="{Binding XAxisLabels}"
                MajorDelta="{Binding XAxis.MajorDelta}"
                MinorDelta="{Binding XAxis.MinorDelta}"
                Style="{StaticResource XAxisStyle}"
                TickLabelStyle="{StaticResource XAxisLabelStyle}"
                TitleStyle="{StaticResource AxisTitleStyle}"
                VisibleRange="{Binding XAxis.DisplayRange.Value}" />

                AxisTitle="{Binding YAxis.Label}"
                DrawLabels="{Binding YAxis.ShowLabels}"
                DrawMajorGridLines="{Binding YAxis.MajorGridLines}"
                DrawMinorGridLines="{Binding YAxis.MinorGridLines}"
                MajorDelta="{Binding YAxis.MajorDelta}"
                MinorDelta="{Binding YAxis.MinorDelta}"
                LabelProvider="{Binding YAxisLabels}"
                Style="{StaticResource YAxisStyle}"
                TickLabelStyle="{StaticResource AxisLabelStyle}"
                TitleStyle="{StaticResource AxisTitleStyle}"
                VisibleRange="{Binding YAxis.DisplayRange.Value}" />

                    LegendTemplate="{StaticResource LegendTemplate}"
                    ShowLegend="{Binding ShowLegend}"
                    ShowVisibilityCheckboxes="False" />
                <s:RolloverModifier ShowAxisLabels="False">
                        <Style TargetType="Line">
                            <Setter Property="Stroke" Value="{StaticResource VitalCyanBrush}"/>
                            <Setter Property="StrokeThickness" Value="16"/>
                            <Setter Property="Opacity" Value=".2"/>
                            <Setter Property="IsHitTestVisible" Value="False"/>
                            <Setter Property="UseLayoutRounding" Value="True"/>
                        <!--  When a series is selected (on click), apply this style  -->
                        <Style TargetType="s:BaseRenderableSeries">
                            <Setter Property="Stroke" Value="DeepPink" />
                            <Setter Property="StrokeThickness" Value="3" />


and here is the code to change the Axis visible range. (In the ViewModel). Note that while this changes both the X Axis and the Y Axis scale, only the X Axis change causes this problem.

        protected override void ScaleAxes(double xaxisLowerValue, double xaxisUpperValue, double yaxisLowerValue, double yaxisUpperValue)
        var xAxisRange = new AxisRange(0, 0);
        var yAxisRange = new AxisRange(0, 0);

        //Resolve time axis
        yAxisRange.MaxValue = CalculateUpperBoundary(yaxisUpperValue, (double)_graphIndicators.BarChartMaxIndicator, YAxis.UpperPadding, YAxis.MajorDelta);
        yAxisRange.MinValue = CalculateLowerBoundary(yaxisLowerValue, (double)_graphIndicators.BarChartMinIndicator, YAxis.LowerPadding, YAxis.MajorDelta);

        //Resolve Volume Axis
        xAxisRange.MaxValue = CalculateUpperBoundary(xaxisUpperValue, xaxisUpperValue, XAxis.UpperPadding, XAxis.MajorDelta);
        xAxisRange.MinValue = CalculateLowerBoundary(xaxisLowerValue, xaxisLowerValue, XAxis.LowerPadding, XAxis.MajorDelta);

        //ensure max and min range have not exceeded the boundary range.
        xAxisRange = EnsureRangeIsWithinBounds(ref xAxisRange, XAxis.BoundingRange);
        yAxisRange = EnsureRangeIsWithinBounds(ref yAxisRange, YAxis.BoundingRange);

        //ensure max and min range are within optimal range.
        xAxisRange = EnsureRangeIsWithinOptimal(ref xAxisRange, XAxis.OptimalRange);
        yAxisRange = EnsureRangeIsWithinOptimal(ref yAxisRange, YAxis.OptimalRange);

        //update the display range
        XAxis.DisplayRange = xAxisRange;
        YAxis.DisplayRange = yAxisRange;
0 votes

In our view model, the data range is expanded to include data outside of the X-Axis range. This is done to preserve the spline curve which is defined by previous points– doing this prevents the spline curve from changing drastically by including X number of points outside the range.

When the Draw function is called, the point context that was bound in is filtered to the X Axis range which leads to the spline curve changing as you pan (especially noticeable if it affects a peak).

How can I change this behavior to preserve the spline line?

Updated — Setting ResampleMode = None does not give me all the points.

0 votes

Hello all,

I am implementing polar chart in my wpf application, and I am trying to customize the next with no success:
– Xaxis data range is between the lowest and the highest value. I need that xaxis goes from 0º to 360º, but sometimes my angle dataseries does not cover the whole range (i.e. it goes from 15º to 270º). I’ve tried a customtickprovider, setting VisibleRange from 0 to 360º, but it doesn’t work. Any ideas?
– I need that the line connecting to points is a straight, but a curve is drawn instead. Is there any property in PolarXAxis or FastLineRenderableSeries to achieve this?


Showing 3 results