-
Notifications
You must be signed in to change notification settings - Fork 0
/
Line.js
43 lines (32 loc) · 1022 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
35
36
37
38
39
40
41
42
43
class Line extends Bar{
display(){
textFont("staatliches");
textAlign(CENTER,CENTER);
push();
translate(this.position.x-(this.bsWidth/2),this.position.y);
this.update();
for(var i=0;i<this.nbSet;i++){
let bright = this.b-((this.b/this.nbSet)*i);
fill(this.h,this.s,bright);
let posx = ((i*this.bWidth)+(this.shiftx*i))+(this.bWidth/2)-(this.shiftx*i/2);
ellipse(posx,-this.barheights[i],5,5);
if(i>0){
this.prevPosx = (((i-1)*this.bWidth)+(this.shiftx*(i-1)))+(this.bWidth/2)-(this.shiftx*(i-1)/2);
// console.log(this.prevPosx,posx);
stroke(0);
line(this.prevPosx,-this.barheights[i-1],posx,-this.barheights[i]);
}
//
noStroke();
fill(this.h,this.s,this.b,0.2);
rect((i*this.bWidth)+(this.shiftx*i)/2,0,this.bWidth,-this.barheights[i]);
fill(this.h,this.s,bright);
textSize(this.bWidth/3.5);
//Labels
text(this.labels[i],posx,-this.barheights[i]-20);
//Legends
this.wlegends(i,posx);
}
pop();
}
}