please ignore the first comment below.. I added it to the bottom of the issue..
I am plotting an FFT with about 480,000. points. I am using a line series.
If I plot the magnitude of the fft it plots very quickly with no problems.
if instead, before I define the lineSeries I for loop through the data series and change each data point to dB using 20*Math.log10(y/refVal). The plot freezes the UI and never updates and never plots. same number of points just different Y values.
The only thing I can think of to explain this is perhaps the dB version of the data is more chaotic meaning it jumps around a lot more. where the linear data is much more predictable.
I'm not sure what the line generation algorithm is but I could imagine something like this bogging down some sort of interpolator or curve fitting. but It was my understanding that lineSeries did not do any of this.
any thoughts?! thank you
windows 8
new bottom of the line laptop
windows forms C# app.
The code I am using to plot is shown below....
```
var plotModel2 = new PlotModel();
plotModel2.Title = "LineSeries, 100k points";
var linearAxis3 = new LinearAxis();
linearAxis1.Position = AxisPosition.Bottom;
plotModel1.Axes.Add(linearAxis1);
var linearAxis4 = new LinearAxis();
plotModel1.Axes.Add(linearAxis2);
var lineSeries2 = new LineSeries();
// I have an array of complex values called cdata representing the complex fft points (y axis) with 480,000 elements.
int myloopcount =0;
while (myloopcount < datalength)
{
double tempe;
tempe = Math.Abs(cdata[myloopcount].Magnitude*TheWaves.conversionFactor);
tempe = (.707*(tempe*2/datalength));
// if I comment out the line below containing log10 it plots quickly.. with it uncommented it hangs the UI an never comes back. sometimes Visual studio pops something up about wating for a thread but Im not sure what that means.
tempe = Math.Abs(20*Math.Log10(tempe/1e-6));
double myYF = tempe;
lineSeries2.Points.Add(new DataPoint(myloopcount/T, myYF));
myloopcount++;
}// end while loop
plotModel2.Series.Add(lineSeries2);
this.plot2.Model = plotModel2;
```
Comments: yes, this was messed up code. Can you please clean up? Use the Preview tab before submitting :-) Note that you can use "```cs" to get syntax highlighting. If this is not a new feature or a bug I think it should not be an issue but discussed under Discussions! See the example on Decimator, this can help in this case where you have a monotonically increasing function. Plotting 480 000 chaotic points will always be difficult. The code should be written in a form that could be added to the ExampleLibrary -> OpenIssues.cs or DiscussionExamples.cs, I tried the following ```cs [Example("#10178: LineSeries behaving strangely")] public static PlotModel LineSeriesBehavingStrangely() { // TODO: what are these var conversionFactor = 1; var T = 1; int datalength = 480000; // Note: not using Complex since it is not available in PCL var cdata = new double[datalength]; // TODO: fill the cdata for (int i = 0; i < datalength; i++) { cdata[i] = Math.Sin(i); } var plotModel2 = new PlotModel { Title = "LineSeries, 100k points" }; var linearAxis1 = new LinearAxis { Position = AxisPosition.Bottom }; plotModel2.Axes.Add(linearAxis1); var linearAxis2 = new LinearAxis(); plotModel2.Axes.Add(linearAxis2); var lineSeries2 = new LineSeries(); // I have an array of complex values called cdata representing the complex fft points (y axis) with 480,000 elements. int myloopcount = 0; while (myloopcount < datalength) { double tempe; tempe = Math.Abs(cdata[myloopcount] * conversionFactor); tempe = .707 * (tempe * 2 / datalength); // if I comment out the line below containing log10 it plots quickly.. with it uncommented it hangs the UI an never comes back. sometimes Visual studio pops something up about wating for a thread but Im not sure what that means. tempe = Math.Abs(20 * Math.Log10(tempe / 1e-6)); double myYF = tempe; lineSeries2.Points.Add(new DataPoint(myloopcount / T, myYF)); myloopcount++; } plotModel2.Series.Add(lineSeries2); return plotModel2; } ```
I am plotting an FFT with about 480,000. points. I am using a line series.
If I plot the magnitude of the fft it plots very quickly with no problems.
if instead, before I define the lineSeries I for loop through the data series and change each data point to dB using 20*Math.log10(y/refVal). The plot freezes the UI and never updates and never plots. same number of points just different Y values.
The only thing I can think of to explain this is perhaps the dB version of the data is more chaotic meaning it jumps around a lot more. where the linear data is much more predictable.
I'm not sure what the line generation algorithm is but I could imagine something like this bogging down some sort of interpolator or curve fitting. but It was my understanding that lineSeries did not do any of this.
any thoughts?! thank you
windows 8
new bottom of the line laptop
windows forms C# app.
The code I am using to plot is shown below....
```
var plotModel2 = new PlotModel();
plotModel2.Title = "LineSeries, 100k points";
var linearAxis3 = new LinearAxis();
linearAxis1.Position = AxisPosition.Bottom;
plotModel1.Axes.Add(linearAxis1);
var linearAxis4 = new LinearAxis();
plotModel1.Axes.Add(linearAxis2);
var lineSeries2 = new LineSeries();
// I have an array of complex values called cdata representing the complex fft points (y axis) with 480,000 elements.
int myloopcount =0;
while (myloopcount < datalength)
{
double tempe;
tempe = Math.Abs(cdata[myloopcount].Magnitude*TheWaves.conversionFactor);
tempe = (.707*(tempe*2/datalength));
// if I comment out the line below containing log10 it plots quickly.. with it uncommented it hangs the UI an never comes back. sometimes Visual studio pops something up about wating for a thread but Im not sure what that means.
tempe = Math.Abs(20*Math.Log10(tempe/1e-6));
double myYF = tempe;
lineSeries2.Points.Add(new DataPoint(myloopcount/T, myYF));
myloopcount++;
}// end while loop
plotModel2.Series.Add(lineSeries2);
this.plot2.Model = plotModel2;
```
Comments: yes, this was messed up code. Can you please clean up? Use the Preview tab before submitting :-) Note that you can use "```cs" to get syntax highlighting. If this is not a new feature or a bug I think it should not be an issue but discussed under Discussions! See the example on Decimator, this can help in this case where you have a monotonically increasing function. Plotting 480 000 chaotic points will always be difficult. The code should be written in a form that could be added to the ExampleLibrary -> OpenIssues.cs or DiscussionExamples.cs, I tried the following ```cs [Example("#10178: LineSeries behaving strangely")] public static PlotModel LineSeriesBehavingStrangely() { // TODO: what are these var conversionFactor = 1; var T = 1; int datalength = 480000; // Note: not using Complex since it is not available in PCL var cdata = new double[datalength]; // TODO: fill the cdata for (int i = 0; i < datalength; i++) { cdata[i] = Math.Sin(i); } var plotModel2 = new PlotModel { Title = "LineSeries, 100k points" }; var linearAxis1 = new LinearAxis { Position = AxisPosition.Bottom }; plotModel2.Axes.Add(linearAxis1); var linearAxis2 = new LinearAxis(); plotModel2.Axes.Add(linearAxis2); var lineSeries2 = new LineSeries(); // I have an array of complex values called cdata representing the complex fft points (y axis) with 480,000 elements. int myloopcount = 0; while (myloopcount < datalength) { double tempe; tempe = Math.Abs(cdata[myloopcount] * conversionFactor); tempe = .707 * (tempe * 2 / datalength); // if I comment out the line below containing log10 it plots quickly.. with it uncommented it hangs the UI an never comes back. sometimes Visual studio pops something up about wating for a thread but Im not sure what that means. tempe = Math.Abs(20 * Math.Log10(tempe / 1e-6)); double myYF = tempe; lineSeries2.Points.Add(new DataPoint(myloopcount / T, myYF)); myloopcount++; } plotModel2.Series.Add(lineSeries2); return plotModel2; } ```