SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

1 vote
36 views

Hello, SciChart Team!
i have an issue using mouse drag event ( RubberBandXyZoomModifier, ZoomPanMidifier). the message says “NullReferenceException in SciChart.Charting.dll ” or “Thread.cs not found” from time to time.
after some experiments i figured out that the app starts to crush after i change XAxis type .
i have a simple mvvm user control used to display both arrays of double and datebound data, XAxes of SciChart Surfase is bound to an observable collection of IAxis elements. if i need to change chart type i clear this collection and create an axis of desired type (DateTimeAxisViewModel or NumericAxisViewModel). after that the series can be added, but zooming causes crash with nearly to no info.

i attached a solution, which lacks only scichart dlls in order to run (hopefully), Window_Loaded method has a commented line which changes chart type and makes app crush on zooming, would be nice if you checked it out.
Thanks in advance!
Alexander

0 votes
715 views

I’ve been trying a few ways to get this to work now and I’m still struggling to get a catch-all solution.

My requirements are:
– self-scrolling real-time data series with a fixed-time range (regardless of the number of points)
– y axis should support either fixed or automatic visual range
– support rubber band zoom (and ideally mousewheel too) on both axes

The key problem is that the stock ticker example doesn’t have a fixed time width. The points are added to the chart, and the axis expands until it reaches capacity. It’s also relatively easy to use FifoCapacity (adding a lot of NaN points), but FifoCapacity works on number of points, which isn’t great when you have irregular updates. I’m happy with the chart not scrolling until a new update is received, but the range of the chart must be fixed (say, five minutes), regardless of the number of visible points on the chart.

My current solution involves deriving from XyDataSeries to duplicate the FifoCapacity behaviour for a fixed time:

   public class RealTimeXyDataSeries<T> : XyDataSeries<DateTime, T>
            where T : IComparable
{
    public TimeSpan _limit;

    public TimeSpan Limit
    {
        get { return _limit; }
        set
        {
            _limit = value;
            Update();
        }
    }

    public RealTimeXyDataSeries(TimeSpan limit)
    {
        Limit = limit;
    }

    public override void Append(DateTime x, T y)
    {
        base.Append(x, y);

        Update();
    }

    public void Update()
    {
        if ((DateTime)XMax == DateTime.MinValue) return;

        var c = 0;

        while (XValues[c] < (DateTime) XMax - Limit) c++;

        if (c <= 0) return;

        RemoveRange(0, c);
    }
}

That takes care of removing points, but doesn’t deal with the range issue. To deal with that, I have some code in my codebehind to set the XAxis VisibleRange on every update, which feels a bit nasty. I wanted to create a RealTimeDateTimeAxis, but none of the relevant functions are override/virtual.

I also took the implementation of RubberBandXyZoomModifierEx from the knowledge base, with some modifications to deal with Y-Axis zoom/reset based on it’s AutoRange setting. However, this involves setting the Y-Axis AutoRange state back to a saved value, and I keep seeing MouseModifierUp events after my DoubleClick events, which resets AutoRange back to Never.

It feels like I’m doing a lot of work in a lot of places to get this to work, and it’s resulting in complex code and buggy behaviours; I’m not comfortable handing this over to another engineer in the current state.

Is there a better way to do this?

  • Rick C asked 1 year ago
  • last active 1 year ago
0 votes
894 views

We are transitioning from using oxyplot to sci-chart for the increased performance it offers.

In oxyplot you are able to configure the plot to allow you to click and drag on an axis to zoom only that axis.

I have found RubberBandXyZoomModifier, and can see how it can be set up to only zoom the x or y axis, but cant see any way to allow zooming a specific x or y axis when the click and drag occurs on that axis.

Before I dive into the modifiers API and start to figure out how to do this from scratch, am I missing something, or do you have any pointers on how to achieve this functionality as I believe it is a pretty common use case.

  • Hugoagogo asked 2 years ago
  • last active 2 years ago
1 vote
919 views

Due to the user often needing to select pre-specified ranges of data to view, I handle the X- and Y-axis VisibleRange manually in code.
I also have both RubberBandXyZoomModifier and MouseWheelZoomModifier enabled.
Instead of using a generic ZoomExtentsModifier (which would show all data), I handle a MouseDoubleClick in code and set the VisibleRanges to the bounds of the user-selected data area’s range.

Now if the RubberBand zoom is used followed by a double-click, the VisibleRange.SetMinMax function gets called with the correct values in my code, but that range does not appear on the chart. However if a MouseWheelZoom is used after the RubberBand zoom, it works fine. Is there something about the RubberBand zoom that is stopping the VisibleRange.SetMinMax function values from being recognized by the chart?

Thanks!

0 votes
1k views

To whom this may concern:

I am having a small problem with text annotations. When they are dynamically created with the IsEditable property set to “true”, the annotations change in size after being moved.

This is shown in the “Interaction with Annotations” example in your Examples program. If you look at the box showing “sell”, at first when you zoom in on it closely enough (using the RubberBandXyZoomModifier around the extents of the TextAnnotation) it retains its size.

Now if you zoom back to the extents, and move the “sell” TextAnnotation anywhere around the graph, and then zoom in on it again, it changes size (screenshot from Examples program attached). This is an issue i’m having with one of my programs.

Is there a way to maintain the size of the text annotation without having to set a fixed height and width?

Thanks kindly!

— Ari

  • Ari Sagiv asked 2 years ago
  • last active 2 years ago
0 votes
2k views

Hi,

I’m using the error bars series, and I get some strange behavior when zooming in/out using the RubberBandXyZoomModifier.
Sometimes the vertical line is not drawn, and sometimes the top & bottom horizontal lines are not drawn / drawn too wide.

This issue doesn’t occur when zoom with the MouseWheelZoomModifier.
However, with the MouseWheelZoomModifier in the current implementation the top & bottom horizontal line width depend on the zoom level (the zoom level affects the horizontal lines), where in my opinion it should not. For example, when zooming in, the horizontal lines may cover the whole view width, and when zooming out to a certain level you cannot see them since they are too short.

I attached a few screenshots of the same data in different zoom/pan, when using the RubberBandXyZoomModifier (the MouseWheelZoomModifier issue can be easily reproduced with simple data).
Screenshot ‘error_bars_display1’: horizontal lines are too wide.
Screenshot ‘error_bars_display2’: vertical & horizontal lines are not drawn at all (left line. Only the scatter series cross marker can be seen).
Screenshot ‘error_bars_display3’: vertical line is drawn, but horizontal lines are not (left line. This is one mouse wheel rotation-click away from screenshot #2).
It seems like an issue with the line size calculations (?).

Note: the ‘closing’ value of the HlcSeries is drawn using a Scatter series with a cross marker, so you can ignore it in the attached screenshots.

Thanks.

  • Yonatan D asked 3 years ago
  • last active 3 years ago
0 votes
2k views

Hi,

Are there any events on the chart which fires on zoom starts and zoom ends which i can use to calculate the time taken for the zoom operation.

Thanks,

Pruthvi Sagar

-1 votes
3k views

Hi All,

I’ve read the following forum entry on using a context menu with and ALT-Right click to get around problems with event interference:

https://www.scichart.com/questions/question/contextmenu-does-not-work-on-graph-when-panning-is-enabled-by-right-mouse-button

I have the same problem with zoom and implemented the solution mentioned above. Then I noticed on one of my test apps that the two would live side by side quite nicely without doing anything BUT it made selecting a scatter series trickier. i found that using ReceiveHandledEvents had an effect on the behaviour in that while this was false zoom and context were fine but selecting a series was a bit hit and miss, but while it was true the behaviour in the link was displayed i.e. context menu appearing after zoom operation.

Here’s the XAML;

        <s:SciChartSurface x:Name="ChartSurface" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" s:ThemeManager.Theme="Chrome">

        <s:SciChartSurface.ContextMenu>
            <ContextMenu>
                <MenuItem Header="Item1" />
                <MenuItem Header="Item2" />
                <MenuItem Header="Item3" />
                <MenuItem Header="Etc.." />
            </ContextMenu>
        </s:SciChartSurface.ContextMenu>

        <s:SciChartSurface.XAxis>
            <s:DateTimeAxis AutoRange="Once"/>
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.YAxes>
            <s:NumericAxis x:Name="LinearAxis" Id="LinearAxis" AutoRange="Always" AxisAlignment="Left" AxisTitle="Linear" Style="{StaticResource LinearScaleStyle}"/>
        </s:SciChartSurface.YAxes>

        <s:SciChartSurface.ChartModifier>
            <s:ModifierGroup>
                <s:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="True" IsXAxisOnly="False" IsAnimated="True" ExecuteOn="MouseRightButton" ZoomExtentsY="False" ReceiveHandledEvents="True"/>
                <s:ZoomPanModifier x:Name="zoomPanModifier" ExecuteOn="MouseLeftButton" ZoomExtentsY="False" ReceiveHandledEvents="True" IsEnabled="True" XyDirection="XDirection"/>

                <!--
                ReceiveHandledEvents * True = context menu appears on completion of a right mouse button zoom operation
                ReceiveHandledEvents * False = Zoom and Context menu are fine but selecting a series needs a slow double click type thing
                -->
                <s:SeriesSelectionModifier ReceiveHandledEvents="True">
                </s:SeriesSelectionModifier>
                <s:LegendModifier x:Name="SelectedSeriesLegend" ShowLegend="True" GetLegendDataFor="SelectedSeries" Margin="5" SourceMode="AllVisibleSeries" />
            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>

    </s:SciChartSurface>

Can anyone explain this? Is there an accepted workaround? are there any other easy methods of selecting a series that don’t involve clicking on it (e.g. select from legend)?

Thanks in advance

/Stu

0 votes
3k views

Hi,

Could your provide an example on how to change the color of the zoom box that is drawn when using the rubberbandzoomodifier? I have a gray background and it is difficult to see the white box that is drawn.

Thanks,
Jason

  • morseja asked 3 years ago
  • last active 3 years ago
Showing 9 results
This template supports the sidebar's widgets. Add one or use Full Width layout.