本文整理汇总了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);
}
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
示例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;
}