score:2
Accepted answer
You could update dataLabel
for gauge series and use inline CSS to set font-size per each text line based on current chart width.
Demo: https://jsfiddle.net/sxkz9q32/
Relevant part of code:
var options = {
tooltip: {
enabled: false
},
chart: {
type: 'gauge',
backgroundColor: 'rgba(255, 255, 255, 0)',
plotBackgroundColor: null,
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false,
spacing: [5, 30, 5, 30],
style: {
fontSize: '1em'
},
events: {
redraw: function() {
var chart = this;
if (chart.lastWidth !== chart.plotWidth) {
chart.lastWidth = chart.plotWidth;
chart.series[0].update({ //apply changes to center the text
dataLabels: {
formatter: function() {
var output = '<div class="gauge-data">';
output += '<span class="gauge-value" style="font-size: ' + chart.plotWidth / 66 + 'em;">' + this.y + '</span>';
output += '<span class="gauge-text" style="font-size: ' + chart.plotWidth / 190 + 'em;">Engine LOAD</span>';
output += '<span class="gauge-unit" style="font-size: ' + chart.plotWidth / 211 + 'em;">KW</span>';
output += '</div>';
return output;
}
}
});
}
}
}
},
I have used values based on width that were looking fine for me, but could use your own calculations.
score:1
you can use vw as long as your graphic scales with the screen size
.gauge-value {
font-size: 8vw;
}
Source: stackoverflow.com
Related Query
- How to accomplish responsive texts in Highcharts gauges?
- Highcharts - how to do a responsive pie chart when the texts of the labels are long
- How to make a pie chart from highcharts responsive
- How do i add mouse wheel code in Angular2 highcharts in typescript
- how to display 2 same highcharts without duplicate the code
- How to edit tooltip in Highcharts C# code
- how to use highcharts tooltip formatter in python code
- How can I adapt a Highcharts graph to a responsive view
- How to have multiple highcharts with different series data in vuejs without repeating code
- How to add texts to a graph in Highcharts
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- how do i link my sqlite(PDO) databse data to highcharts code
- how can I use rangeselector and navigation in highcharts in the given code
- How to change code in "Pie Chart" in HighCharts
- How to make the highcharts generated chart be scalable or responsive
- How to get highcharts dates in the x axis?
- How to create a column range chart in Highcharts using range and navigator functions?
- How to remove button from Highcharts
- How can I get access to a Highcharts chart through a DOM-Container?
- HighCharts - How can I turn off the points?
- How do you change the colour of each category within a highcharts column chart?
- How to set Highcharts chart maximum yAxis value
- Responsive Highcharts not sizing correctly until window resize
- How to modify highcharts legend item click event?
- How can I change the colors of my highcharts piechart?
- How to make highcharts default to 0 for missing data
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- Highcharts - how to have a chart with dynamic height?
- How do I rotate my HighCharts bar chart so its vertical, not horizontal?
- How can I hide series from a HighCharts legend?
More Query from same tag
- Remove whitespace from highcharts gauge chart?
- How to change x-axis labels in highcharts in month, week, quarter on condition?
- Highchart xAxis and value did not align
- Displaying ajax requested JSON objects into HighCharts
- Highcharts dynamic binding in c# or json
- Highcharts Detect mouseOver event only in the colored area
- Populating Highcharts tooltip with data from other charts
- Loading Highcharts configuration externally
- install highcharts exporting server
- Render chart only once with multiple events : Highcharts
- Highchart zoom feature is not working. It is in https://jsfiddle.net/f0n31uqx/
- Overlapping labels in HighCharts on xAxis
- how to show data label only on drilldown pie?
- How to customize highchart treemap datalabels?
- Highcharts - set maximum range for yAxis but keep axis dynamic within that range
- Highcharts.js - Event when any point is clicked
- Highcharts - only apply style to certain labels
- Highcharts Sunburst changing color on level change
- How to get my categories with date in xAxis?
- Custom data label for a single point in OHLC candlestick in Highcharts
- Highcharts Pie chart
- is Dumbell.js supporting with previous version of highchart?
- HighCharts - set minimum Tick Interval
- Dynamically Take input from text-areas in a jquery ui custom pop up box for Tooltip in highcharts
- Highcharts Graph not recreating on same Android activity
- Dynamically changing subtitles at various drilldowns in treemap in highcharts?
- Highcharts with data populated by php generated html table - only one will load
- Highstock data not showing when setting xAxis min and max
- How to show xAxis label in tooltip in a Highcharts area chart?
- Highcharts - display label on yAxis