Reputation: 13579
I have a question on how to add a flag to line chart, I tried several ways but nothing seems to work, I have a chart that looks like this for example
$(function () {
$('#container').highcharts({
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar']
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5]
} ]
});
});
and I would like to add flags to it like in the following chart
Thanks.
Upvotes: 0
Views: 1262
Reputation: 37578
You can use something like annotations extension which allows to add custom shapes in user-friendly form.
Upvotes: 1
Reputation: 4769
Flag is available in highstock.js only, its not available in highcharts.js, you should update your js libs and then create flag using
{
type : 'flags',
data : [{
x : yourX,
title : 'title here',
text : 'your text'
}
See Updated fiddle , if you define type of xAxis as dateTime provide dateTime's value in flag's x: yourX.
Upvotes: 1