Reputation: 7800
I'm working with Highcharts and have a basic dual-series column chart. I want to add a single data-driven line to the chart, as show in the red box in the image below, but I'm unsure the best approach (this will go on the current month to note a projected month-end value).
I've considered three ways to do this but am not sure the best route:
Has anyone had to do something like this before and could offer some insight on how it was accomplished? Thanks.
Upvotes: 0
Views: 1454
Reputation: 12472
Drawing a custom line is the cleanest solution I guess - you can make that line responsive easily by hooking into redraw event and do re-positioning/resizing.
A series approach doesn't require a lot coding, just setting a few options. You can use a scatter type with a custom marker symbol.
Highcharts.SVGRenderer.prototype.symbols.line = function(x, y, w, h) {
return ['M', x, y, 'L', x + w, y];
};
{
type: 'scatter',
showInLegend: false,
enableMouseTracking: false,
marker: {
symbol: 'line',
lineColor: 'orange',
lineWidth: 6,
radius: 20
},
data: [
[1.15, 140]
]
}]
example: http://jsfiddle.net/g6fjjach/
Upvotes: 3