Text Formatters

Overview

Sometimes it might be necessary to display any text with the points on a chart for some reasons. That's when you need to use the format() method.

String Tokens

String tokens are special string values you can use in text formatters instead of using formatting functions described below. They are suitable when you need only basic formatting, but they cover most of the cases.

Here is how tokens can be used in tooltips, series labels or axes labels:

Tokens List

Here is a list of the tokens you can use in formatting strings. Note that some tokens don't work universally: you can't use {%BubbleSize} outside of Bubble series or {%Close} outside of Candlestick or OHLC and so on.

Extra fields

The number and variety of default fields might be not enough in some cases. Sometimes it's necessary to show some extra information. In this case you should use one of the following methods: getStat(), getData() or getMeta(). Which one to use depends on the unique situation.

getData

Using these methods, you can display the values from the extra parameters, if you have added any to the series or to the data. Look at the sample and its code below:

In this sample we have added some extra information to the data: we defined the "extra_inf" parameter of "redundant" value for the second point of the second series and displayed it, using getData().

Managing additional information for chart tooltips works pretty much the same as it does for chart labels. Define extra parameter in your data set and use the name of your parameter as a value for getData() method.