Skip to content

ChartTemplates.Contains

method · ChartTemplates · cAlgo.API Since 5.6

DesktopCLICloud

Checks if a chart template with passed name exists or not.

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

bool Contains(string chartTemplateName)
api.ChartTemplates.Contains(chartTemplateName: str) -> bool

Parameters

Name C# type Python type Description
chartTemplateName string str Chart template name

Returns bool — True if exists otherwise False.

Examples

var exists = ChartTemplates.Contains("My Template");
Print("Template My Template exists: {0}", exists);
exists = api.ChartTemplates.Contains("My Template")
api.Print(f"Template My Template exists: {exists}")