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!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

Is there a way to plot a data source that just consists of just Y values?

Background:
I have to plot a series of values coming from a data acquisition card (Analog to Digital) with 12 bits or so of resolution [call it 2 bytes] at a fixed 10Khz sample rate. I need to plot a couple of minutes worth of samples (1,200,000 samples). I will be converting it to “floats” before plotting. It does not have to be in real time.
We’re talking a lot of data: 10,000 samples a second X 120 seconds X 8 channels X bytes-per-sample.
I’d like to avoid creating XY points in my source (and doubling the memory use) when the X values don’t actually matter.

Thoughts?

Thanks!

  • You must to post comments
0
0

here’s how I handle something like that (note, I use MVVM-ish code, and I’m using a list of doubles instead of an array)

 public class LineChart
{
    public IXyDataSeries<double, double> DataSeries { get; set; }

    public LineChart(string seriesName)
    {
        DataSeries = new XyDataSeries<double, double>()
        {
            SeriesName = seriesName
        };

    }

    public void UpdateChart(List<double> dataPoints)
    {
        DataSeries.Clear();
        for (int i = 0; i < dataPoints.Count; i++)
        {
            DataSeries.Append(i, dataPoints[i]);
        }

    }

}

and in the View/ViewModel that does the charting:

    public class MainWindowViewModel : ViewModelBase
{

    private readonly SensorDataModel mySensorDataModel;
public myLineChart LineChart { get; }

    public MainWindowViewModel()
    {

        myLineChart = new LineChart();
        mySensorDataModel = new SensorDataModel ();


    }

    private void UpdateCharts(object sender, EventArgs e)
    {

        if (mySensorDataModel.DataPoints.Count >= 10)
        {
            myLineChart.UpdateChart(mySensorDataModel.DataPoints);
            //Tell the view there is new data
            NotifyPropertyChanged("myDataSeries");
        }
    }

}

  • You must to post comments
0
0

That’s not really answering my question but I’m such a noob at this that it is still very helpful. Thanks. 🙂

  • Branden Gunn
    not sure how it doesn’t answer your question. Please hit the “add comment” link under my answer to explain more.
  • You must to post comments
0
0

(I couldn’t figure out how to get good formatting using “add comment” so I used the normal method.)

I reread my question and your answer again and now I see how my question was confusing. Sorry.

Instead of:

public IXyDataSeries<double, double> DataSeries { get; set; }

I’d was hoping there was something like this:

public IJustYDataSeries<float> DataSeries { get; set; }

Perhaps I am worried about memory for nothing though. Premature optimization and all that…

  • Andrew
    Hi Chris, SciChart DataSeries always store the X-value, it’s not possible to have just Y values in the Data-Series I’m afraid.
  • Christopher Bennet
    That would explain why I couldn’t find it! Thank you so much for you help.
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.