5.3 Creating bar highlights

Bar highlights change the colours of specific bars on the chart, in order to highlight them in some way.

The definition of a bar highlight simply has two properties:

Property

Description

date

Date for the highlight, as a number of milliseconds. Does not have to match the start time of a bar. Will change the bar which contains the specified time.

color

Color for the bar, as an HTML colour code such as "red" or "#FF0000" or "rgba(255,0,0,0.5)"

You create bar highlights by passing an individual definition, or an array of definitions, to UDI.createBarHighlight (). If you are creating several highlights at once, it is far more efficient to pass an array than to make multiple calls to UDI.createBarHighlight (). For example:

UDI.createBarHighlight([
	{date: data.barData.date[i - 1], color: "red"},
	{date: data.barData.date[i - 2], color: "green"}
]);

Individual highlights can be removed by passing a date, or an array of dates, to UDI.removeBarHighlight(). For example:

UDI.removeBarHighlight([data.barData.date[i - 1], data.barData.date[i - 2]]);

Last updated