Changing Data Plot Attributes (Chart Titles and Labels) - AnyChart Interactivity (JavaScript)

If you want to change chart titles and labels you should use data plot custom attributes to parametrize them and then use setPlotCustomAttribute(attributeName, attributeValue) or view_setPlotCustomAttribute(viewId, attributeName, attributeValue) to update attributes and, thus, update the text fields.

Note: Refresh() or View_Refresh(viewId) method should be called to apply the changes made.

The sample below allows you to update chart title and footer.

View XML: Open XML File with data plot custom attributes.

Code used to update looks like that:

var title = document.getElementById("title").value;
var footer = document.getElementById("footer").value;
chart.setPlotCustomAttribute("title", title);
chart.setPlotCustomAttribute("footer", footer);

chart.refresh();
Title:     
Footer: