score:1
Accepted answer
Depending on what would you like to achieve, you can use the annotations module
or Renderer API
to draw labels on the chart. I suppose you can also use the xAxis.blotBands
in this case. Check the following docs for getting more information:
Docs: https://www.highcharts.com/docs/advanced-chart-features/annotations-module https://www.highcharts.com/docs/chart-concepts/plot-bands-and-plot-lines
Here is an example code of rendered rectangle with text:
chart: {
events: {
render: function() {
let chart = this,
x1 = chart.xAxis[0].toPixels(0),
x2 = chart.xAxis[0].toPixels(25),
width = x2 - x1,
height = chart.plotSizeY,
y = chart.yAxis[0].toPixels(0) - height,
text = 'My text';
// RECTANGLE
chart.renderer
.rect(x1, y, width, height)
.attr({
stroke: 'red',
'stroke-width': 2,
zIndex: 3,
})
.add();
// TEXT
chart.renderer
.text(text, x1 + width / 2, y)
.attr({
align: 'center',
zIndex: 4,
})
.css({
fontSize: '15px'
})
.add();
}
}
},
Demo: https://jsfiddle.net/BlackLabel/3nqjwha5/
API Reference: https://api.highcharts.com/class-reference/Highcharts.SVGRenderer
Source: stackoverflow.com
Related Query
- Add extra labels to line charts
- Highcharts: aligning data labels on the same line in bar charts
- How to add trend line to high charts
- How to add labels to the end of a highcharts line graph
- Highchart not printing json when I add extra line to redirect
- High charts remove dots from the line graph
- Can I add an "average" line to Highcharts Chart?
- Enable or disable data labels shown in pie charts in Highcharts on click of a button
- Drill down function in highcharts in case of line charts
- How do I add a tooltip to the x-axis labels in highcharts?
- Add dynamic data to line chart from mysql database with highcharts
- How to add mean line in a boxplot made with highcharter?
- High Charts fails to add series dynamically
- Add plot line to heat map
- How to plot line in highcharts on charts click event?
- Highcharts - CUSTOM DATA LABELS in line series, are disappearing on window resize
- HighCharts: display the y-axis labels in percentage instead of the absolute count for basic column charts
- Add custom buttons in Angular Highcharts Line Chart
- I want to add a line to each column in a Highcharts column chart
- How to add a horizontal line in Column bar chart in Highcharts plugin?
- How to add data labels for a treemap in highcharter in r?
- Echarts how to highlight area between 2 line charts
- How do you position the x-axis labels along the line y=0 using Highcharts?
- Highcharts Line Charts Out of memory
- Add second line to chart
- How do i add mouse wheel code in Angular2 highcharts in typescript
- How to get rid of the line labels in highcharts?
- Add extra tooltip in Highcharts
- Make highcharts bar-chart threshold line visible & labels not to overlap on one another
- Use of DotNet HighCharts dll to make charts in code behind
More Query from same tag
- how to create a column char with highcharts where each column has a different color
- Highstock line chart series processedYData is wrong
- HighCharts - How can i use the period separator in xAxis
- testing that a json can be rendered as a highchart
- Having some trouble loading highcharts using backbone and rails
- Trying to figure out how to assign specific colors to specific data points in Highchart Pie chart
- Highcharts error #13 unless I run under IE compatibility view?
- TypeScript insert record to multi dimension array ( Eg - Array< number | [number, number] | [string, number] )>
- Two data points on same day
- Highcharts: how to add padding/spacing from top of chart
- Styling the stacked column highchart datalabels individually
- Can we get index from series data in highcharts
- Removing or Switching Events on Highcharts
- Highcharts v6.0.0 Annotations Not Working
- highcharts with scrollbar, how to display all items on download image?
- Highcharts pie charts served from AJAX call
- Disabled points not hide. [Highcharts]
- Highcharts not rendering plotbands correctly on first load
- Display space in chart in case of null value present in object in high chart stacked bar chart
- high chart with date range filtering
- Display start and end date range in timeseries LineChart using HighCharts
- Highcharts (ng2-highcharts) gauge in Ionic
- Plotting data on x axis in Highstock
- Exiting full screen does not re-render graph to same size in highcharts exporting at angular 7
- Highcharts - parse json series
- Show total graph in a particular time: Highcharts, Javascript
- Get Value of visibility of series
- Table appearing in front of my dropdown menu
- Highcharts export customize axis label and fontsize: No effect after migration
- Highstock: specify x-axis datetime period