-
Notifications
You must be signed in to change notification settings - Fork 0
/
showLineChart.js
106 lines (104 loc) · 1.92 KB
/
showLineChart.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import ApexCharts from "https://code4fukui.github.io/apexcharts.js/ApexCharts.js";
import { annotations } from "./annotations.js";
import { DateTime } from "https://js.sabae.cc/DateTime.js";
export const showLineChart = (divlinechart, series, height = 350) => {
const options = {
series,
annotations,
chart: {
height,
type: "line",
toolbar: {
show: true
},
animations: {
enabled: false,
},
},
//colors: ['#77B6EA', '#545454'],
/*
dataLabels: {
enabled: true,
},
*/
stroke: {
width: 2,
curve: "straight",
},
/*
title: {
text: title || "",
align: "center",
},
*/
/*
grid: {
borderColor: '#e7e7e7',
row: {
colors: ['#f3f3f3', 'transparent'], // takes an array which will be repeated on columns
opacity: 0.5
},
},
*/
/*
markers: {
size: 1
},
*/
/*
xaxis: {
categories: months.map(i => Math.floor(i / 100) + "/" + i % 100),
title: {
text: 'Month'
}
},
*/
xaxis: {
type: 'datetime',
labels: {
datetimeUTC: false,
datetimeFormatter: {
year: 'yyyy',
month: 'yyyy/M',
day: 'M/d',
hour: 'HH:mm',
}
}
},
/*
yaxis: {
title: {
text: 'Temperature'
},
min: 5,
max: 40
},
*/
legend: {
position: "top",
horizontalAlign: "center",
showForSingleSeries: true,
//offsetY: -25,
//offsetX: -5
},
tooltip: {
x: {
formatter: val => {
return new DateTime(val).toString();
},
},
},
/*
tooltip: {
y: {
formatter: (v) => {
return Num.addComma(v) + "人";
},
}
},
*/
};
const chart = new ApexCharts(divlinechart, options);
chart.render();
return chart;
};