JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'spline'
},
title: {
text: 'Column chart with negative values'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
max: 10,
min: -300,
maxPadding: 0.50,
startOnTick: false,
endOnTick: true,
title: {
enabled: true,
text: ' Downlink(%) Uplink/Span(%)'
},
labels: {
formatter: function(){
console.log('data--',this.value);
return (Math.abs(this.value)) + 'M';
}
}
},
tooltip: {
formatter: function() {
return ''+
this.series.name +': '+ Math.abs(this.y) +'M';
}
},
credits: {
enabled: false
},
plotOptions: {
series: {
events: {
legendItemClick: function(event) {
name = this.name.replace(' ', '');
this.visible ? this.chart.get(name).hide() : this.chart.get(name).show();
}
}
}
},
series: [{
id: 'error1',
name: 'Errors One',
color:'red',
data: [5, 3, 4, 7, 2],
}, {
id: 'ErrorsOne',
color: 'red',
data: [-222, -234, -123, -189, -289],
showInLegend: false
}, {
...