score:1
Accepted answer
You can store reference to an element and edit it's attributes, for example based on axis values. Example:
chart: {
events: {
render: function() {
const chart = this;
const xAxis = chart.xAxis[0];
const yAxis = chart.yAxis[0];
const startX = xAxis.toPixels(1);
const startY = yAxis.toPixels(7);
const width = xAxis.toPixels(6) - startX;
const height = yAxis.toPixels(4) - startY;
if (!chart.customRect) {
chart.customRect = chart.renderer.rect().attr({
'stroke-width': 2,
stroke: 'red',
fill: 'yellow'
}).add();
}
chart.customRect.attr({
x: startX,
y: startY,
width,
height
});
}
}
}
Live demo: http://jsfiddle.net/BlackLabel/p6743jam/
API Reference:
https://api.highcharts.com/class-reference/Highcharts.SVGElement#attr
https://api.highcharts.com/class-reference/Highcharts.Axis#toPixels
Source: stackoverflow.com
Related Query
- Highcharts - how to export chart with different scale in one click
- Highcharts - creating chart with same scale axis
- Highcharts: Auto-scale rendered shape along with chart?
- Highcharts cloud issue with data source when duplicating chart
- Highcharts export chart along with outer div
- Highcharts Dynamic Updated Highstock Charts doesn't display along with Bar Chart
- Reload chart data via JSON with Highcharts
- Highcharts - how to have a chart with dynamic height?
- dealing with highcharts bar chart with really long category names
- Change Highcharts tooltip formatter from chart Object , after chart is rendered
- Highcharts scatter chart with a name per point
- Highcharts / jQuery - destroy and rebuild chart with original options
- Highcharts : Chart with drilldown how to obtain click event of drill up button
- Highcharts export chart exportSettings with svg file
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Highcharts polar spider with multiple y-axis scale
- Highcharts chart with 'datetime' xAxis - use categories on drilldown
- Highcharts Column chart with drilldown, remove hyperlink like formatting from x-axis labels
- exporting highcharts polar chart to PDF with phantomjs
- Highcharts - multiple plot with the same x scale
- Highcharts - Scatter chart with a line connecting the dots in the series
- Highcharts blank chart with x and y axis
- Resize a chart before printing with Highcharts
- Add dynamic data to line chart from mysql database with highcharts
- Add onclick event on chart made with the highcharts library
- Highcharts with reveal.js: Refresh chart with slide?
- Highcharts connecting scatter chart and pie chart with single legend
- Highcharts Donut chart is rendered as a Pie chart in IE 8
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- Highcharts - Global configuration with common code and unique data & Headings
More Query from same tag
- AngularJS Directive Applying Wrong Data
- Show multiple values for a day in Highcharts time series
- Highcharts x-axis tick starts with an offset
- Highcharts Map not Zooming Properly
- yii highcharts how to set date format in x-axis
- Segmenting x-axis of a line chart in highcharts
- Having Several Units on Highcharts Spiderweb
- Highstock + Bootstrap datepicker
- Highchart series is choping
- Added options in Highcharts download/context buttons get repeated
- Making Javascript button toggle function work with dropdown selection
- How do I unbold title of Highcharts' legend?
- Rails 3: Creating compact array for highcharts includes nil, but shouldn't
- Shrink browser content to browser window size
- Highcharts Sync charts vertically
- Highcharts plotlines above area using DOM
- Highcharts - drill down to multiple series
- How can I force multiple y-axis in Highcharts to have a common zero
- xAxis startOnTick and endOnTick options ignored on boxplots
- Highcharts Gauge Spacing
- highcharts: How do I change the color of the chart above?
- How To Call A Function To Make A Graph Using HighCharts in PHP
- Highcharts/Highstock Scrollbar Issue
- Highcharts - add additional export options without losing default ones
- Highcharts disable hover effect and select animation
- HighChart - Stacked Bar chart - To show dash line over the bar chart to the specific portion in the bar
- How to get what are the items collapsed in gantt highcharts-angular
- Programmatically change a chart title in highcharts
- Highcharts - getting all values scrollable after setting min-max range
- How To generate json format from model in codeigniter