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

0 votes
1k 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

0 votes
2k 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!

1 vote
2k 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
2k 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….

1 vote
2k 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
3k 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 .

0 votes
3k 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
2k 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 3 years ago
  • last active 3 years ago
1 vote
4k 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 4 years ago
  • last active 4 years ago
1 vote
5k 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

0 votes
6k 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 5 years ago
  • last active 5 years ago
Showing 11 results
This template supports the sidebar's widgets. Add one or use Full Width layout.