When the page is initialized, it displays all 20 weeks' data.
I want to display from 2018week1 to 2018week5, this five weeks data for employee1 and employee2, when the chart is initialized.
When zooming on the X axis or Y axis, I should be able to chose any time period.
var chart = null;
data1 = [1884, 2936, 2039, 1948, 1814, 2071, 2183, 3234, 3426, 2188, 1884, 2936, 2039, 1948, 1814, 2071, 2183, 3234, 3426, 2188]
data2 = [875, 694, 919, 1092, 815, 1137, 1421, 1547, 1737, 1748, 875, 694, 919, 1092, 815, 1137, 1421, 1547, 1737, 1748]
chart = Highcharts.chart('container', {
chart: {
zoomType: 'xy'
},
title: {
text: 'Importance'
},
xAxis: {
categories: ['2017week43', '2017week44', '2017week45', '2017week46', '2017week47', '2017week48', '2017week49', '2017week50', '2017week51', '2017week52', '2018week1', '2018week2', '2018week3', '2018week4', '2018week5', '2018week6', '2018week7', '2018week8', '2018week9', '2018week10']
},
yAxis: {
title: {
text: 'Importance'
}
},
legend: {
enabled: false
},
plotOptions: {
line: {
marker: {
radius: 2
},
dataLabels: {
enabled: true
},
lineWidth: 1,
states: {
hover: {
lineWidth: 1
}
},
threshold: null
}
},
series: [{
type: 'line',
name: 'employee1',
data: data1
},
{
type: 'line',
name: 'employee2',
data: data2
}
]
});
<script src="https://img.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/oldie.js"></script>
<script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
<div id="container" style="min-width:400px;height:400px"></div>
The effect of the code now: jsfiddle