score:16
Building on Mark's suggestion using redraw
event to position the images and using load
event to create them. Adding them on load
is necessary to make them available during export and you would not want to create new images on each redraw
either.
These chart events are used:
events: {
load: drawImages,
redraw: alignImages
}
In the drawImages
function I'm using the inverse translation for the xAxis to position the images on the chart:
x = chart.plotLeft + chart.xAxis[0].translate(i, false) - imageWidth / 2,
y = chart.plotTop - imageWidth / 2;
and then adding them and setting a click handler, zIndex, pointer cursor:
chart.renderer.image('http://highcharts.com/demo/gfx/sun.png', x, y, imageWidth, imageWidth)
.on('click', function() {
location.href = 'http://example.com'
})
.attr({
zIndex: 100
})
.css({
cursor: 'pointer'
})
.add();
In alignImages
the attr
function is used to set new x and y values for the images which are calculated the in the same way as in drawImages
.
Full example on jsfiddle
Screenshot:
score:0
Couple of ideas. First, I would use the chart redraw event to know when the chart is being redrawn (say on a zoom). Then second, explicitly place your images at the axis locations of interest. To get those query directly out of the DOM.
Using jQuery:
$('.highcharts-axis') //return an array of the two axis.
They will have svg "text element" children with (x, y) positions.
Source: stackoverflow.com
Related Query
- Highcharts: Adding clickable image to every xAxis gridLine
- highcharts change rendered image source on click
- Adding tool-tip to an image rendered using Highcharts Renderer.image() api
- Highcharts - xAxis showing every other year
- xAxis Image Disappears in Highcharts After First Refresh
- Highcharts dynamic-update example - adding 1 new value every second - without historic data
- Tick and label for every xAxis Unit in Highcharts Chart
- Adding a SVG image to symbol in highcharts
- Highcharts - show every other x-axis category
- HighCharts show datetime format on xAxis
- Adding thousands separator for custom formatted highcharts tooltip
- adding series to highcharts from JSON
- HighCharts : Adding Hyperlinks to the X-Axis of the chart
- Highcharts - remove times between dates on a datetime xaxis type
- HighCharts - show last labels in xAxis
- Custom Highcharts Context Menu Button Appearing in Every Chart on Page
- How to update new plotline values instead of removing and adding new ones in highcharts
- How to get an image watermark in HighCharts charts?
- Highcharts chart with 'datetime' xAxis - use categories on drilldown
- How to add image in Highcharts Title and subtitle
- Show label only every x number of steps in highcharts
- display content on highcharts Xaxis and Yaxis title in form of subscript and superscript
- Adding a series dynamically with HighCharts Stock Charts
- Adding only one clickable point to the chart in Highcharts?
- Highcharts - show every month on datetime x-axis when the parent container is small
- Highcharts - Provide URL's for series data to open clickable link
- How can I force highcharts to show every x-axis label regardless of spacing constraints?
- Adding HTML label to Highcharts
- Highcharts loading image
- how to set xAxis pointInterval(update: tickInterval) in highcharts
More Query from same tag
- Highcharts error #15: www.highcharts.com/errors/15
- How disable the 'k' dislay in Highcharts ordinate?
- HighChart - Can draw line between Title and SubTitle
- how to start semi circle donut chart angle from respective position in highchart?
- Hightlight a Bar in HighCharts Bar chart
- Highcharts column change color, but marker/dot not changing
- Displaying time series data in a highchart
- Highcharts scatter plot with time only
- Highcharts export duplicating category labels
- Show tooltip in column chart when hovering crosshair line
- How to change the layout and the alignment of the legend in the Highchart?
- How to change chart's width to fill up div using angular2-highcharts when hide/open left side nav menu?
- Highcharts display label for pie chart using html table as data source
- Highchart bars lower half gets disappeared
- Export chart without hidden series labels in legend
- Highcharts show x-axis labels as weekly intervals
- how to set the interval of points on Y - Axis highcharts
- Is it possible to reparent the high charts legend?
- Changing number of columns based on the zoom level : HighChart (column chart type)
- Formatting Highcharts labels with a callback function (Formatter)
- Parsing json data to highcharts
- Adding a series dynamically with HighCharts Stock Charts
- When adding point on dynamically created Multiple Highchart Graphs on a single page, the plot line draws to the start point instead of last point?
- Highcharts custom tooltip positioner
- Can we stack a 2 columns in a single column in basic column Highchart and let the other columns let it be?
- How do you prevent a popover from overflowing viewport boundaries?
- Issue configuring Highcharts/ Highstock candlestick (React JS)
- having issue when updation Highcharts object using highcharts-ng directive
- How to represent hour to hour Highcharts tooltip - Time series?
- HighCharts Column Range Data after json_encode