[]
SvgGraphicsRendering and SvgRendering both produce SVG output through different rendering engines.
SvgGraphicsRendering generates vector SVG output through the DS graphics rendering engine.
using System.Text;
using System.Xml;
using C1.Chart;
using C1.Chart.Standard;
using C1.Excel;
using C1.Util;
var chart = new FlexChart();
// Configure the chart.
// Configure width, height, widthPx, and heightPx.
string svg;
using (var rendering = new SvgGraphicsRendering(widthPx, heightPx))
{
chart.Render(rendering, 0, 0, width, height);
var builder = new StringBuilder();
rendering.ToDocument().Save(
builder,
new XmlWriterSettings
{
Encoding = Encoding.UTF8,
Indent = true
});
svg = builder.ToString();
}
svg = svg.Substring(svg.IndexOf("<svg"));SvgGraphicsRendering renders text as vector outlines. The generated text is not selectable as ordinary text.
Note: Multiple SVG outputs generated by SvgGraphicsRendering and embedded in the same HTML page require unique clip-path identifiers to prevent identifier conflicts.
SvgRendering is designed for resource-constrained platforms such as Blazor, Android, and iOS. It provides faster rendering in those environments and retains selectable text.
using C1.Chart;
using C1.Chart.Standard;
using C1.Excel;
using C1.Util;
var chart = new FlexChart();
// Configure the chart.
// Configure width, height, widthPx, and heightPx.
string svg;
using (var rendering = new SvgRendering(widthPx, heightPx))
{
chart.Render(rendering, 0, 0, width, height);
svg = rendering.ToText();
}SvgRendering produces vector output and retains text as selectable text. Text rendering depends on the fonts available in the viewing environment.