當前位置: 首頁>>代碼示例>>C#>>正文


C# PlotModel.Render方法代碼示例

本文整理匯總了C#中OxyPlot.PlotModel.Render方法的典型用法代碼示例。如果您正苦於以下問題:C# PlotModel.Render方法的具體用法?C# PlotModel.Render怎麽用?C# PlotModel.Render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OxyPlot.PlotModel的用法示例。


在下文中一共展示了PlotModel.Render方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Export

 /// <summary>
 /// Exports the specified model to a file.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="width">The width (points).</param>
 /// <param name="height">The height (points).</param>
 /// <param name="textMeasurer">The text measurer.</param>
 public static void Export(PlotModel model, string fileName, double width, double height, IRenderContext textMeasurer = null)
 {
     using (var svgrc = new SvgRenderContext(fileName, width, height, textMeasurer))
     {
         model.Update();
         model.Render(svgrc);
     }
 }
開發者ID:jgodinez,項目名稱:OxyPlot.2DGraphLib.MonoTouch,代碼行數:16,代碼來源:SvgExporter.cs

示例2: Export

 /// <summary>
 /// Exports the specified model to a stream.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="stream">The output stream.</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>
 public static void Export(PlotModel model, Stream stream, double width, double height, bool isDocument, IRenderContext textMeasurer)
 {
     using (var rc = new SvgRenderContext(stream, width, height, true, textMeasurer, model.Background))
     {
         model.Update();
         model.Render(rc, width, height);
         rc.Complete();
         rc.Flush();
     }
 }
開發者ID:AndrewTPohlmann,項目名稱:open-hardware-monitor,代碼行數:19,代碼來源:SvgExporter.cs

示例3: Export

        public static void Export(PlotModel model, string fileName, int width, int height, Brush background = null)
        {
            using (var bm = new Bitmap(width, height))
            {
                using (Graphics g = Graphics.FromImage(bm))
                {
                    if (background != null)
                    {
                        g.FillRectangle(background, 0, 0, width, height);
                    }

                    var rc = new GraphicsRenderContext { RendersToScreen = false };
                    rc.SetGraphicsTarget(g);
                    model.Update();
                    model.Render(rc, width, height);
                    bm.Save(fileName, ImageFormat.Png);
                }
            }
        }
開發者ID:microe1,項目名稱:MouseComparator,代碼行數:19,代碼來源:MousePlot.cs

示例4: Export

        /// <summary>
        /// Exports the specified plot model to a stream.
        /// </summary>
        /// <param name="model">The plot model.</param>
        /// <param name="stream">The stream to write to.</param>
        /// <param name="width">The width of the export image.</param>
        /// <param name="height">The height of the exported image.</param>
        /// <param name="background">The background.</param>
        public static void Export(PlotModel model, Stream stream, double width, double height, OxyColor background = null)
        {
            var canvas = new Canvas { Width = width, Height = height };
            if (background != null)
            {
                canvas.Background = background.ToBrush();
            }

            canvas.Measure(new Size(width, height));
            canvas.Arrange(new Rect(0, 0, width, height));

            var rc = new SilverlightRenderContext(canvas);
            model.Update();
            model.Render(rc, width, height);

            canvas.UpdateLayout();
            var image = canvas.ToImage();
            image.WriteToStream(stream);
        }
開發者ID:aleksanderkobylak,項目名稱:oxyplot,代碼行數:27,代碼來源:PngExporter.cs

示例5: DoCreateChartImage

 protected override Image DoCreateChartImage()
 {
     var plotModel = new PlotModel("");
     var ls = new LineSeries("")
         {
             Points = Parameters.SeriaData.Select(t => new DataPoint(t.Key, t.Value) as IDataPoint).ToList()
         };
     plotModel.Series.Add(ls);
     plotModel.Axes.Add(new LinearAxis(AxisPosition.Left));
     plotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom));
     var bitmap = new Bitmap(Parameters.ChartWidth, Parameters.ChartHeight);
     using (var graphics = Graphics.FromImage(bitmap))
     {
         var graphicsRenderContext = new GraphicsRenderContext { RendersToScreen = false };
         graphicsRenderContext.SetGraphicsTarget(graphics);
         plotModel.Update();
         plotModel.Render(graphicsRenderContext, Parameters.ChartWidth, Parameters.ChartHeight);
         return bitmap;
     }
 }
開發者ID:nus-ii,項目名稱:DotNetChartingOverview,代碼行數:20,代碼來源:OxyPlotAdapter.cs

示例6: ExportToString

        /// <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="textMeasurer">The text measurer.</param>
        /// <param name="isDocument">if set to <c>true</c>, the xml headers will be included (?xml and !DOCTYPE).</param>
        /// <returns>
        /// The plot as a svg string.
        /// </returns>
        public static string ExportToString(PlotModel model, double width, double height, bool isDocument = false, IRenderContext textMeasurer = null)
        {
            string svg;
            using (var ms = new MemoryStream())
            {
                var svgrc = new SvgRenderContext(ms, width, height, isDocument, textMeasurer);
                model.Update();
                model.Render(svgrc);
                svgrc.Complete();
                svgrc.Flush();
                ms.Flush();
                ms.Position = 0;
                var sr = new StreamReader(ms);
                svg = sr.ReadToEnd();
            }

            return svg;
        }
開發者ID:jgodinez,項目名稱:OxyPlot.2DGraphLib.MonoTouch,代碼行數:29,代碼來源:SvgExporter.cs


注:本文中的OxyPlot.PlotModel.Render方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。