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

why not merge scatterseries and RectangleBarSeries to an more universe class to plot (x,y,z) type data

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

ProCodeMyth wrote at 2012-08-18 02:00:

hi objo

     both ScatterSeries and rectangleBarSeries  is an special case of draw (x,y,z) in 2D drawing ,

in  position(x,y) draw marktype with color fill; so why not develop an new class which reprense (x,y,z) type data replace ScatterSeries and rectanglebarSeries. if use new class ,coloraxis can play more important role,i think. we can cope with colormap in z-dir in universe  way, which is very usefull in draw contour with color fill . in recent oxyplot version, rectanglebarseries don't consider rect fillcolor change in diffente position, such as draw colorBand wich color from low to high .


objo wrote at 2012-08-21 13:36:

ScatterSeries plots points and RectangleBarSeries plots rectangles. The rendering method is quite different, so I don't think it is a good idea to merge these classes.

I see the RectangleBarSeries could be extended with more functionality from the ScatterSeries, but this could also be solved by making a custom series class. Can you check if this can solve your issues?

Report generator sample code

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

AleV wrote at 2012-07-19 15:26:

Where can I find how to use the "simple report generator" included?


AleV wrote at 2012-07-19 15:35:

Never mind, I didn't notice before the "ExportDemo" example.

Thanks,

AleV


objo wrote at 2012-08-08 23:54:

Will add more documentation later, it's on the 'roadmap' this year. The 'simple' report generator is still at an early stage - but I think it is useful to have such a report generator in the library, it makes it easy to combine the plots (particularly in vector formats) with other report elements.


AleV wrote at 2012-08-13 16:49:

Thanks objo, I think it is very useful too. As far as the documentation is concerned, it would be nice to have a well-structured document. In the meantime, I’m using the examples you provided in the source code: they are a very valuable for me.

Saving image of a plot in Silverlight

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

Tech_Junkie wrote at 2012-08-03 10:50:

I'm trying to save my plot (lineseries with axes) to something that I can use elsewhere in my application without having to load an oxyplot element. For this I would like to export the plot to an image (preferable just a standard silverlight implementation for internal use).

What would be the best way to go about this?

 

Would it be possible to get a xaml path from the plot? as this is one of the easiest ways to store vector data in silverlight.


dcuccia wrote at 2012-08-03 21:24:

Not sure if there's a new way to do this, but in our OSS project (MIT/X-11 license) we want to persist images of controls, with the additional option of printing.

Here's how we do that bit:

In Silverlight, WritableBitmap has a constructor overload that takes any UIElement, so you can...
1) create a WriteableBitmap using the UIElement overload
2) encode the bitmap to a .jpg (optional)
3) save the image
    a) if you want a user-specified location to save, you have to use an OpenFileDialog
    b) otherwise, you can save to isolated storage


Tech_Junkie wrote at 2012-08-06 16:33:

This looks good! Thank you! I think this will be very sufficient for my needs.


dcuccia wrote at 2012-08-06 19:46:

Good to hear - my pleasure. :)


objo wrote at 2012-08-09 00:19:

Isn't this the same as issue http://oxyplot.codeplex.com/workitem/9626?

I will look at your solution later, thanks for sharing!

Way to change text on linear Axis?

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

evolvedmicrobe wrote at 2013-07-09 21:17:

Hi,

I have a plot where the layout goes 1,2,3,4...etc, but I would love to change the text on the axis to arbitrary values at particular tickmarks, e.g. "A"/"D" at positions 2 and 4. I looked at the Category axis but it seemed difficult to put marks that were not aligned with categories.

Is there a way to add custom annotations/text at the tick marks for the LinearAxis? Or other recommendations that might be useful in this situation?

Thanks for any help,
Nigel

everytimer wrote at 2013-07-12 21:21:

I don't see an easy solution for that. If you really need that behavior consider changing the source code and exposing the ticks list. I think you could access it that way. Good luck

evolvedmicrobe wrote at 2013-07-12 21:22:

Nuts, thought that was the case but wanted to bounce it off someone more knowledgeable first, thanks for the response! Will start digging in to the ticks list.

Draggable Line Annotation Question

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

seveland12 wrote at 2012-05-03 15:02:

I like the draggable annotations that I saw in the newest demo, so I decided to incorporate it into my WPF app. However, the demo code uses OxyPlot.LinearAnnotation, while my WPF code needs OxyPlot.Wpf.LinearAnnotation - is there a way to get the draggable behavior using the WPF class? I tried the following, which compiled, but didn't work...

(the variable redLineAnnotation is of type OxyPlot.Wpf.LinearAnnotation that I declare in my XAML view)

 

            redLineAnnotation.internalAnnotation.MouseDown += (s, e) =>
            {
                if (e.ChangedButton != OxyMouseButton.Left)
                {
                    return;
                }

                redLineAnnotation.StrokeThickness *= 5;
                mainPlot.RefreshPlot(false);
                e.Handled = true;
            };

            // Handle mouse movements (note: this is only called when the mousedown event was handled)
            redLineAnnotation.internalAnnotation.MouseMove += (s, e) =>
            {
                redLineAnnotation.X = redLineAnnotation.internalAnnotation.InverseTransform(e.Position).X;
                mainPlot.RefreshPlot(false);
                e.Handled = true;
            };
            redLineAnnotation.internalAnnotation.MouseUp += (s, e) =>
            {
                redLineAnnotation.StrokeThickness /= 5;
                mainPlot.RefreshPlot(false);
                e.Handled = true;
            };

 


objo wrote at 2012-05-03 15:57:

Your code looks ok, need to debug this to see what is wrong.

The WPF elements are a bit behind the platform-indepent elements, but I plan to add the missing properties and classes soon. I hope also the events can be available from WPF, but they should not be confused with the WPF mouse events...

If you are creating your plot in code, did you consider creating a PlotModel instead of declaring everything in XAML?


seveland12 wrote at 2012-05-04 14:44:

Thanks for the feedback; I'm really looking forward to being able to draw out the full feature set of OxyPlot in WPF. I am so glad I found your project - WPF Toolkit's charting library was so unwieldy and borderline ill-conceived (you practically have to plan a mission to the moon to implement any new features using it!) - OxyPlot has really been a breath of fresh air. Thanks again!

Any end-to-end examples

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

cwford wrote at 2012-04-25 17:42:

This seems like a great Silverlight charting solution. Are there any examples that show all the code for a given solution?

All I can seem to find is Ctrl-Alt-C click on the example applications. While that brings up the static code-behind-file it does not show the XAML marke-up. Perhaps I am missing something but I would like to see the complete code. Is that possible?

 

Thank you,


objo wrote at 2012-04-25 21:26:

see Source\Examples\Silverlight\ExampleBrowser\MainPage.xaml

The XAML is simply

<oxy:Plot Model="{Binding SelectedExample.PlotModel}" />

and create your plot model in the ViewModel. This will make your plot independent of platform, it can be viewed in winforms, silverlight, wpf, monotouch, metro (coming at some point) or html (svg).

Markers intersection

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

pocketbboy wrote at 2012-01-10 15:17:

Hello.

There is a chance to determine where markers are intersecting and change the color of the markers or highlight that area?


objo wrote at 2012-01-10 17:29:

sorry, I don't understand, can you explain more? The markers in the LineSeries are points and are not intersecting.


pocketbboy wrote at 2012-01-10 19:06:

First example from lineseries.. When zoom out close enough, markers are getting closer and then are covering one each other until it's becomes like a single marker..I need to get a notify or to highlight the area where in the plot the data is to crowded or two or more markers are tangent..


objo wrote at 2012-01-27 08:02:

Another approach could be to use a ScatterSeries for the markers. See the ScatterSeries.BinSize if you want to render less markers when zoomed far out.

The PlotModel.Updated event can be used if you need a notification after the zoom level has been changed. 

0
Wird überprüft

LineAnnotation - Set Default Style

José Carvalho vor 9 Jahren aktualisiert von Oystein Bjorke vor 9 Jahren 2

I tried to set a default style for "LineAnnotation" class, so that all plot in my solution would have the same "Color" and "LineStyle", but when i start the application it gives me an error. I Have for other classes and it works perfectly, like for instance "PointAnnotation".


Library Include:

xmlns:oxy="http://oxyplot.org/wpf"


Code Sample:

<Style TargetType="oxy:LineAnnotation">

<Setter Property="LineStyle" Value="Dash"/>

<Setter Property="Color" Value="Red"/>

</Style>


Error:

'Set property 'System.Windows.Setter.Property' threw an exception.'


Thanks in advance

Draw annotation with 3600*10 datapoints

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

sharethl wrote at 2013-05-22 20:08:

I learnt that this library's performance is good, but when I try to use it draw an annotation, it reacts slowly when data points exceed about 600. For a 10 hour * 3600 dp/hour plot, it is impossible to draw an annotation smoothly.
What I did is :
  1. mouse down creates an arrow annotation,
  2. mouse move updates end point of arrow, and invalidateplot(false).
  3. mouse up releases arrow.
    All this is in PlotModel class, not wpf plot.
Is there any way to improve performance? And may be this library is not suitable for plot drawing?
Each plot contains 600 datapoints.
Image
Thanks.

sharethl wrote at 2013-05-29 20:08:

Modified Performance Example in sample examples, found it is hard to handle random data.
Instead of drawing sin cos data, I tested with Random data.

In Example_Browser->PerformanceExamples.cs
Plot freeze.

I believe it is WPF's limit.
private static void AddPoints(IList<IDataPoint> points, int n)
        {
            //for (int i = 0; i < n; i++)
            //{
            //    double x = Math.PI * 10 * i / (n - 1);
            //    points.Add(new DataPoint(x * Math.Cos(x), x * Math.Sin(x)));
            //}

            int dataCounts=n;
            var rnd = new Random();
            for (int i = 0; i < dataCounts; i++) {
                var dp = new DataPoint(i, rnd.Next(0, 65000));
                points.Add(dp);
            }

        }

objo wrote at 2013-06-08 11:26:

This is a worst-case graph you are showing, it not easy to optimize drawing of that green LineSeries :-)
Ideally only the annotation should be updated.
This is also discussed in https://oxyplot.codeplex.com/discussions/444229

Modifying annotations is easier than modifying series, because no other objects of the visible model will be affected. It could be a solution to add an Invalidate method on the Annotation class. I added https://oxyplot.codeplex.com/workitem/10052

Possible Memory leak

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

Scribbles wrote at 2014-02-18 21:36:

I am working on a project which is using oxyplot to create an oscilloscope display. The display works fine and the performance is great, however when we bind our data collection to an OxyPlot LineSeries, the data objects are never deallocated, and after a few hours the application crashes. I used .Net Memory Profiler to confirm this.

The original implementation is using a ConcurrentQueue to provide the ItemsSource, and after adding new data and removing stale data, raised a NotifyPropertyChanged("DataQueue"). I also tried using an array as the ItemsSource and doing a DataQueue.ToArray and NotifyPropertyChanged("DataArray"). In both cases, the DataPoints are never garbage collected .
If, however, I use an ObservableCollection, and clear the data before I replace the collection, then the DataPoints are cleared properly.
The leak also disappears if I remove the binding in the LineSeries ItemsSource.

Am I simply using oxyplot in a way that is not intended (by using NotifyPropertyChanged to redraw a series, rather than using an observable collection)?

The following is a screenshot of the memory profiler references list of expired data, it appears as though the enumerators are not being discarded properly, or that there are event handlers keeping handlers from old data.

Image

objo wrote at 2014-02-27 20:42:

Yes, it looks like something is wrong here. I don't know if this is a problem within the OxyPlot implementation. Ideally, it should not be possible to get into this situation by 'wrong usage'...
Is it possible to create a small example that can reproduce the error and add it to the issues list?

zyhong wrote at 2014-03-06 20:57:

I saw the memory leak happened at example browser as well. in windows, if you keep clicking on different examples, the memory will keep growing.

Scribbles wrote at 2014-03-07 16:13:

I have created an Issue for this at: https://oxyplot.codeplex.com/workitem/10151