Skip to content

ChartTemplates.Duplicate

method · ChartTemplates · cAlgo.API Since 5.6

DesktopCLICloud

Duplicates or creates a copy of an existing chart template.

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 Duplicate(string chartTemplateName, ChartTemplate chartTemplate)
api.ChartTemplates.Duplicate(chartTemplateName: str, chartTemplate: ChartTemplate) -> ChartTemplate

Parameters

Name C# type Python type Description
chartTemplateName string str New chart template name.
chartTemplate ChartTemplate ChartTemplate Existing chart template.

Returns ChartTemplate — ChartTemplate

Examples

var copy = ChartTemplates.Duplicate("Default Copy", ChartTemplates.DefaultTemplate);
Print("Duplicated template: {0}", copy.Name);
copy = api.ChartTemplates.Duplicate("Default Copy", api.ChartTemplates.DefaultTemplate)
api.Print(f"Duplicated template: {copy.Name}")