Page 1 of 1

Reversed x axis with sampledataseries

Posted: Thu Sep 04, 2014 3:52 pm
by greggorob64
I'm having a very hard time getting my data to show up.

I have my x axis set to go from 3700->900 (reversed!) and I have a single SampleDataSeries.

My calculation for sampling frequency is
series.SamplingFrequency = Math.Abs(1 / (this.XAxisDelta)); // Delta is -28
series.XAxisOffset = 900;// hardcoded for right now

my data array has samples[0] equating to 3700, and samples[99] 928 as stored in the array.

My issue is that when I map the trace to the graph, my data is reversed. Its assuming that samples[0] corresponds to the lowest X axis value i believe.

Is there a way for me to reverse the trace on disk without manually switching my data array around? It seems like the answer I need is to allow

XAxisOffset = 3700;
SamplingFrequency = -1/XaxisDelta, but the negative frequency breaks the graph


hopefully this makes sense and isn't just rambling.

Re: Reversed x axis with sampledataseries

Posted: Fri Sep 05, 2014 5:49 am
by ArctionPasi
Axes have Reversed property.

Isn't ViewXY.XAxes[0].Reversed = True suitable?

samples[0] represents the sample of lowest X value.

Re: Reversed x axis with sampledataseries

Posted: Fri Sep 05, 2014 3:49 pm
by greggorob64
I was able to get the axis to show as reversed (my values go from RPM's 3700->900)

However, my sample data is also ordered with data[0] is the data at X=3700, and data[100] is X=900.

When i load the sample buffer in, the values are reversed because f the fact that the sample buffer always goes low x to high x.


Is there room anywhere for an enhancement where in the sample data, when you have offset and frequency, we can give it a negative frequency to show that it is decreasing with the X axis?

Re: Reversed x axis with sampledataseries

Posted: Fri Sep 05, 2014 8:40 pm
by ArctionPasi
We can't promise enhancement like that, sorry.

Can't you use FreeformPointLineSeries, it accepts data in any order?

Re: Reversed x axis with sampledataseries

Posted: Mon Sep 08, 2014 6:31 pm
by greggorob64
Maybe using a difference series type is a better solution. We've been using SampleDataSeries up until now (which i believe has the best performance). The case where the X axis is reversed, maybe I can use a different series?

Its not a big deal right now to manually reverse the buffer However, in the future, people may want to flip-flop the axis around at will, it might need to change.

Is there a use case for negative sampling frequency on the SampleDataSeries.Frequency property? The way my math works out, the negative value is useful to me. I'm having to do Math.Abs when I set this property, but keep the negative value everywhere else.

Re: Reversed x axis with sampledataseries

Posted: Mon Sep 08, 2014 7:02 pm
by ArctionPasi
The real-time scrolling modes are built only for ascending data order. It's a major restructuring to implement negative sampling frequency for SampleDataSeries. Or to enable descending data order for PointLineSeries/AreaSeries/HighlowSeries. This is something we really can't promise. :|

Nothing prevents from changing from SampleDataSeries to FreeformPointLineSeries on the fly.

SampleDataSeries has better performance when data point count is high.

Re: Reversed x axis with sampledataseries

Posted: Wed Sep 10, 2014 2:55 pm
by greggorob64
I think using the different series type is definitely solution then. Right now, I'm reversing the array when the X range is descending (its much easier than modifying my code to work with the different series type).

I'll make the switch eventually.

Thanks for the info