Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion highcharts-api/highcharts/01-simple-column/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<!doctype html>

<head>
<title>Simple Column Chart</title>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">

<script src="https://code.highcharts.com/highcharts.js"></script>

<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
</head>

<body>
Expand Down
55 changes: 55 additions & 0 deletions highcharts-api/highcharts/01-simple-column/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const cityNames = ['Tokyo', 'New York', 'London'];

const maxY = 9;
const seriesDataLength = 3;

const series = cityNames.map(city => {
const cityData = Array.from({ length: seriesDataLength }, () => {
return Math.floor(Math.random() * (maxY + 1));
});

return {
name: city,
data: cityData
}
});

const chartOptions = {
chart: {
type: 'column'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar']
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
formatter: function () {
const { dataMax } = this.series.chart.yAxis[0];

if (this.y === dataMax) {
return 'max';
}
}
}
}
},
series
}

const chart = Highcharts.chart('container', chartOptions);
const highestY = chart.yAxis[0].dataMax;

chart.update({
yAxis: {
max: highestY,
softMax: highestY * 2,
plotLines: [{
color: 'green',
dashStyle: 'Dash',
width: 3,
value: highestY * 1.5,
}]
},
});