我在图表中绘制了一条线。我需要动态绘制点。下面是我在jsfiddle中的代码。我需要绘制一天24小时,沿x轴30分钟恒定间隔,并在y轴上停止名称。 请帮忙。
var Arcategories = ['Udhna Darwaza', 'Kharwar Nagar', 'Satya Nagar', 'Udhna Tran Rasta', 'Udhna Bus Stand', 'Udhna Academy', 'Laxmi Narayan Temple', 'Daksheswar Mahadev', 'Pandesara G.I.D.C.', 'Kamnath Mahadev', 'Navin Flourine', 'Bhestan Naher', 'Bhagwati Industrial Estate', 'Unn Naka', 'Unn Industrial Estate', 'Unn Char Rasta', 'Green Park', 'Sachin G.I.D.C.'];
var timeArray = ["06:00:00", "06:05:00", "06:13:00", "06:19:00", "06:26:00", "06:32:00", "06:38:00", "06:45:00", "06:52:00", "06:59:00", "07:06:00", "07:13:00", "07:20:00", "07:28:00", "07:34:00", "07:40:00", "07:46:00", "07:52:00"];
resulttime = [];
for (var i = 0; i < timeArray.length; i++) {
var hms = timeArray[i].split(':');
var d = new Date(); // creates a Date Object using the clients current time
var st = [Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), hms[0], hms[1], hms[2]), "00"];
resulttime.push([st[0], i]);
}
console.log(resulttime)
Highcharts.chart('container', {
xAxis: {
type: 'datetime',
opposite: true,
gridLineWidth: 1
},
yAxis: {
categories: Arcategories,
reversed: true
},
series: [{
marker: {
enabled: false
},
data: resulttime
}]
});
&#13;
#container {
min-width: 310px;
max-width: 800px;
height: 400px;
margin: 0 auto;
}
&#13;
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container"></div>
&#13;