Currently, I am exploring the process of incorporating HighCharts Chart data directly within the actual webpage.
Below is the complete code snippet:
<!DOCTYPE html>
<html><head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="http://highcharts.github.io/export-csv/export-csv.js"></script>
<script type="text/javascript">
parent.$('iframe').height('256');
</script>
<style>
.highcharts-tooltip h3 {
margin: 0.3em 0;
}
</style>
<script>
$(function () {
$('#container').highcharts({
chart: {
type: 'column',
height: 220
},
title: {
text: ''
},
xAxis: {
categories: ['Data 1', 'Data 2', 'Data 3', 'Data 4', 'Data 5']
},
yAxis: {
min: 0,
title: {
text: 'Data by Name'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: -30,
verticalAlign: 'top',
y: 25,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
style: {
textShadow: '0 0 3px black'
}
}
}
},
series: [{
name: 'Name 3',
data: [5, 3, 4, 7, 2]
}, {
name: 'Name 2',
data: [2, 2, 3, 2, 1]
}, {
name: 'Name 1',
data: [3, 4, 4, 2, 5]
}]
});
});
</script>
</head>
<body style="overflow:hidden">
<div id="container" style="height: 400px; margin: 0 auto"></div>
</body></html>
I am interested in finding out how I can adjust the code to fetch and display data from an external JSON file instead?