JSFiddle - React, Tailwind, and code Playground
by dganesh
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<body>
<div>
<ul class="nav nav-tabs">
<li class="active">
<a href="#1" data-toggle="tab">Tab 1</a>
</li>
<li >
<a href="#2" data-toggle="tab">Tab 2</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="1">
<div class="col-md-6">
<div id="graph-container-gray" style="min-width: 310px; max-width: 800px; height: 300px; margin: 0 auto"></div>
</div>
</div>
<div class="tab-pane active" id="2">
<div class="col-md-6">
<div id="graph-container-red" style="min-width: 310px; max-width: 800px; height: 300px; margin: 0 auto"></div>
</div>
</div>
</div>
</div>
</body>
JavaScript
$(document).ready(function(){
$('#graph-container-red').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Country Vs Population'
},
xAxis: {
categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: 'Population (millions)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
valueSuffix: ' millions'
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -40,
y: 80,
floating: true,
borderWidth: 1,
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
shadow: true
},
credits: {
enabled: false
},
series: [{
name: 'Year 1800',
data: [107, 31, 635, 203, 2],
color : '#E53935'
}]
});
$('#graph-container-gray').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Country Vs Population'
},
xAxis: {
categories: ['India', 'America', 'Asia', 'Europe', 'Oceania'],
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: 'Population (millions)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
valueSuffix: ' millions'
},
...