oxyplot - A plotting library for .NET OxyPlot

Xamarin Forms OxyPlot for Bar charts

I'm Working on Xamarin.Forms application where I want to implement bar charts as attached in screenshot. There are no such control in Xamarin.Forms, so I'm using OxyPlot nuget package for that, but the problem is that the bars in oxyplot are Horizontal and there is no option for grid lines inside graph plot. is there any open source Library for the bar graphs so that I can use.enter image description here

Source: (StackOverflow)

Multi color Marker for same LineSeries - OxyPlot

Is it possible to have a different marker style for ranges among (XY-Axis) values ? For example. The marker style is shown in steel blue color here, Can I have markers above 15 and below 13 to show another color ?


enter image description here

Source: (StackOverflow)

C# - OxyPlot how to add plot to windows form

Trying out OxyPlot, installed and referenced packages. Copying and pasting the example from here http://docs.oxyplot.org/en/latest/getting-started/hello-windows-forms.html but it doesn't recognize plot1 from the last line. I am guessing because the control isn't added to the form. How do I add it? I don't see it in the toolbox, and I tried adding the control to the toolbox and can't find it anywhere. Thanks.

Source: (StackOverflow)

How to create square plot area with Oxyplot

I'm trying to create a square graph (X axis width is the same as the Y axis height).

I can't find any documentation on this and all of the properties I've seen which might be able to do this are inaccessible.

I've tried:

<oxy:PlotView Model="{Binding Model}" Width="500" Height="500"/>

This obviously doesn't work because this sets the entire area (not the graph specific portion).

Source: (StackOverflow)

How to refresh oxyplot plot when data changes

GUI for the program

Oxyplot graphs 13 points which are derived from the 6 user input text boxes. The values in the text boxes are held in public variables in the MainWindow.xaml.cs class. The variables are updated when the user presses enter in the text box. How would I make the refresh button refresh the graph.

private void RefreshButton_Click(object sender, RoutedEventArgs e)
            //Refresh The Graph

I think that this would be done using the


method, but I am not sure how to implement it because of Oxyplot's poor documentation.

Source: (StackOverflow)

How do I create and plot a ContourSeries with Oxyplot?

I have a WPF application where I need to visualize y = y(x1, x2) where x1, x2 are linear coordinates. I can do this using the HeatMapSeries in Oxyplot, but when I want to plot two sets of data in the same window, heatmaps are not the proper tool. A couple of contour series would be better. Now, I have tried to achieve this in the same manner as with the HeatMapSeries, that worked pretty well:

public void PlotHeatMap (){

   OxyPlot.PlotModel model = new PlotModel { Title = "2-D data" };
   model.Axes.Add( new OxyPlot.Axes.LinearColorAxis { 
   Position = OxyPlot.Axes.AxisPosition.Right, 
   Palette = OxyPalettes.Jet( 500 ), 
   HighColor = OxyColors.Gray, 
   LowColor = OxyColors.Black } );

   OxyPlot.Series.HeatMapSeries heatmap = new OxyPlot.Series.HeatMapSeries {
     Data = ( Double[ , ] )data,
     X0 = x1min,
     X1 = x1max,
     Y0 = x2min,
     Y1 = x2max

   model.Series.Add( heatmap );

Output from the HeatMapSeries

Now, when I try to use the ContourSeries instead, I just replace the HeatMapSeries with a ContourSeries:

public void PlotContour (){

   OxyPlot.PlotModel model = new PlotModel { Title = "2-D data" };
   model.Axes.Add( new OxyPlot.Axes.LinearColorAxis { 
   Position = OxyPlot.Axes.AxisPosition.Right, 
   Palette = OxyPalettes.Jet( 500 ), 
   HighColor = OxyColors.Gray, 
   LowColor = OxyColors.Black } );

   OxyPlot.Series.ContourSeries contour = new OxyPlot.Series.ContourSeries {
      ColumnCoordinates = arrayFromMinToMax1,
      RowCoordinates = arrayFromMinToMax2,
      ContourLevels = arrayOfLevels,
      ContourColors = arrayOfColors, // Same # elements as the levels' array
      Data = ( Double[ , ] )data

   model.Series.Add( contour );

This just produce the output:

Output from the ContourSeries attempt

The x- and y-axes are there, and match the min and max coordinates, but I can see no contour lines. I suspect that there is something missing with setting up the Axis (should it be the same as for the HeatMapSeries??). I don't know how to proceed with this contour plot. Are there examples other than e.g. the ContourSeriesExamples at GitHub?

Thanks for any help!

Source: (StackOverflow)

How to plot MULTIPLE LineSeries on an OxyPlot chart?

I apologize for asking so many OxyPlot questions, but I seem to be really struggling with using the OxyPlot chart control.

My project is in WPF format so I was originally using a hosted WINFORMS chart and that worked like a charm and did absolutely everything I needed it to until I needed to overlay a WPF element on top of the hosted winform chart. Due to the "AirSpace" issue, I was not able to see the WPF element that I put on top of the hosted chart no matter what I did. That is when I decided to go with OxyPlot, which is giving me quite a few headache's so far.

Here is my origional question! that I asked over at CodePlex. I don't seem to be getting much help over there so I am trying again here.

My question is:

Does anyone know how to plot MULTIPLE LineSeries onto a Plot??

My approach so far:

I am taking a c# List array and adding a new copy of the LineSeries that holds new data to be plotted. My code:

    // Function to plot data
    private void plotData(double numWeeks, double startingSS)

        // Initialize new Salt Split class for acess to data variables
        Salt_Split_Builder calcSS = new Salt_Split_Builder();
        calcSS.compute(numWeeks, startingSS, maxDegSS);

        // Create the OxyPlot graph for Salt Split
        OxyPlot.Wpf.PlotView plot = new OxyPlot.Wpf.PlotView();

        var model = new PlotModel();

        // Add Chart Title
        model.Title = "Salt Split Degradation";

        // Create new Line Series
        LineSeries linePoints = new LineSeries() { StrokeThickness = 1, MarkerSize = 1, Title = numWeeks.ToString() + " weeks" };

        // Add each point to the new series
        foreach (var point in calcSS.saltSplitCurve)
            DataPoint XYpoint = new DataPoint();
            XYpoint = new DataPoint(point.Key, point.Value * 100);
            linePoints.Format("%", XYpoint.Y);


        // Define X-Axis
        var Xaxis = new OxyPlot.Axes.LinearAxis();
        Xaxis.Maximum = numWeeks;
        Xaxis.Minimum = 0;
        Xaxis.Position = OxyPlot.Axes.AxisPosition.Bottom;
        Xaxis.Title = "Number of Weeks";

        //Define Y-Axis
        var Yaxis = new OxyPlot.Axes.LinearAxis();
        Yaxis.MajorStep = 15;
        Yaxis.Maximum = calcSS.saltSplitCurve.Last().Value * 100;
        Yaxis.MaximumPadding = 0;
        Yaxis.Minimum = 0;
        Yaxis.MinimumPadding = 0;
        Yaxis.MinorStep = 5;
        Yaxis.Title = "Percent Degradation";

        // Add Each series to the
        foreach (var series in listPointAray)
            LineSeries newpoints = new LineSeries();
            newpoints = linePoints;

        // Add the plot to the window
        plot.Model = model;



My code works the first time I press my "Graph Data" button, but fails on consecutive attempts with the following error:

The element cannot be added, it already belongs to a Plot Model

The following plot is the type of plot I would like to produce (it worked fine using WinForms Chart control):

Image http://i59.tinypic.com/jqs3n9.jpg

I would like a new line with a new color to be plotted each time I run the method.

Source: (StackOverflow)

Binding OxyPlot via MVVMCross in Xamarin.Android

I have added OxyPlot Android and Core in my Xamarin PCL based project where I am using MVVMCross.

I have added the plotview in my xml as follows. But I do not know how to bind this view using MVVMCross.

Is there any good example or resources to follow?


android:layout_height="match_parent" /> 


public class MyView : MvxFragment<MyViewModel>
    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        var ignored = base.OnCreateView(inflater, container, savedInstanceState);
        var view = this.BindingInflate(Resource.Layout.MyView, null)

        MyViewModel MyMainViewModel = new MyViewModel();
        var a = view.FindViewById<PlotView>(Resource.Id.plot);
        a.Model = MyViewModel.MyModel;

        return view;


public PlotModel MyModel { get; set; }
public MyViewModel
  PlotModel mo = new PlotModel();
  var s1 = new LineSeries()
    Color = OxyColors.SkyBlue,
    MarkerType = MarkerType.Circle,
    MarkerSize = 6,
    MarkerStroke = OxyColors.White,
    MarkerFill = OxyColors.SkyBlue,
    MarkerStrokeThickness = 1.5
  s1.Points.Add(new DataPoint(0, 10));
  s1.Points.Add(new DataPoint(10, 40));
  s1.Points.Add(new DataPoint(40, 20));
  s1.Points.Add(new DataPoint(60, 30));
  MyModel = mo;

Additional Information for OxyPlot installation

I have added OxyPlot as follows through Package Console.

In the PCL

PM> Install-Package OxyPlot.Core -Version 1.0.0-unstable1983 -Pre

In the Android

PM> Install-Package OxyPlot.Xamarin.Android -Pre

Or you can also add them in Nuget Console from prelease library.

Source: (StackOverflow)

How can I show the plot points in Oxyplot for a line Graph?

Here is the xaml code to my graph:

<oxy:Plot HorizontalAlignment="Left" 
              Title="Videos Watched"
              TextColor="White" IsLegendVisible="False" IsManipulationEnabled="False" IsMouseWheelEnabled="False">
            <oxy:DateTimeAxis Name="datetimeAxis" Position="Bottom" MajorGridlineColor="#40FFFFFF" TicklineColor="White" StringFormat="M/d/yy" IntervalType="Days" ShowMinorTicks="False"/>
                Title="Videos Viewed"
                TrackerFormatString="Date: {2:M/d/yy}&#x0a;Value: {4}"
                ItemsSource="{Binding PlotItems}" MarkerStroke="#FFFDFDFD" />
                    <Grid Canvas.Left="{Binding Position.X}" Canvas.Top="{Binding Position.Y}">
                        <Ellipse Fill="White" Width="12" Height="12" HorizontalAlignment="Left" VerticalAlignment="Top">
                                <TranslateTransform X="-6" Y="-6" />
                        <TextBlock Foreground="{DynamicResource OrangeTextColor}" Text="{Binding}" Margin="-60 -40 0 0" />

In the plot Series is there any way to show the plot points as circles or something of that nature?

Here is an example image of what I mean, each plot point has a small circle associated with it:

Plot points are shown

Source: (StackOverflow)

Override OxyPlot default color palette

I've been making use of OxyPlot lately, and was wondering if there is a way of overriding the default Color Palette of PlotSeries / PlotModel?

I know i can set the color individually for each series, but it would be nice to have an array of color and then apply it to the model / series.

Source: (StackOverflow)

wpf oxyplot -- change popup when datapoint is clicked

I am using oxyplot with wpf and I want to change the popup if a datapoint gets clicked. OxyplotDataPointClick

Is it possible to change? I saw a few examples that show how to get the clicked point but nothing about changeing the style.

Thank You

Source: (StackOverflow)

Auto-scoll/pan in OxyPlot real-time data series plotting

I am using OxyPlot in a C# winforms app. My axese are LinearAxis type.

I am trying to plot some real-time data which i have managed to do by adding points to my series and refreshing the plot as data becomes available. However, I am having trouble figuring out how to make the plot move to the right with the time series.

Each time series data point has an X value incremented by (int) 1 and I have tried to get the auto scrolling to happen using .Pan() like so:


Obviously this hasn't worked since I am assuming the method takes pixel inputs or something and consequently the panning is much slower than the data incrementation.

I have also tried replacing -1 with -MajorTIckSize and -MajorStepSize with no luck as these are generally too small of a move.

My question is, how can i determine the delta i need to be using to pan with the real-data? I am assuming this will depend on the zoom level and obviously it would be nice if it would continue to work as I zoomed in and out.I imagine the solution involves some sort of function that relies on the pixel width of the tick interval or something but I can't figure it out.

PS: I've asked this question on OxyPlot discussion page as well



Source: (StackOverflow)

Using OxyPlot to render png images from a PlotModel

From the documentation on the OxyPlot Documentation Website, it says to use the PngExporter class. This class no longer exists in OxyPlot, but rather there are classes called PngEncoder and PngDecoder. I suspect the equivalent method to PngExporter.Export is PngEncoder.Encode however it asks for a 2d array of OxyColor called "pixels", but I do not know where to get this data from. NOTE: Exporting to SVG or PDF works but this form is useless.

Problem: I need to export PNGs from code only of a PlotModel in OxyPlot but documentation is outdated.

This is the code I have been told to use:

 using (var stream = File.Create(fileName))
        var pngExporter = new PngExporter();
        pngExporter.Export(plotModel, stream, 600, 400, Brushes.White);

Source: (StackOverflow)

Refreshing OxyPlot Chart

I'm working on a WPF app. This app uses the OxyPlot chart control. I am letting the user perform a calculation. The user can view the result in both grid and chart form. In an attempt to do this, I have the following:


<DataGrid x:Name="resultDataGrid" ItemsSource="{Binding Items}">
    <DataGridTextColumn Header="#" Binding="{Binding Number}" />
    <DataGridTextColumn Header="Description" Binding="{Binding Description}" />

<oxy:Plot x:Name="resultGraph" Background="Transparent" Height="400" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" Visibility="Collapsed">
    <oxy:LineSeries ItemsSource="{Binding Points}" MarkerType="Circle"  Title="Result" />

<StackPanel Orientation="Horizontal">
  <Button x:Name="executeButton" Click="executeButton_Click" />
  <Button x:Name="viewData" Click="viewData_Click" />
  <Button x:Name="viewChart" Click="viewChart_Click" />


public partial class Home: Page
  private MyViewModel viewModel = null;
  public Home()

    viewModel = new MyViewModel();
    this.DataContext = viewModel;

  private void executeButton_Click(object sender, RoutedEventArgs e) {

  private void viewData_Click(object sender, RoutedEventArgs e) 
    resultDataGrid.Visibility = System.Windows.Visibility.Visible;
    resultGraph.Visibility = System.Windows.Visibility.Collapsed;

  private void viewChart_Click(object sender, RoutedEventArgs e)
    resultDataGrid.Visibility = System.Windows.Visibility.Collapsed;
    resultGraph.Visibility = System.Windows.Visibility.Visible;


public class MyViewModel : INotifyPropertyChanged
  public Dictionary<int, string> Items{ get; set; }
  public IList<DataPoint> Points{ get; set; }

  public void Execute() 
    this.Items = new Dictionary<int, string>();
    this.Points = new List<DataPoint>();

    var randomNumber = GetRandomNumber();
    for (var i=0; i<10; i++) 
      this.Items.Add((i+1), "Item #" + i);

      var dataPoint = new DataPoint(i, (randomNumber*i));


My problem is, when a user clicks the "Execute" button, the data gets refreshed for in the DataGrid, which is what I am expecting. However, the chart only gets refreshed if the chart is first visible. In other words, if I click "execute" when the DataGrid is visible, the plot points in the chart become stale. But, If I have the resultGraph visible and I click "Execute" the points get refreshed as expected. I do not understand what I'm doing wrong. Any help is appreciated.

Source: (StackOverflow)

Is it possible to create isosurfaces using Oxyplot?

I'm using Oxyplot HeatMapSeries for representing some graphical data. For a new application I need to represent the data with isosurfaces, something looking like this: enter image description here

Some ideas around this:

  • I know the ContourSeries can do the isolines, but I can't find any option that allows me to fill the gaps between lines. Does this option exists?

  • I know the HeatMapSeries can be shown under the contourSeries so I can get a similar result but it does not fit our needs. enter image description here.

  • Another option wolud be limiting the HeatMapSeries colours and eliminate the interpolation. Is this possible?

If anyone has another approach to the solution I will hear it!

Thanks in advance!

Source: (StackOverflow)