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

Zoom/Pan state

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

vindex wrote at 2011-11-01 14:44:

Hi,

Is it possible to get/set where is centered the view in a plot, after several zooms and pans?


objo wrote at 2011-11-01 20:18:

I think it should be possible to use (ActualMinimum+ActualMaximum)/2 on each axis to find the center. These two values will contain the current minimum and maximum values of the axes after the plot has been updated or redrawn.

WPF: How to Plot Controls to Show Up in Toolbox?

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

alanrorr1 wrote at 2013-10-02 18:54:

Hi Everyone,
I am amazed. This plot looks to be very well done. I am looking forward to using it. It is compiling and running well (just needed to update Nuget package and to be sure I ran update 3 of VS 2012 Express).

I hope this last hurdle is pretty small. Wondering, how do I get the controls to show up in the toolbox? I tried finding a dll or ?? where they were located by right clicking on "All WPF Controls" and selecting "Choose Items..." but could not find anything. Note that I installed OxyPlot.WPF using Nuget through VS.

Thanks,

Alan

Mono 2.10.x version, Not MonoTouch or Mono for Android

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

efontana2 wrote at 2013-04-29 16:04:

I tried to use OxyPlot with Mono on Linux (2.10.8) and when I run it it complains about:

Mono: Could not load file or assembly 'System.core, Version 2.0.5.0 ...'

Has anyone tried this?

objo wrote at 2013-04-29 18:15:

Try referencing the NET40 version of the OxyPlot core library, maybe using the PCL version is the problem?
Shouldn't PCL assemblies also work with Mono? (I have not tried myself)
http://slodge.blogspot.no/2012/12/cross-platform-winrt-monodroid.html

efontana2 wrote at 2013-04-29 18:56:

Tried that, made no difference, same error:

Mono: The following assembly referenced from /home/cds/eric/op/testoxy/bin/Debug/OxyPlot.dll could not be loaded:
 Assembly:   System.Core    (assemblyref_index=2)
 Version:    2.0.5.0
 Public Key: 7cec85d7bea7798e
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/home/cds/eric/op/testoxy/bin/Debug/).

Mono: Failed to load assembly OxyPlot[0xb5728fb8]

Mono: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies.

Unhandled Exception: System.TypeLoadException: A type load exception has occurred.
at (wrapper remoting-invoke-with-check) testoxy.Form1:.ctor ()
at testoxy.Program.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: A type load exception has occurred.
at (wrapper remoting-invoke-with-check) testoxy.Form1:.ctor ()
at testoxy.Program.Main () [0x00000] in <filename unknown>:0

Tracker binding for barseries

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

F1j0k wrote at 2014-06-03 11:14:

Hi,
I would like to ask, is it possible to bind X coordinate in tracker for BarSeries graph ?
thx

objo wrote at 2014-06-06 20:57:

WPF?
There is a TrackerChanged event on the PlotModel. I don't think we have exposed any bindable properties or a routed event for the tracker in the PlotView control. Maybe this should be added?

ExampleLibrary_PCL Error: 'System.Type' does not contain a definition for 'Assembly'

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

rajah wrote at 2012-10-18 07:26:

When attempting to build the latest OxyPlot code, I was getting multiple errors of the form:

Error 1 'System.Type' does not contain a definition for 'Assembly' and no extension method 'Assembly' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)
Error 2 'System.TimeZoneInfo' does not contain a definition for 'ConvertTimeFromUtc' 
Error 3 'System.TimeZoneInfo' does not contain a definition for 'FindSystemTimeZoneById' Error 4 'Assembly' is an ambiguous reference between 'System.Reflection.Assembly' and 'OxyPlot.Assembly'
Error 5 'System.Reflection.Assembly' does not contain a definition for 'GetExecutingAssembly' Error 6 'Assembly' is an ambiguous reference between 'System.Reflection.Assembly' and 'OxyPlot.Assembly'
Error 7 'System.Reflection.Assembly' does not contain a definition for 'GetExecutingAssembly'

I was able to get around this problem by defining the PCL conditional compilation symbol for the ExampleLibrary_PCL project. (METRO,PCL)

Hope this helps someone else


objo wrote at 2012-10-18 08:59:

Thanks for the messages. I found some build errors in the Silvelight/Metro projects - should be corrected now. The metro example browser seems to work, so I think the PCL ExampleLibrary should be ok now. 

How to set two differents magnitudes for a Polar plot?

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

ralphbernardes wrote at 2014-05-15 19:01:

Hi,

I´m using OxyPlot in a project which requires a Polar plot with two different Magnitude Axis. I was able to make the plot update its series but when I updated the magnitude axis it only considers what was put last.
I mean, it looks that even though we can add as many axes we want through Plot.Axes.Add... it is not considering all the axes.
What I need is a way of having one magnitude axis for one set of series, then it would represent those values on the plot and then scale this axis setting the value of the Magnitude.Maximum value.

This would be necessary in case the data ploted is very small or very big, then I would have to resize the plot down or up in order to really examine the chart.

Any idea how it works or how it is done or even if this can be done?

Thanks again for this amazing tool!

Ralph

ps: Moved from Issues, where I had misplaced the thread. Thanks.

ralphbernardes wrote at 2014-05-15 20:50:

It worked!

My Polar Plot has four axes (two angle and two magnitude), the first measures three things so it has three series. The second also measures three values and has its three series.

I did as Oystein suggested here:
(maybe this should be posted under discussions)
did you try setting the Keyon the axes and the XAxisKey on the series? I think it is a bug if this does not work.
I gave a key to each one of my axes and for each series related I set the XAxisKey for the MagnitudeAxis and YAxisKey for AngleAxis.

Thanks a lot.

Ralph

Confusion Matrices

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

pcp16 wrote at 2013-12-10 15:13:

Dear all!

Hi, I'm new here. This is first thread. I had a look at the other threads before posting: there's none about "confusion matrices".

What I'm trying to do is use the HeatMapSeries in order to have something like:

http://t1.gstatic.com/images?q=tbn:ANd9GcRpKII2C_wm5ZOiazRv1WL2eZsg9gKmtlnxeUiMQPCIThWL6SWR

I now have something which looks good (I have "categories" axes, with tilted labels).

The two issues I'm having are:

1) I'd like to have a grayscale that goes from white=0 to black=1.

2) I'd like to print the values in the center of the cells (like in the example I provided).

I tried googling (should I say binging? ;P) this around, but could not find an answer.

Regards,

Pau.

P.S: I noticed that you can invert the axis (say the vertical one startPosition=1; endPosition=0) so that the categories look "symmetrical" like in my example, ... but is there a way to automatically invert the data accordingly?

objo wrote at 2013-12-11 07:35:

This would be a great example to add to the library!

1) I think you can use OxyPalette.Interpolate(100, OxyColors.White, OxyColors.Black) where the value is the number of colors of the palette.
2) This is new functionality. You can create a subclass of HeatMapSeries and override the Render method, or add the new functionality to the HeatMapSeries (I see this can be useful in other cases where you don't have a lot of cells)

The inverted axes should be handled by HeatMapSeries when creating the image to be rendered. It is possible this is not supported yet. But this should absolutely be fixed. The image renderers do not support flipping/scaling of images, so this must be handled when generating the image.

pcp16 wrote at 2013-12-11 12:46:

Wow, that was fast, thanks!

1) Solved, yes, you can use that and it works.

2) I have created a modified version of HeatMapSeries, that does exactly what I need:
2.a) Renders the numbers in the center of the cells by using rc.DrawText() (and scales them appropriately)
2.b) Renders the matrix in "inverse order" to make it coincide with the "symmetrical" axes.

This is how it looks:

Image
[EDIT: Yes, it shows commas, instead of dots for number separations, due to my locale]

And this is the code:

ConfusionMatrixSeries.cs

And, finally, this is how I generate the model:
public static PlotModel ConfMatrix()
        {
            var data = new double[3, 3];

            data[0, 0] = 1;
            data[1, 1] = 0.8;
            data[1, 2] = 0.2;
            data[2, 2] = 1;
            
            string[] cat1 = { "class A", "class B", "class C" };
            
            var model = new PlotModel("Confusion Matrix");

            var palette = OxyPalette.Interpolate(50, OxyColors.White, OxyColors.Black);
            
            var lca = new LinearColorAxis { Position = AxisPosition.Right, Palette = palette, HighColor = OxyColors.White, LowColor = OxyColors.White };
            model.Axes.Add(lca);
            
            var axis1 = new CategoryAxis(AxisPosition.Top, "Actual class", cat1);
            model.Axes.Add(axis1);
            
            // We invert this axis, so that they look "symmetrical"
            var axis2 = new CategoryAxis(AxisPosition.Left, "Predicted class", cat1);
            axis2.Angle = -90;
            axis2.StartPosition = 1;
            axis2.EndPosition = 0;
            
            model.Axes.Add(axis2);
            
            var hms = new ConfusionMatrixSeries(data);
            
            model.Series.Add(hms);
            return model;
        }
Enjoy!

Pau.

objo wrote at 2013-12-11 21:09:

Very cool! I merged the label rendering code into the HeatMapSeries and added the confusion matrix to the examples!

pcp16 wrote at 2013-12-11 22:53:

I think an option should be included in HeatMapSeries, so that the data matrix can be rendered starting from the "bottom, left" (as in a Cartesian Space style) or from the "top, right" (as in a Matrix style). It could be that this behaviour is required/desirable in other graphs as well, thus, it's possible that it needs to be added to XYAxisSeries or somewhere else.

objo wrote at 2013-12-12 07:44:

I think the flipping of the matrix can be handled by reversing the axes or setting the X0, X1, Y0 and Y1 coordinates.
But there should be an option that determines if the indices of the array are [ix,iy] or [iy,ix] (where ix is the index along the x-axis and iy is the index along the y-axis).

pcp16 wrote at 2013-12-12 10:58:

Well, what I did is change the UpdateImage function in HeatMapSeries.cs like this:
/// <summary>
        /// Updates the image.
        /// </summary>
        private void UpdateImage()
        {
            int m = this.Data.GetLength(0);
            int n = this.Data.GetLength(1);
            var buffer = new OxyColor[m, n];
            for (int i = 0; i < m; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    buffer[i, j] = this.ColorAxis.GetColor(this.Data[j, i]);
                }
            }

            this.image = OxyImage.Create(buffer, ImageFormat.Png);
        }
I'm not sure if this is the correct procedure, or this could be done by changing X0, X1, etc. But I don't think so ... this code doesn't take X0,X1 into account at all, right?

Pau.

objo wrote at 2013-12-12 20:32:

I noticed you are transposing the matrix, this is not handled by the current implementation in the HeatMapSeries. I applied a Transpose method to your data set in the example!
The transpose could be implemented in the HeatMapSeries with a new option, I suggest a bool property Transpose or an enum property IndexOrder defined as { XY, YX }
Under review

OxyPlot and F#

Oystein Bjorke 10 year бұрын updated by Foggy Finder 9 year бұрын 3
This discussion was imported from CodePlex

amouhsine wrote at 2013-04-29 21:51:

Hi all,

First, this is a great work so far. Nice library.

Is there any tutorial (or maybe translation of the wpf examples) in F# for F#ers?

that would be great.

Thanks in advance

Anass

objo wrote at 2013-05-06 10:47:

I have not tried this library together with F#, but it would be very interesting to see a simple F# example. Should the WPF user interface also be written in F#?

I found some examples with other libraries
http://www.ffconsultancy.com/products/fsharp_for_visualization/
http://stackoverflow.com/questions/3276357/how-do-i-plot-a-data-series-in-f
http://fssnip.net/2l
It should be possible to do the same for this library!

this.plot1.Model

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

yribbens wrote at 2014-05-22 01:58:

I'm following the "Getting started" guide for Windows Forms, and also looking at the examples:

https://oxyplot.codeplex.com/SourceControl/latest#Source/Examples/DocumentationExamples/HelloWorld/WindowsFormsApplication1/Form1.cs

namespace WindowsFormsApplication1
{
using System;
using System.Windows.Forms;

using OxyPlot;
using OxyPlot.Series;

public partial class Form1 : Form
{
    public Form1()
    {
        this.InitializeComponent();
        var myModel = new PlotModel("Example 1");
        myModel.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)"));
        this.plot1.Model = myModel;
    }
}
}


Can someone explain where plot1 is created? I get an error that this definition does not exist.

Thanks!

objo wrote at 2014-05-23 08:17:

Thanks for the notice - the 'getting started' should be improved. The plot1 should be a PlotView control added to the form.

OxyPlot on Silverlight 5 vs2010

Oystein Bjorke 10 year бұрын 0
This discussion was imported from CodePlex

ChevyCP wrote at 2013-06-19 15:27:

Hi, I use this for wpf, but am now trying to get it going on a silverlight 5 project in visual studio 2010 with no luck. I don't see the .silverlight.dll's and I am not able to compile the software. Which dlls work for this combo? The base oxyplot dll gives me errors when I add it. Thanks!

objo wrote at 2013-06-19 20:41:

Install portable library tools to compile the OxyPlot on VS2010.
http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981

To get the assemblies, use
nuget: http://nuget.org/List/Packages/OxyPlot.Silverlight
or download OxyPlot-SL5-x.x.x.x.zip

Reference OxyPlot.dll (a portable class library) and OxyPlot.Silverlight.dll

objo wrote at 2013-06-20 08:57:

I included all assemblies in the same download from build #51.
It's a larger file (28Mb), but it should be easier to find the assemblies you need.

ChevyCP wrote at 2013-06-20 16:52:

Thanks, that did the trick. Although that portable library plug-in introduced the following warning in my error list, but it seems to work anyway.

Warning 1 The following exception occurred creating the MEF composition container:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
The default code generator will be used. C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Ria.Client.targets 303 5

ChevyCP wrote at 2013-06-20 18:47:

By removing the contents from the bin folder and recompiling, it removed this warning