ChartTemplates.Get
method · ChartTemplates · cAlgo.API Since 5.6
DesktopCLICloud
Returns a chart template by name if exists otherwise null.
Environment behaviour
CLI — works differently. No templates are listed; Create works for this run only and is not saved; Remove returns false; DefaultTemplate throws NullReferenceException.
Cloud — not supported. Empty: Get returns null, Contains and Remove return false, Create and Duplicate throw, DefaultTemplate throws NullReferenceException.
Definition
ChartTemplate Get(string chartTemplateName)
api.ChartTemplates.Get(chartTemplateName: str) -> ChartTemplate | None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
chartTemplateName | string | str | Chart template name |
Returns ChartTemplate — ChartTemplate if found otherwise null.
Examples
var template = ChartTemplates.Get("My Template");
if (template == null)
Print("Template not found");
else
template.Apply(Chart);
template = api.ChartTemplates.Get("My Template")
if template is None:
api.Print("Template not found")
else:
template.Apply(api.Chart)