-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathline.js
34 lines (25 loc) · 815 Bytes
/
line.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
import Chart from "./chart";
export default class LineChart extends Chart {
render() {
super.render();
var numArr = [];
var markerPathArr = [];
this.dataPath = "M" + numArr.join("L ");
this.markerPathArr = markerPathArr;
this.series[0].data.forEach((e, i) => {
let x = i * 50;
let y = e * this.stepLength;
numArr.push(x + " " + y + " ");
let markerArr = [];
let markerCorner = 20;
for (let j=0; j<markerCorner; j++) {
let m = x + 5 * Math.cos((j / markerCorner) * (2 * Math.PI));
let n = y + 5 * Math.sin((j / markerCorner) * (2 * Math.PI));
markerArr.push(m + " " + n + " ");
}
markerPathArr.push("M" + markerArr.join("L "));
});
this.dataPath = "M" + numArr.join("L ");
this.markerPathArr = markerPathArr;
}
}