public static void SaveToSvg(IntPtr pointer, string path, int width, int height)
        {
            GCHandle handle = GCHandle.FromIntPtr(pointer);

            if (handle.IsAllocated)
            {
                PlotModel model = handle.Target as PlotModel;
                if (model != null)
                {
                    model.DefaultFontSize = 20;
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                    using (var stream = File.Create(path))
                    {
                        var svgExporter = new SvgExporter1()
                        {
                            Width = width, Height = height, TextMeasurer = new SvgTextMeasurer()
                        };
                        svgExporter.Export(model, stream);
                    }
                }
            }
        }
        /// <summary>
        /// Exports to 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>
        /// <param name="textMeasurer">The text measurer.</param>
        /// <returns>The plot as a svg string.</returns>
        public static string ExportToString(IPlotModel model, double width, double height, bool isDocument, IRenderContext textMeasurer = null)
        {
            string result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                SvgExporter1.Export(model, memoryStream, width, height, isDocument, textMeasurer);
                memoryStream.Flush();
                memoryStream.Position = 0l;
                StreamReader streamReader = new StreamReader(memoryStream);
                result = streamReader.ReadToEnd();
            }
            return(result);
        }
 /// <summary>
 /// Exports the specified <see cref="T:OxyPlot.PlotModel" /> to a string.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>the SVG content as a string.</returns>
 public string ExportToString(IPlotModel model)
 {
     return(SvgExporter1.ExportToString(model, this.Width, this.Height, this.IsDocument, this.TextMeasurer));
 }
 /// <summary>
 /// Exports the specified <see cref="T:OxyPlot.PlotModel" /> to a <see cref="T:System.IO.Stream" />.
 /// </summary>
 /// <param name="model">The model to export.</param>
 /// <param name="stream">The target stream.</param>
 public void Export(IPlotModel model, Stream stream)
 {
     SvgExporter1.Export(model, stream, this.Width, this.Height, this.IsDocument, this.TextMeasurer);
 }