This is the discussion forum for OxyPlot.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!

Stackable LineSeries. Is it possible?

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

vindex wrote at 2013-07-14 18:15:

Hi,
I was wondering if it is possible to stack line series, to get something like this:


Image


I've been looking in the examples, but didn't find any similar...
Thank you

everytimer wrote at 2013-07-14 19:31:

If the LineSeries have the same X spacing you could create a new one and run a "foreach (DataPoint point in ...)" loop, adding the previous LineSeries to the current. If that is not enough and you want to have the same look as in your picture you should create AreaSeries, where the top line is the addition of the desired lines, and the low line is the lowest line.

If you have different X spacing you can't stack the lines point-per-point, you need first generate intermediate points in both lines, and then proceed with the addition.

Good luck

vindex wrote at 2013-07-14 20:11:

Thanks, your AreaSeries solution was exactly what I was looking for.

Image
public IEnumerable<AreaSeries> StackLineSeries(IList<LineSeries> series)
        {
            double[] total = new double[series[0].Points.Count];

            LineSeries lineSeries;
            AreaSeries areaSeries;

            for (int s = 0; s < series.Count; s++)
            {
                lineSeries = series[s];
                areaSeries = new AreaSeries();

                for (int p = 0; p<lineSeries.Points.Count; p++)
                {
                    double x = lineSeries.Points[p].X;
                    double y = lineSeries.Points[p].Y;

                    areaSeries.Points.Add(new DataPoint(x, total[p]));
                    total[p] += y;
                    areaSeries.Points2.Add(new DataPoint(x, total[p]));
                }

                yield return areaSeries;
            }
        }

csv export of line series

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

aec wrote at 2012-08-30 19:17:

Hi obj. You have written an export demo where it is possible to export a plot model to (for instance) csv format. Can you do this also for line series? Than you can use this export routine as well for the export of plot models.

I think that an export of a line series could be interesting for developers. Having such a routine, one is able to write an export function if some clicks on the curve or on the legend to export the raw data.


aec wrote at 2012-08-31 09:42:

Another application is to compare simulation results with measurement data. First you simulate something and plot this into a window. Afterwards you load the measurement data and plot them also to the window.

In such a situation it will be more convenient to have an import/export function for line series because the measurement data are often available in csv format.


objo wrote at 2012-09-05 21:03:

I think this should be the responsibility of the application! But I think it requires the selection feature (http://oxyplot.codeplex.com/workitem/8193) if you want to click and export one curve only.

I see it could also be convenient to have it built-into the plot controls, so I added it as issue http://oxyplot.codeplex.com/workitem/10002!


aec wrote at 2012-09-06 08:32:

Hi objo. Thanks for this support. Of course, I agree with you, that the application should be responsible for such a feature. On the other hand you intend to support a selection feature. I didn't know that before. 

But with this information I think that a built-in function is not necessary and yields less flexibility. Think about different possible csv formats ... Instead of a built-in function with minor flexibility an export example based on the selection feature would be sufficient. This could avoid further feature requests because everyone has than a template which can be modified for special purposes.

Fill area above and below baseline

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

alex4Zero wrote at 2014-03-07 07:12:

Hi,

Does anybody knows how to paint this kind of graphic with oxyplot?

Image

The idea is to fill areas above of some baseline with one color and another color below baseline?

objo wrote at 2014-03-07 15:24:

I think this is a new feature, but it would be nice to add a series type that draws this in the core library! It is somewhat similar to the TwoColorLineSeries class. Maybe we can create a new TwoColorAreaSeries? Or can you suggest a better name?

https://oxyplot.codeplex.com/workitem/10150

alex4Zero wrote at 2014-03-10 09:14:

objo wrote:
I think this is a new feature, but it would be nice to add a series type that draws this in the core library! It is somewhat similar to the TwoColorLineSeries class. Maybe we can create a new TwoColorAreaSeries? Or can you suggest a better name?

https://oxyplot.codeplex.com/workitem/10150
Currently we did it with 2 area series. One is above baseline, one is below. For me it looks like an AreaSeries with BaseLine. Probably BaselineAreaSeries?

skichuk wrote at 2014-03-10 09:30:

Currently we did it with 2 area series. One is above baseline, one is below. For me it looks like an AreaSeries with BaseLine. Probably BaselineAreaSeries?
Yes it is two AreaSeries and one is LineSeries, user of this type of graph should now only about LineSeries, and two Colors below and above Baseline and the coordinate of this base line if it is horizontal it will be vertical coordinate for example BaseLineY

Set position

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

Ivan_kol wrote at 2013-07-13 15:27:

As you can set positioning in the charts?
For example I have the X-axis date-time, I want to point out is the date on H-time, how do? And put on this place a vertical line.

With the positioning of the options is not even found a line and tried to put an annotation, not too successfully.

Tracker Event?

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

SlickRick wrote at 2013-06-19 22:49:

Hi, thanks for this very nice library.

I was wondering if it was possible to listen to changes of the nearest item of the tracker?

I was able to get this information by using the series mouse Down and plot mouse move events in combination and retreiving the nearest point of the tracked serie.

Although i was guessing that there might be an easiest way of doing this?

Basically i want to know the current datapoint that is currently displayed by the tracker so that i can syncronize another window with the currently selected information and keep it in sync when the user moves along the lineseries (as long as the tracker is shown)

(sorry if this is a duplicated thread but i have tried to search for similar one but couldn't find any discussion similar to what i want)

Thanks.

Vertically dropping X-Axis

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

maha17 wrote at 2013-03-14 16:21:

Is it possible to have a vertically dropping X-Axis ?

The reason for having a dropping x-axis is that I am plotting values measured at certain depths (from zero and descending)

Methods are missing on OxyPlot.Wpf when using NuGet

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

thomasachim wrote at 2014-06-11 19:46:

Hi everbody,
I just started working with OxyPlot on my WPF project. So the first thing that I noticed is that when I import OxyPlot.Core and OxyPlot.Wpf using NuGet there are some methods missing, e.g. the method RefreshPlot(bool), but there are even more missing. I found another OxyPlot DLL on GitHub where these methods are included. Of course I can use this DLL but I just want to ask if I am doing anything wrong importing this references? Or why are some methods missing when I import the OxyPlot references?

Thanks to everybody in advance!!!

MonoMac version

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

faufab08 wrote at 2013-04-22 19:27:

There is someone that who started the porting on MonoMac or Xamarin Mac platform?

objo wrote at 2013-04-24 11:02:

There is a MonoTouch project in the OxyPlot.MonoTouch solution!

faufab08 wrote at 2013-04-29 08:48:

Yes objo , and it works. But I ask if someone have done a port on MonoMac that it is little different that MonoTouch

objo wrote at 2013-04-29 11:13:

ok, I see - I wasn't aware of the MonoMac project! It would be great to see it running on MonoMac! I don't have Apple hardware myself, so cannot help there.

faufab08 wrote at 2013-04-29 11:37:

I have little time, however I would like to port my app on MacOX. So I will try to port the examples of OxyPlot in MonoMac.

objo wrote at 2013-04-29 12:40:

Great! I would really like to see more of this project ported to the Mono/Xamarin platform. It would also be great to make the library available in Xamarin Components for the various phone and desktop platforms!

Axis with fixed values on a stream

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

user78483 wrote at 2013-10-17 09:18:

Hi,

is it possible to always show the latest defined range (via minimum and maximum) on a running stream?

I do have a continous stream adding values 1,2,3,4,5sec and so on. My x-axis should only show the last second. The labels should show 0 to 1 for example.

I can do this, always cutting the last second and changing x-values from 0 to 1, but this is not satisfactory.

Any idea how to do that? A plus would be if I can also zoom.

Thanks in advance

everytimer wrote at 2013-10-17 12:13:

Use the AxisChanged event. Capture the ActualMaximum of your axis and then assign the Minimum in accordance. Good luck

user78483 wrote at 2013-10-17 14:27:

Thanks everytimer for your quick response. But how to use the AxisChanged event? This does only fire if I zoom or pan not if the values increase.

I simply added the event like so:
var timeAxis = new LinearAxis(AxisPosition.Bottom, 0) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "Time", Unit="s" };
PlotModel.Axes.Add(timeAxis);
timeAxis.AxisChanged +=timeAxis_AxisChanged;
So there is no min/max defined and the axis increases its values as needed.

I would like to get a (oscilloscope like) behaviour like this. That the X axis is fixed to a small window of 5 seconds of the newest data, here is an example:
Image
0

Oxyplot plot not displaying in Prism module loaded by Unity

Zachary Gorden vor 9 Jahren 0
I have a line series plot in a WPF user control in a dll project that gets loaded by the main WPF application via unity. It's a pretty straightforward MVVM setup using Prism. The problem is when the program is run the oxyplot plot doesn't show up. I've tested to make sure the user control itself is loading, I replaced the plot with a built in textblock and that appeared. When viewing the user control in the designer the plot also shows up. It's only when the application is actually running that the plot does not appear. No exceptions are thrown and I don't see any errors so I don't know why the plot isn't being displayed.