SvgIcon constructor
constructor · SvgIcon · cAlgo.API
DesktopCLICloud
Creates an SVG icon from raw SVG XML string.
Environment behaviour
CLI — works differently. The SVG is not validated: invalid or oversized SVG is accepted instead of throwing InvalidOperationException as on desktop.
Cloud — works differently. The SVG is not validated: invalid or oversized SVG is accepted instead of throwing InvalidOperationException as on desktop.
Definition
public SvgIcon(string svgXml)
SvgIcon(svgXml: str)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
svgXml | string | str | SVG XML |
Examples
var icon = new SvgIcon("<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path d='M2 14 L8 2 L14 14 Z' fill='#27AE60'/></svg>");
var image = new Image { Source = icon, Width = 32, Height = 32 };
Chart.AddControl(image);
icon = SvgIcon("<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path d='M2 14 L8 2 L14 14 Z' fill='#27AE60'/></svg>")
image = Image()
image.Source = icon
image.Width = 32
image.Height = 32
api.Chart.AddControl(image)