我正在尝试获取一张高位图表以在x轴上显示分钟。我在csv数据中的第一列是分钟。我认为我的rangeSelector选项正确,但是我不知道如何使x轴成为距csv的分钟数。
我看到的大多数解决方案都用Date.UTC(xx,xx,xx,xx)或类似值填充x轴。但是我需要把它填满几分钟。
这是我到目前为止的内容:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Data from innerHTML of hidden div</title>
<style>
body {
margin-top: 30px;
margin-left: 40px;
}
pre {
border: 1px solid red;
}
</style>
<!-- Highcharts related imports -->
<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/data.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script> -->
<!-- Highstock related imports -->
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/data.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<script src="https://code.highcharts.com/stock/modules/export-data.js"></script>
</head>
<body>
<div style="width: 800px; margin: 2em auto; padding: 1em; border: 1px solid red; border-radius: 0.5em">
Highcharts data load from a csv stored inline in a hidden div
</div>
<div id="container" style="width:100wv; min-width: 310px; height: 600px; margin: 0 auto"></div>
<pre id="csv" style="display:none">Minutes,Y1,Y2
1,5,120
2,4,121
3,4,120
4,3,119
5,4,118
6,4,118
7,5,118
8,5,117
9,6,118
10,5,117
11,6,118
12,5,117
13,5,116
14,6,115
15,5,116
16,5,115
17,4,114
18,3,113
19,2,113
20,3,112
21,4,112
22,4,111
23,5,111
24,4,110
25,4,109
26,4,108
27,5,107
28,6,108
29,7,108
30,8,108
31,8,108
32,8,107
33,7,106
34,8,106
35,7,107
36,6,108
37,7,108
38,7,107
39,6,107
40,6,108
41,5,109
42,4,108
43,4,108
44,5,109
45,6,110
46,7,109
47,8,110
48,8,110
49,7,111
50,7,110
51,6,110
52,7,109
53,7,110
54,6,109
55,7,108
56,7,107
57,6,108
58,6,107
59,7,108
60,6,107
61,5,108
62,6,107
63,6,107
64,6,107
65,5,108
66,4,109
67,5,108
68,6,107
69,5,108
70,4,109
71,5,109
72,6,109
73,7,109
74,6,108
75,5,109
76,4,108
77,3,108
78,4,108
79,5,107
80,6,108
81,7,108
82,6,107
83,7,107
84,6,108
85,7,109
86,6,110
87,6,110
88,6,109
89,5,109
90,5,108
91,4,109
92,3,108
93,3,109
94,3,109
95,3,109
96,3,109
97,4,109
98,3,110
99,3,111
100,4,110
101,3,110
102,2,111
103,2,112
104,2,112
105,1,112
106,2,112
107,2,113
108,3,113
109,4,114
110,4,113
111,4,112
112,4,112
113,5,111
114,5,112
115,6,111
116,6,112
117,7,112
118,8,111
119,7,111
120,6,110
121,5,111
122,4,111
123,5,110
124,6,109
125,6,109
126,5,109
127,4,109
128,3,110
129,2,111
130,1,111
131,0,111
132,0,112
133,1,111
134,0,112
135,0,113
136,0,112
137,0,111
138,0,112
139,1,112
140,0,113
141,0,112
142,0,111
143,0,111
144,1,111
145,2,110
146,1,111
147,0,110
148,1,109
149,0,109
150,0,110
151,1,109
152,2,110
153,1,110
154,2,109
155,3,110
156,3,111
157,4,112
158,5,111
159,4,112
160,5,111
161,4,111
162,5,110
163,5,109
164,5,109
165,5,109
166,4,110
167,5,111
168,6,111
169,6,112
170,6,113
171,7,113
172,8,114
173,9,115
174,10,114
175,11,115
176,11,116
177,11,117
178,11,116
179,10,116
180,9,117
181,9,116
182,9,117
183,8,118
184,7,119
185,8,120
186,7,121
187,6,122
188,7,122
189,6,121
190,5,121
191,4,120
192,4,119
193,4,120
194,4,119
195,3,119
196,4,120
197,5,119
198,4,119
199,3,118
200,2,119
201,1,118
202,0,117
203,0,116
204,1,115
205,2,114
206,3,114
207,3,114
208,4,115
209,3,116
210,4,116
211,4,116
212,3,116
213,2,115
214,2,115
215,3,116
216,4,116
217,5,115
218,6,115
219,7,115
220,6,114
221,7,114
222,7,114
223,7,113
224,7,114
225,7,114
226,6,114
227,5,115
228,5,114
229,6,115
230,7,114
231,6,115
232,7,114
233,6,115
234,5,116
235,4,116
236,3,116
237,4,115
238,3,116
239,2,115
240,1,116
241,2,117
242,3,116
243,4,116
244,3,115
245,3,115
246,4,114
247,3,115
248,2,115
249,3,116
250,4,116
251,4,117
252,4,117
253,4,118
254,3,118
255,2,118
256,2,118
257,3,118
258,4,119
259,4,118
260,5,117
261,4,118
262,4,117
263,4,117
264,4,116
265,3,116
266,3,116
267,2,116
268,2,115
269,1,116
270,1,117
271,2,116
272,1,115
273,2,115
274,1,115
275,0,115
276,0,114
277,1,113
278,0,113
279,0,114
280,0,115
281,0,114
282,1,115
283,2,115
284,3,115
285,4,114
286,4,115
287,5,114
288,5,114
289,5,114
290,4,114
291,4,115
292,4,114
293,5,113
294,6,112
295,6,112
296,5,112
297,4,111
298,3,110
299,2,111
300,3,110
301,4,109
302,3,108
303,3,108
304,2,109
305,2,108
306,3,108
307,3,109
308,4,108
309,4,109
310,4,108
311,4,108
312,5,108
313,6,107
314,7,106
315,6,105
316,7,106
317,8,107
318,9,107
319,10,107
320,10,108
321,9,107
322,8,108
323,7,107
324,8,107
325,8,108
326,8,107
327,9,107
328,10,106
329,10,106
330,9,107
331,10,108
332,9,107
333,10,107
334,9,107
335,9,108
336,8,109
337,8,108
338,7,109
339,6,110
340,6,109
341,7,109
342,7,108
343,8,108
344,8,107
345,7,106
346,7,105
347,8,105
348,9,104
349,10,105
350,11,106
351,11,106
352,11,106
353,12,107
354,13,106
355,14,106
356,15,107
357,16,106
358,16,106
359,16,107
360,17,106
361,16,105
362,15,106
363,16,107
364,15,107
365,14,106
366,13,106
367,12,107
368,13,108
369,14,109
370,13,110
371,13,111
372,13,111
373,14,112
374,15,113
375,16,114
376,16,114
377,17,115
378,16,116
379,15,117
380,14,118
381,15,119
382,16,119
383,17,120
384,16,120
385,16,120
386,17,119
387,17,119
388,17,120
389,16,121
390,17,122
391,16,121
392,16,121
393,15,122
394,14,123
395,15,123
396,16,123
397,15,122
398,15,123
399,14,123
400,15,122
401,14,122
402,14,122
403,13,122
404,13,122
405,14,122
406,13,122
407,13,122
408,14,122
409,15,122
410,16,122
411,16,122
412,15,122
413,16,121
414,15,120
415,16,120
416,15,121
417,14,120
418,13,121
419,14,121
420,14,122
421,15,122
422,14,121
423,14,121
424,14,122
425,15,121
426,16,121
427,15,121
428,14,120
429,13,119
430,13,118
431,14,118
432,14,119
433,13,118
434,13,119
435,14,120
436,14,121
437,15,121
438,16,121
439,17,121
440,16,120
441,15,119
442,14,118
443,13,117
444,12,117
445,11,117
446,11,118
447,10,118
448,9,118
449,10,117
450,10,117
451,10,116
452,11,115
453,11,116
454,12,115
455,11,116
456,11,115
457,12,116
458,13,116
459,13,117
460,13,116
461,13,117
462,12,118
463,13,119
464,12,120
465,13,120
466,12,120
467,13,121
468,12,121
469,13,120
470,14,119
471,14,119
472,15,119
473,14,119
474,15,119
475,15,120
476,14,121
477,13,120
478,14,119
479,13,119
480,13,119
481,14,119
482,14,120
483,13,120
484,13,119
485,12,120
486,12,120
487,12,121
488,12,120
489,13,121
490,12,121
491,12,121
492,11,122
493,10,121
494,10,120
495,10,119
496,9,119
497,8,120
498,9,120
499,9,120
500,10,120
501,10,119
502,11,119
503,11,119
504,10,119
505,9,118
506,8,119
507,8,119
508,8,120
509,9,120
510,10,119
511,10,119
512,10,119
513,11,118
514,10,118
515,11,119
516,10,119
517,10,118
518,11,119
519,12,120
520,13,121
521,12,122
522,13,121
523,14,121
524,14,121
525,14,121
526,13,122
527,12,121
528,11,120
529,11,120
530,10,119
531,9,120
532,10,119
533,10,118
534,10,118
535,10,119
536,9,120
537,9,119
538,8,119
539,7,120
540,6,119
541,5,118
542,5,117
543,5,117
544,5,116
545,6,116
546,7,116
547,8,115
548,9,114
549,10,113
550,9,114
551,9,113
552,8,113
553,9,112
554,8,113
555,9,113
556,10,112
557,11,112
558,11,113
559,10,113
560,11,114
561,11,114
562,10,114
563,10,114
564,10,113
565,11,113
566,11,112
567,12,113
568,13,112
569,12,111
570,13,110
571,14,110
572,13,111
573,14,110
574,14,111
575,15,111
576,16,111
577,15,111
578,14,110
579,15,110
580,14,110
581,15,109
582,15,110
583,16,110
584,17,110
585,16,111
586,15,110
587,15,109
588,15,109
589,14,109
590,13,108
591,13,108
592,12,109
593,12,110
594,11,109
595,10,109
596,9,109
597,10,109
598,10,110
599,11,109
600,12,110
601,12,111
602,13,110
603,14,109
604,15,108
605,16,109
606,17,110
607,16,111
608,17,110
609,18,111
610,17,112
611,18,113
612,18,114
613,19,113
614,20,113
615,21,114
616,20,114
617,21,114
618,20,115
619,19,116
620,20,115
621,20,114
622,20,114
623,21,114
624,21,114
625,20,114
626,20,114
627,20,115
628,19,116
629,18,117
630,18,118
631,17,119
632,16,118
633,16,119
634,16,119
635,15,118
636,15,118
637,14,119
638,14,119
639,15,119
640,14,118
641,13,119
642,12,120
643,11,120
644,10,120
645,9,121
646,9,121
647,8,122
648,9,123
649,10,123
650,11,122
651,11,122
652,10,122
653,10,123
654,11,122
655,11,122
656,11,123
657,10,122
658,10,122
659,11,121
660,12,122
661,13,122
662,13,122
663,13,121
664,14,122
665,14,121
666,14,120
667,15,120
668,15,121
669,16,122
670,17,123
671,16,124
672,17,123
673,16,122
674,17,121
675,17,121
676,18,120
677,19,121
678,19,122
679,19,121
680,20,122
681,19,121
682,19,121
683,19,120
684,20,120
685,20,119
686,20,120
687,20,119
688,20,118
689,19,117
690,19,117
691,18,116
692,18,117
693,18,117
694,18,117
695,18,117
696,18,117
697,18,117
698,17,117
699,16,116
700,17,115
701,18,116
702,17,115
703,17,116
704,16,117
705,17,117
706,17,117
707,18,117
708,18,116
709,18,115
710,19,114
711,20,113
712,20,113
713,20,113
714,20,114
715,21,113
716,21,114
717,20,114
718,20,115
719,21,114
720,22,113
721,21,113
722,21,112
723,22,112
724,21,111
725,22,110
726,23,109
727,23,109
728,23,109
729,24,108
730,23,109
731,24,109
732,23,110
733,22,109
734,23,108
735,22,108
736,22,107
737,21,107
738,20,107
739,19,106
740,19,106
741,19,105
742,19,104
743,20,105
744,20,106
745,20,107
746,20,107
747,21,107
748,22,108
749,22,107
750,21,107
751,22,106
752,22,107
753,22,106
754,22,106
755,21,105
756,22,104
757,22,105
758,21,104
759,20,105
760,21,104
761,21,103
762,22,102
763,21,101
764,20,101
765,20,102
766,20,102
767,19,102
768,18,101
769,17,100
770,16,100
771,16,101
772,16,101
773,15,100
774,14,99
775,13,100
776,13,100
777,12,101
778,13,102
779,12,101
780,13,100
781,12,101
782,11,100
783,11,99
784,12,99
785,11,98
786,11,97
787,12,97
788,13,96
789,13,96
790,14,95
791,14,96
792,14,96
793,15,96
794,14,96
795,14,97
796,15,98
797,15,97
798,15,96
799,16,95
800,15,94
801,15,95
802,14,96
803,13,97
804,14,97
805,13,98
806,13,97
807,12,97
808,13,98
809,13,99
810,14,100
811,15,99
812,15,98
813,16,99
814,17,100
815,16,99
816,17,100
817,16,100
818,15,99
819,14,98
820,13,97
821,14,98
822,13,98
823,12,97
824,11,96
825,11,95
826,10,95
827,9,96
828,8,95
829,8,96
830,8,97
831,8,96
832,8,95
833,7,95
834,8,94
835,9,95
836,10,96
837,10,97
838,11,96
839,11,97
840,11,97
841,10,97
842,10,96
843,11,97
844,12,96
845,13,96
846,13,95
847,12,94
848,11,95
849,12,96
850,12,96
851,11,96
852,10,95
853,9,95
854,10,94
855,11,94
856,12,94
857,13,95
858,13,96
859,13,97
860,13,98
861,12,97
862,13,98
863,14,97
864,15,97
865,15,98
866,16,97
867,17,98
868,18,97
869,18,98
870,18,97
871,18,97
872,19,96
873,19,97
874,20,98
875,20,98
876,19,98
877,18,98
878,17,97
879,18,96
880,19,96
881,18,97
882,17,96
883,18,97
884,17,96
885,16,96
886,17,96
887,17,96
888,17,97
889,16,98
890,17,97
891,18,96
892,18,97
893,17,97
894,16,98
895,15,97
896,16,96
897,16,95
898,16,94
899,16,95
900,16,96
901,15,96
902,15,96
903,15,95
904,14,95
905,14,94
906,13,93
907,13,94
908,12,93
909,11,92
910,10,91
911,9,90
912,9,90
913,8,90
914,8,90
915,9,90
916,9,89
917,8,89
918,9,89
919,10,90
920,10,90
921,11,90
922,10,89
923,9,89
924,8,89
925,7,88
926,7,88
927,8,88
928,8,88
929,7,88
930,8,87
931,8,87
932,7,86
933,8,86
934,7,86
935,6,87
936,7,88
937,8,88
938,9,88
939,10,89
940,9,89
941,9,88
942,9,89
943,10,90
944,9,89
945,9,90
946,10,90
947,11,91
948,11,90
949,12,91
950,12,91
951,12,91
952,13,91
953,13,90
954,14,91
955,15,90
956,16,89
957,17,90
958,17,91
959,17,90
960,18,91
961,19,91
962,18,92
963,17,91
964,16,92
965,17,91
966,17,91
967,17,91
968,16,91
969,16,92
970,17,91
971,16,90
972,17,91
973,18,90
974,17,89
975,16,89
976,17,88
977,18,88
978,19,87
979,19,87
980,18,88
981,18,89
982,18,89
983,17,88
984,17,89
985,17,90
986,17,91
987,17,90
988,16,91
989,16,92
990,17,92
991,18,91
992,18,90
993,17,90
994,17,89
995,16,89
996,15,88
997,14,89
998,13,90
999,13,91
1000,12,92
1001,12,91
1002,12,92
1003,11,92
1004,12,93
1005,12,93
1006,12,92
1007,12,92
1008,11,92
1009,12,91
1010,12,90
1011,12,90
1012,13,91
1013,13,91
1014,12,91
1015,11,91
1016,11,92
1017,12,91
1018,12,91
1019,13,92
1020,14,93
1021,13,94
1022,13,95
1023,12,95
1024,12,95
1025,12,94
1026,11,95
1027,10,95
1028,9,96
1029,9,95
1030,9,94
1031,10,94
1032,11,93
1033,11,94
1034,10,94
1035,9,93
1036,10,94
1037,10,93
1038,10,93
1039,10,93
1040,11,94
1041,10,93
1042,10,92
1043,11,93
1044,11,93
1045,11,92
1046,12,91
1047,12,92
1048,13,93
1049,14,92
1050,13,93
1051,14,93
1052,14,93
1053,14,92
1054,15,91
1055,15,90
1056,16,90
1057,16,91
1058,15,92
1059,14,91
1060,13,92
1061,14,92
1062,13,93
1063,12,92
1064,11,93
1065,11,93
1066,12,93
1067,13,92
1068,13,92
1069,14,91
1070,14,92
1071,13,92
1072,12,91
1073,11,92
1074,11,93
1075,11,93
1076,12,94
1077,13,93
1078,12,93
1079,11,94
1080,12,93
1081,13,94
1082,14,94
1083,13,95
1084,12,95
1085,12,96
1086,11,97
1087,11,98
1088,10,97
1089,10,98
1090,9,99
1091,8,100
1092,7,101
1093,6,101
1094,6,102
1095,7,102
1096,6,103
1097,5,102
1098,4,103
1099,5,103
1100,5,103
1101,6,102
1102,6,103
1103,7,103
1104,8,103
1105,8,104
1106,7,103
1107,8,103
1108,9,104
1109,9,104
1110,9,103
1111,10,103
1112,9,103
1113,8,104
1114,7,105
1115,7,104
1116,8,103
1117,7,103
1118,7,103
1119,6,104
1120,7,105
1121,8,105
1122,7,106
1123,7,106
1124,8,105
1125,9,106
1126,10,105
1127,11,104
1128,12,103
1129,11,104
1130,11,104
1131,11,103
1132,12,104
1133,13,104
1134,14,103
1135,13,102
1136,13,101
1137,12,100
1138,12,99
1139,12,99
1140,13,100
1141,14,101
1142,14,102
1143,14,102
1144,14,102
1145,13,101
1146,14,102
1147,14,103
1148,14,103
1149,13,104
1150,13,103
1151,14,103
1152,13,102
1153,14,101
1154,15,102
1155,14,102
1156,14,101
1157,14,101
1158,14,100
1159,13,99
1160,13,99
1161,12,98
1162,12,97
1163,11,98
1164,10,99
1165,10,100
1166,9,101
1167,10,102
1168,10,101
1169,10,101
1170,10,102
1171,11,102
1172,10,101
1173,10,100
1174,11,99
1175,12,100
1176,12,101
1177,12,101
1178,11,100
1179,11,100
1180,10,100
1181,9,99
1182,8,98
1183,8,99
1184,9,98
1185,8,98
1186,9,97
1187,10,96
1188,11,95
1189,11,95
1190,11,95
1191,11,95
1192,11,95
1193,11,96
1194,11,95
1195,12,94
1196,12,95
1197,13,96
1198,14,95
1199,15,96
1200,14,95
1201,14,94
1202,15,95
1203,15,96
1204,16,97
1205,16,96
1206,16,97
1207,17,97
1208,17,97
1209,16,98
1210,15,98
1211,14,97
1212,13,96
1213,14,95
1214,14,96
1215,15,97
1216,16,96
1217,17,96
1218,17,96
1219,18,97
1220,18,98
1221,19,97
1222,20,98
1223,20,97
1224,21,98
1225,21,98
1226,21,99
1227,20,98
1228,20,99
1229,19,99
1230,20,100
1231,19,99
1232,18,99
1233,19,99
1234,19,98
1235,19,99
1236,18,100
1237,18,99
1238,17,100
1239,16,100
1240,15,100
1241,14,100
1242,13,100
1243,13,99
1244,13,100
1245,13,99
1246,14,98
1247,14,98
1248,14,99
1249,13,99
1250,13,99
1251,13,98
1252,14,98
1253,13,99
1254,14,99
1255,13,99
1256,13,98
1257,12,99
1258,13,99
1259,14,98
1260,14,98
1261,14,99
1262,13,100
1263,13,99
1264,12,98
1265,13,97
1266,14,96
1267,15,95
1268,14,96
1269,15,97
1270,16,98
1271,17,98
1272,18,97
1273,17,98
1274,16,98
1275,15,97
1276,15,98
1277,14,97
1278,15,97
1279,16,97
1280,17,97
1281,18,97
1282,19,98
1283,19,98
1284,20,98
1285,21,98
1286,20,97
1287,19,97
1288,20,98
1289,20,97
1290,21,96
1291,20,97
1292,19,97
1293,20,97
1294,21,98
1295,20,99
1296,19,98
1297,20,97
1298,19,98
1299,19,99
1300,18,99
1301,19,99
1302,20,100
1303,20,100
1304,19,100
1305,18,101
1306,19,100
1307,18,99
1308,19,99
1309,19,98
1310,18,97
1311,18,97
1312,17,96
1313,18,95
1314,17,95
1315,16,94
1316,16,95
1317,16,95
1318,15,94
1319,16,93
1320,17,92
1321,17,93
1322,18,92
1323,18,93
1324,19,93
1325,19,94
1326,18,93
1327,19,92
1328,18,92
1329,17,93
1330,18,93
1331,17,92
1332,17,93
1333,16,94
1334,16,93
1335,17,94
1336,16,94
1337,16,94
1338,16,93
1339,15,93
1340,15,92
1341,14,92
1342,15,93
1343,16,92
1344,15,93
1345,14,94
1346,14,93
1347,13,93
1348,14,92
1349,15,93
1350,14,92
1351,13,93
1352,14,92
1353,14,92
1354,13,91
1355,13,91
1356,14,91
1357,14,91
1358,14,92
1359,15,91
1360,14,92
1361,15,92
1362,15,93
1363,14,93
1364,15,93
1365,14,92
1366,15,92
1367,15,91
1368,16,92
1369,16,91
1370,17,90
1371,18,89
1372,19,88
1373,19,87
1374,18,88
1375,19,87
1376,20,87
1377,20,87
1378,19,86
1379,20,86
1380,20,85
1381,19,85
1382,18,86
1383,17,87
1384,16,87
1385,16,87
1386,17,88
1387,16,89
1388,17,89
1389,18,90
1390,19,89
1391,18,89
1392,18,88
1393,18,87
1394,18,87
1395,18,86
1396,17,85
1397,16,86
1398,15,87
1399,14,88
1400,13,87
1401,12,86
1402,11,86
1403,10,85
1404,9,85
1405,8,84
1406,8,85
1407,8,85
1408,9,86
1409,9,86
1410,9,86
1411,9,87
1412,9,88
1413,8,88
1414,8,87
1415,7,87
1416,6,87
1417,6,87
1418,7,87
1419,7,88
1420,7,89
1421,8,89
1422,8,89
1423,8,90
1424,7,89
1425,8,90
1426,8,89
1427,7,90
1428,8,91
1429,7,90
1430,7,91
1431,8,90
1432,9,91
1433,8,91
1434,9,90
1435,8,91
1436,7,92
1437,8,92
1438,9,92
1439,9,93
1440,10,93
</pre>
<script type="text/javascript">
Highcharts.stockChart('container', {
chart: {
type: 'column',
zoomType: 'x'
},
legend: {
enabled: true,
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: 10,
y: 100,
borderWidth: 0
},
rangeSelector: {
allButtonsEnabled: true,
buttons: [{
count: 60,
type: 'minute',
text: '60M'
}, {
count: 24,
type: 'hour',
text: '24H'
}, {
type: 'all',
text: 'All'
}],
inputEnabled: false,
selected: 0
},
title: {
text: 'Activity'
},
subtitle: {
text: 'Data input from CSV'
},
data: {
csv: document.getElementById('csv').innerHTML
},
yAxis: [{
opposite: false
}, {
opposite: true
}],
xAxis: {
title: {
enabled: true,
text: 'Minutes'
},
type: 'datetime',
dateTimeLabelFormats: {
minute: '%M',
}
},
plotOptions: {
series: {
pointStart: 0, // start date
pointInterval: 1000 * 60 * 1, // data every 1 minutes
marker: {
enabled: true
}
},
column: {
stacking: 'normal',
}
},
series: [{
yAxis: 1,
type: 'line',
}, { yAxis: 0 },]
});
</script>
</body>
</html>
注意,在用于日期时间轴的Highharts中,X值是自1970年以来的时间戳,以毫秒为单位。因此,您的值不是分钟而是毫秒。
要实现所需的功能,必须映射CSV数据以制作分钟时间戳,并更改xAxis标签和工具提示内容显示日期的方式。检查下面的演示和代码。
代码:
xAxis: {
title: {
enabled: true,
text: 'Minutes'
},
type: 'datetime',
dateTimeLabelFormats: {
minute: '%M',
hour: '%H:%M',
day: '%H:%M',
week: '%e. %b',
month: '%b \'%y',
year: '%Y'
}
},
tooltip: {
formatter: function () {
const points = this.points;
return [
Highcharts.dateFormat('%H:%M', this.x),
'Series1: ' + points[0].y,
'Series2: ' + points[1].y
];
},
split: true
}
Demo:
API参考: