-
Notifications
You must be signed in to change notification settings - Fork 980
Expand file tree
/
Copy pathPlotModelExtensions.cs
More file actions
39 lines (37 loc) · 1.53 KB
/
PlotModelExtensions.cs
File metadata and controls
39 lines (37 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PlotModelExtensions.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// Provides extension methods to the <see cref="PlotModel" />.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot.WindowsForms
{
using System;
using System.Drawing;
/// <summary>
/// Provides extension methods to the <see cref="PlotModel" />.
/// </summary>
public static class PlotModelExtensions
{
/// <summary>
/// Creates an SVG string.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="width">The width (points).</param>
/// <param name="height">The height (points).</param>
/// <param name="isDocument">if set to <c>true</c>, the xml headers will be included (?xml and !DOCTYPE).</param>
/// <returns>A <see cref="string" />.</returns>
public static string ToSvg(this PlotModel model, double width, double height, bool isDocument)
{
using (var g = Graphics.FromHwnd(IntPtr.Zero))
{
using (var rc = new GraphicsRenderContext(g) { RendersToScreen = false })
{
return OxyPlot.SvgExporter.ExportToString(model, width, height, isDocument, rc);
}
}
}
}
}