Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all 2061 articles
Browse latest View live

Closed Unassigned: PathAnnotation.Render doesn't always render text [10177]

$
0
0
The easiest way to see this bug is to look at the 'LineAnnotation on linear axes' example (the very first one) and resize the window. Watch the 'Vertical' text and you should see that it flickers on and off as you reseize the window.

After looking at the source I think the bug is in `PathAnnotation.Render` when it calls `rc.DrawClippedLine(..., null, pts => clippedPoints = pts)`. The `pointsRendered` callback can be called multiple times with the same list. Since it's using that list directly, the final value of `clippedPoints` simply reflects the value of the `outputBuffer` from `RenderingExtensions.DrawClippedLine` which is periodically cleared and rebuilt during the `DrawClippedLine` call.

My best guess for the fix is to pass a real list (not null) for the `outputBuffer` parameter and use that instead of the `pointsRendered` callback in `PathAnnotation.Render`.

Commented Unassigned: plotting lineSeries behaving strangely.. [10178]

$
0
0
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; } ```

Closed Unassigned: Poor live data performance [10134]

$
0
0
Based on [this article](https://oxyplot.codeplex.com/discussions/281036) I'm using PlotModel.RefreshPlot(true) frequently to load live data, approximately 20 times per second or so, but the performance is not good. It is sluggish and lags behind.

I have 8 line series with 1000 samples/sec each, but reducing the data frequency does not seem to help much, so this does not seem directly related to drawing performance.

There are a few issues:
* RefreshPlot(true) seems to queue on the GUI thread, probably with BeginInvoke, so that if it runs sluggishly it will also start lagging behind with several seconds in a short time.
* RefreshPlot generally feels very slow for a live data scenario
* The GUI thread is locked for big chunks of the time, so even moving the parent window is very sluggish

I am on a powerful PC with pretty recent CPU and GPU, so that should not be the problem. Running Windows 8, but same is seen on Win7.

I have not yet dug into the source code of Oxyplot, but are there any tips on how to improve live data rendering?

Closed Unassigned: incorrect and missing points rendered from LineSeries [10170]

$
0
0
In RederingExtensions the:
* First point is always added regardless of whether it's inside the clipping region or not
* First point of every clipped line segment is skipped

In addition, there are a couple of performance issues:
* Boxing is occurring on every ScreenPoint
* New lists are constantly being created instead of just clearing the old list

I think I fixed the issues (see attached). I also added another performance improvement of injecting the intermediate output buffer for ScreenPoints. This prevents the buffer from constantly copying itself and stressing 3rd generation garbage collection. This may be able to be omitted in lieu of presizing the buffer. However, I chose the less clean interface to reduce the risk of garbage collection killing our app. This is just for our stuff, since we're rendering millions of points using MVVM. The garbage collector was actually killing our application performance due to Oxyplot (we run an instrument and it was shutting our data collection down). _BTW, do I need to copy your copyright into the attached file, or is it OK to just simply include the license file in our distribution & installer?_

I actually have permission to give you the full source that allows us to render millions of points using MVVM if you desire. You could incorporate everything but data appendage into your project without messing things up too much. There are a few things that you could do cleaner by having it in your source. I have some code for data appendage also, which doesn't require any series to be redrawn, but has some extra state to manage. Just let me know if you would like any of this.

New Post: Handling massive series

$
0
0
I have started pulling in your changes. Wow! You have done a great job! This made a huge improvement on performance.
I still need some time to review the last changes, I am hesitant to adding the observable pattern to the whole model...

Source code checked in, #919f1947ed0a

$
0
0
#10177: fix PathAnnotation.Render not always rendering text (by kenny_evoleap)

New Post: TrackerFormatString question

$
0
0
Thanks for the post.

An additional tip here. The default setting is like below,
var lineSeries = new LineSeries
{
    TrackerFormatString = "{0} " + Environment.NewLine + "{1}: {2} " + Environment.NewLine + "{3}: {4} ",
}
You can modify it based on that. Also note that the {0} would be used in Legend Title.

New Post: How to increase DPI in PngExporter call to get higher quality image?

$
0
0
Hi,

I am using PngExporter to export PlotModel to am image. By default dpi is 96 but that leaves some "jaggies" in the image so I want to increase dpi for better quality image. But when I increase dpi and try to use PngExporter the image that get's created is a zoomed in image. I don't want this, I want the height and width of the image to be same as that of the original height and width of the PlotModel. Any ideas how I can do that?

Commented Unassigned: plotting lineSeries behaving strangely.. [10178]

$
0
0
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: Sorry about the messed up code. I figured out a solution. if I keep the points below 40,000 it will plot instantly and zoom without lag. so I just added a routine to filter out some of the points and still retain valid data. (well at least it will look valid to target user) the code is incomplete but if you read through it you can see what I did and apply it to you code if you see a similar issue. ``` double mybin = 0; double binsize = 1; if (datalength > 40000) { binsize = Math.Round((double)datalength/20000); } int myloopcount = 0; while (myloopcount < datalength) { double currentDataPoint = SampEnum.Current; // get the largest data point in this bin for plotting int mysign = Math.Sign(currentDataPoint); mybin = (double)mysign*Math.Max(mybin, Math.Abs(CurrentDatapoint)); // bin the fft for fewer points; if (myloopcount % binsize == 0) { myYF= Math.Abs(20*Math.Log10((mybin)/1e-6)); lineSeries2.Points.Add(new DataPoint((myloopcount-(binsize/2))*T, myYF)); mybin = 0; } myloopcount++; } plotModel1.Series.Add(lineSeries1); this.plot1.Model = plotModel1; ```

Commented Issue: GetNearestPoint return DataPoint even when custom IDataPoint used [10115]

$
0
0
I noticed that Series.Points is a collection of IDataPoint.

"Great!" I thought. So I created a custom type (where I could hold some extra info) and drew my graph and it worked.

The problem is when I use Series.GetNearestPoint it seems to be returning me DataPoint underneath the IDataPoint when I'm expecting it to return my custom type.

Any clues?
Comments: `IDataPoint` was removed from OxyPlot for performance reasons. So this issue is not relevant any more?

Commented Unassigned: Exception in PathAnnotation.HitTest [10140]

$
0
0
In a mousedown handler on the plotmodel, I'm deleting a polyline object from the plotmodel and creating another one instead.
When clicking repeatedly, I can get the situation that Oxyplot tries to do a hittest while screenPoints == null. I'm not sure it this has to do with the fact that I'm deleting the objects from the plotmodel.
I can fix this by testing for null in HitTest. See code below after the TODO comment:

PathAnnotation.cs:

protected internal override HitTestResult HitTest(ScreenPoint point, double tolerance)
{
// TODO: TEST FOR NULL
if (this.screenPoints == null)
{
return null;
}

var nearestPoint = ScreenPointHelper.FindNearestPointOnPolyline(point, this.screenPoints);
double dist = (point - nearestPoint).Length;
if (dist < tolerance)
{
return new HitTestResult(nearestPoint);
}

return null;
}

Kind regards,
Wim Bokkers
Comments: Should be closed, i think.

Commented Issue: Performance of Bar/ColumnSeries [9974]

$
0
0
check performance - see http://oxyplot.codeplex.com/discussions/371296
Comments: seems much faster in the latest versions. I think this can be closed.

Commented Issue: rendering artifacts at full screen [10001]

$
0
0
Strange moire pattern when we maximize view of our application or size application window above 1300px wide.

AxisDemo application also shows artifacts when maximised for some graphs?

Attached are three screen shots.


Comments: Have you tried software rendering (see http://blogs.msdn.com/b/jgoldb/archive/2010/06/22/software-rendering-usage-in-wpf.aspx)? ``` C# RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; ``` It the artifacts are gone, then it is a graphics driver / wpf problem.

Commented Issue: Fast dynamic data. System.InvalidOperationException [10104]

$
0
0
im use fast dynamic data. sometimes it thrown exception (An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll) - collection changed; cant iterate this. i solved the problem changing "foreach" to "for" in OxyPlot.Series.ScatterSeries and in OxyPlot.Series.DataPointSeries.cs
Comments: Can be closed.

Commented Unassigned: Memory Leak in LineSeries [10151]

$
0
0
As described in this discussion:
https://oxyplot.codeplex.com/discussions/532576#post1215810

When LineSeries is bound to rapidly changing data, it can be observed that stale data which is no longer displayed is not being properly garbage collected. This leak is independent of the storage class that is used in the view model layer; the one test case that avoided the memory leak was by binding the line series to an observable collection, and clearing the observable collection prior to each update, however this process is expected to be extremely inefficient.

The attached project is equivalent to the usage within my application, and exhibits the leak. Eventually, the application should throw an OutOfMemoryException (typically within a few hours), although the leak can be observed rather quickly from a memory profiler.
Comments: I think there are some issues in your code: - You use multi-threading without locking `plotmodel.SyncRoot` - you use `CompositionTarget.Rendering` for invalidation (might lead to bad performance) As it is very hard for me to read VB code, I'm not sure if I understand everything what you are doing. But for sure you use OxyPlot in a bad way concerning multi-threading. Please check the WPF RealtimeDemo for how to use OxyPlot multiple threads and invalidation without CompositionTarget.Rendering to get reasonable performance.

Commented Unassigned: Remove mouse events from plot elements [10132]

$
0
0
We can achieve the same functionality by using a `PlotController`
https://oxyplot.codeplex.com/workitem/9625

* Better separation of controller logic and model
* Less code
* Better performance of PlotController
Comments: Hmm, still don't like it. The PlotModel and its child elements should not know anything about a mouse, keyboard or touch. Also it is easy to create memory leaks by events on child elements of the PlotModel when your plot is more dynamic (e.g. adding and removing annotations). Therefore I would prefer following: - mouse/keyboard events exist only on `PlotController` and the event will tell you what element of the plot was e.g. clicked - similar the `AxisChanged` should be on `PlotModel` and tell you what axis changed - Ultimately no child element of the plotmodel should expose any events With this approach I don't have problems with adding/removing elements from the plotmodel and my event handlers.

Commented Unassigned: Exception in PathAnnotation.HitTest [10140]

$
0
0
In a mousedown handler on the plotmodel, I'm deleting a polyline object from the plotmodel and creating another one instead.
When clicking repeatedly, I can get the situation that Oxyplot tries to do a hittest while screenPoints == null. I'm not sure it this has to do with the fact that I'm deleting the objects from the plotmodel.
I can fix this by testing for null in HitTest. See code below after the TODO comment:

PathAnnotation.cs:

protected internal override HitTestResult HitTest(ScreenPoint point, double tolerance)
{
// TODO: TEST FOR NULL
if (this.screenPoints == null)
{
return null;
}

var nearestPoint = ScreenPointHelper.FindNearestPointOnPolyline(point, this.screenPoints);
double dist = (point - nearestPoint).Length;
if (dist < tolerance)
{
return new HitTestResult(nearestPoint);
}

return null;
}

Kind regards,
Wim Bokkers
Comments: I tried the fix for a while and I die not run info this issue anymore. So it can be closed. Thank you for the fix.

New Post: Transparent plot.

$
0
0
I have a wpf window that has a Gradient background.

I am trying to make a plot that shows the background gradient through the plot.

I have tried setting both the PlotModel's Background and PlotAreaBackground to transparent, but it just doesn't work. The plot always has a White Background.

Is it not possible to have transparent background on an OxyPlot?

New Post: Transparent plot.

$
0
0
Try to set it in XAML on Plot element:
Background="Transparent"

New Post: Transparent plot.

$
0
0
Exactly what i needed to do.... Thanks a lot.
Viewing all 2061 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>