Pre loader

Tag: Real-time charts

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

1 vote
9k views

Hello,

I am now experimenting with SciChart (trail period).
I want to constantly draw the latest 300 points of a real time generated sine wave. I wrote a little program that tries to do this (attached). The sine wave is generated in the OnTimer function. I expected Draw_Limited_Range() function to draw the latest 300 points using XAxis.VisibleRange. Unfortunately this doesn’t work from OnTimer. Same function does work as expected when called from a button (Set VisableRange).
The output window of the debugger keeps displaying following message: A first chance exception of type ‘System.InvalidOperationException’ occurred in WindowsBase.dll

I tried this both on Ver 3.2 and 3.1; On 3.1 it crashes very fast.

What am I doing wrong?

Thanks,

Danny

1 vote
14k views

Hi,

My step line chart represents a real-time time series and the viewport slides forwards in realtime to show the last 5 minutes. Sometimes the value of the series doesn’t change for some seconds or minutes. This leaves a gap in the line chart between the latest value and the right side of the viewport (now).

I would like the latest value to always be extended as a horizontal line to meet the right side of the viewport.

I have half achieved this by extending FastLineRenderableSeries like so:

public class ExtendRightFastLineRenderableSeries : FastLineRenderableSeries
{
    protected override void InternalDraw(IRenderContext2D renderContext, IRenderPassData renderPassData)
    {
        base.InternalDraw(renderContext, renderPassData);

        var points = renderPassData.PointSeries;

        var yLast = renderPassData.YCoordinateCalculator.GetCoordinate(points.YValues.Last());

        var xLast = renderPassData.XCoordinateCalculator.GetCoordinate(points.XValues.Last());
        var xEnd = renderContext.ViewportSize.Width;

        using (var linePen = renderContext.CreatePen(this.SeriesColor, this.AntiAliasing, this.StrokeThickness))
        {
            using (var lineDrawingContext = renderContext.BeginLine(linePen, xLast, yLast))
            {
                lineDrawingContext.MoveTo(xEnd, yLast);
            }
        }
    }
}

The only problem is that when no data points are in the viewport (because the value last changed more than 5 minutes ago) then the Draw method of the FastLineRenderableSeries never gets called.

How can I force the redraw even though there are no points in the viewport. Alternatively, is there a better way to approach this?

Cheers
Felix

  • F W asked 9 years ago
  • last active 9 years ago
1 vote
2k views

I am facing a little hurdle in plotting the date value to the chart.

How to add the date to chart x axis and numeric value to the y axis?
Please provide a example to add the date in x axis and numeric value in the y axis.

Please provide a example with one series in the y axis.

I have a requirement to plot the patient vital signs, the date value in x axis and vital signs in y axis.
x – Date when the vital sign is captured
y1, y2, y3, y4, y5 – BP, Heart rate & other vital signs

The model data looks like below.

{“x”:”29-Nov-2022 04:37″,”y1″:”119″,”y2″:”80″,”y3″:”15″,”y4″:”23.6″,”y5″:”86″},
{“x”:”29-Nov-2022 04:38″,”y1″:”119″,”y2″:”80″,”y3″:”15″,”y4″:”23.6″,”y5″:”87″},
{“x”:”29-Nov-2022 04:39″,”y1″:”119″,”y2″:”80″,”y3″:”15″,”y4″:”23.6″,”y5″:”86″}

1 vote
2k views

Hello,
I receive data at a very high speed from a hardware board and need to plot it on a SciChartSurface.
the sample is FastLineRenderableSeries

   <s:SciChartSurface x:Name="sciChart0" MaxFrameRate="5" 
               s:VisualXcceleratorEngine.AvoidBlacklistedGpu="False"
                s:VisualXcceleratorEngine.IsEnabled="True" 
                ForceCursor="True"
                s:VisualXcceleratorEngine.FallbackType="{x:Type s:HighQualityRenderSurface}"
                s:VisualXcceleratorEngine.DowngradeWithoutException="False" 
                s:VisualXcceleratorEngine.EnableImpossibleMode="True" 
                RenderPriority="Normal">
         <s:SciChartSurface.RenderableSeries>
                  <s:FastLineRenderableSeries   x:Name="RenderableSeries1" DataSeries="{Binding Series, 
                     Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
           </s:SciChartSurface.RenderableSeries>

    </s:SciChartSurface>

while Series is XyDataSeries<double, double>
I created a thread that opens a socket (on port 3490) and all the information it receives it draws on the graph.
The problem is that if some time passes, and I stop the transmission of the data, it still draws what it has left to draw to “reach the end of the buffer”. It makes me realize that he is not keeping up with the transmission and it takes him more time to draw than the time it takes for the information to arrive.
(If I start the transmission and let it draw, and then stop quickly, it does stop immediately. The problem is if a lot of information arrives over time).
I wanted to ask if there is a way to speed it up in some way? (Maybe by giving up the plotting quality?)
Since I need to draw the information that arrives in real time and not information that arrived a few seconds ago…
The drawing is done by a separate thread:

i’m using Append():

Series.Append(double[XPoints] array, double[YPoints] array);
1 vote
4k views

Hello, I’m using the trial version currently and everything is working great.
I was wondering is there is any way to freeze the chart like I’m looking at pictures while the chart appends new data or save somehow the data points until I will finish my zoom(also if I can move while zooming).
I’m new developer and I have some Idea how to do that but I don’t what will be the right way to do so.

  • Shai Ashto asked 1 year ago
  • last active 12 months ago
1 vote
17k views

Right now i’m using trial version but i’m looking forward to buy full version as to integrate the charts in my app . I am building an real time chart that update data according to time , which means simply i need Time on the x axis and numeric values on the y axis , but i’m not getting any hint how to get the time values on the x axis .

1 vote
12k views

Hi, i have follow the guide to create a chart but i would insert data every 1 second in a Line chart… i have do it but this is the result.

1 vote
15k views

Hi,
I am trying to implement pan and zoom functionalities for real time charts present in Sci chart demo application
Can any one please suggest me on how to implement the same

Thanks in advance

0 votes
15k views

Why there are no points and line appear when I try to plot the graph in real time?
I also have verify with an example “Creates Real-time Charts” but still no lines appear.The graph is moving but to points and line appear.

Using
SciChar v2.2.3441 and v1.7.1.2560
Win 7 Enterprise Service Pack 1
.Net 4.5 installed

Thanks,
basalode

  • basalode asked 10 years ago
  • last active 10 years ago
0 votes
11k views

I have a real-time chart that already drawn.
Is there a method that scrolls programmatically ?
If there is no such method, how i can do this ?

0 votes
8k views

So far what I know about Scichart is only their given examples, They are really great, what worries me now before I apply for any realtime cryptocurrency data API, I would like to know how to integrate the API to my chart so that I get real time data. If there is any example code with API recommendations I would really appreciate.

0 votes
10k views

Hello I am curenntly using three REAL Time Charts (FiFo) in my WPF application and I am running into performance issues, which result in UI stuttering. I tried to optimize my performance using your very informative article on performance (Rendering,Stroke,Buffer etc.), but it did not help much, so I wondered if you might be able to help me.

I currently use three graphs and each of them has two different sets of data applied. The size of my FiFo graphs is 100 samples, with a dt= 0.01 (100Hz). I assume the OnNewData event is triggered at that rate as well?

My current code looks like this:

private void OnNewData(object sender, EventArgs e)
    {

        if (TaskManager.tempObject. != null)
        {
            lock (TaskManager.tempObject)
            {
                y0 = Math.Abs(TaskManager.tempObject.LaserPosRel - TaskManager.tempObject.AxisPos);
                y1 = TaskManager.tempObject.AxisPos;
                y2 = TaskManager.tempObject.AxisSpeed;
                y3 = TaskManager.tempObject.AxisAcc;
                y4 = y1;
                y5 = TaskManager.tempObject.LaserPosRel;

            }
        }


        using (sciChartSurface1.SuspendUpdates())
        {
            _series0.Append(t, y0);


        }

        using (sciChartSurface2.SuspendUpdates())
        {

            _series1.Append(t, y1);
            _series2.Append(t, y2);
            _series3.Append(t, y3);


        }

        using (sciChartSurface3.SuspendUpdates())
        {

            _series4.Append(t, y4);
            _series5.Append(t, y5);

        }

        // Increment current time
        t += dt;
    }

I wondered if you have any proposals how to enhance my code, regarding performance?
Would it make a difference if I would Append the series in a new thread? I was not sure of this, since it is stated
in the FAQ that SciChart already uses it’s own threads for rendering.

Any help is appreciated, thanks in advance!

best regards

nils

  • nesphit asked 8 years ago
  • last active 8 years ago
0 votes
15k views

I would like a “Pause” button on my chart to temporarily suspend drawing updates, even while realtime data updates are still coming in to the databound DataSeries. Pressing the button again would re-enable drawing updates and show the data lines updated with all the data collected while drawing was previously paused.

Is there anything in the SciChart API to do this easily or would I need to do this manually (possibly by cloning the DataSeries when the chart is paused and databinding to the clones, then restoring the original binding when un-paused)?

Thanks!

0 votes
12k views

I have DateAxis as X Axis, so I want to trigger a button to zoom In/Out to a specific time at the latest plotted point (Price).
Example: I have zoom button 30 minutes, 15 minutes, 5 minutes and 2 minutes….

0 votes
13k views

I’ve got a few questions about plotting Lat/Long coordinates in real time.

Situation
I’ve got two data series – (Timestamp, Latitude) & (Timestamp, Longitude) being updated 10 times/second. My goal is to graph car position in real time with a ScatterRenderableSeries and color each point according to other channels of data (temp, brake pressure, yaw rate, etc..).

How to best associate metadata?
In order to color the plotted points I need to be able to associate them with their respective timestamps. Do you have any advice on how best to do so? It seems the most obvious solution is using the PointMetaData API, but I’m curious if there would be a more efficient solution (like say somehow using an Xyz/Xyy DataSeries).

Dealing with the unsorted nature of the data?
I’m aware that SciChart performs much better when only inserting sorted data into a XyDataSeries. Seeing as I only receive GPS data 10 times/sec, I’m wondering if you think the lost performance will still pose a problem?

I’d appreciate any advice you could give!

0 votes
12k views

How can I append a float array to an XYDataSeries?

I’m developing an app with scichart. I receive buffers of 20 floats in a float[] type. How can I append this buffer to an XYDataSeries? The chart is updated in real time each time one Buffer is received with FIFO capacity.

What I need is something similar to:

void updateChart(final float[] a, final float[] b) {
    UpdateSuspender.using(surface, new Runnable() {
            @Override
            public void run() {
                // Append the new data received
                lineData.append(a,b);
                // Zoom series to fit the viewport to the x variable
                surface.zoomExtentsX();
            }
        });
}

Is this possible?
Thank you in advance

Showing 16 results

Try SciChart Today

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

Start TrialCase Studies