Skip to content

Instantly share code, notes, and snippets.

@VisualMelon
Created September 22, 2017 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VisualMelon/475e3f966054d9a54e67dca44fa0754e to your computer and use it in GitHub Desktop.
Save VisualMelon/475e3f966054d9a54e67dca44fa0754e to your computer and use it in GitHub Desktop.
var model = new PlotModel { Title = "PNG Rendering" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
model.Series.Add(new FunctionSeries(x => x * x, 0, 1, 1000));
// export as PNG
var pngExporter = new OxyPlot.WindowsForms.PngExporter();
using (var fs = System.IO.File.Open("test.png", System.IO.FileMode.Create))
{
    pngExporter.Export(model, fs);
}
var model = new PlotModel { Title = "PNG Rendering" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
model.Series.Add(new FunctionSeries(x => x * x, 0, 1, 1000));
// export as PNG
var pngExporter = new OxyPlot.WindowsForms.PngExporter();
using (var fs = System.IO.File.Open("test.png", System.IO.FileMode.Create))
{
    pngExporter.Export(model, fs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment