Skip to content

Commit 38d1b87

Browse files
committed
Adhere to pointDot option in config
- Added `display` property on Point classes, to determine whether the draw sequence should run or not.
1 parent 28dd492 commit 38d1b87

File tree

5 files changed

+28
-22
lines changed

5 files changed

+28
-22
lines changed

Chart.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,20 +1047,21 @@
10471047
return ((Math.pow(chartX-this.x, 2)+Math.pow(chartY-this.y, 2)) < Math.pow(hitDetectionRange,2));
10481048
},
10491049
draw : function(){
1050-
var ctx = this.ctx;
1051-
ctx.beginPath();
1052-
1053-
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
1054-
ctx.closePath();
1050+
if (this.display){
1051+
var ctx = this.ctx;
1052+
ctx.beginPath();
10551053

1056-
ctx.strokeStyle = this.strokeColor;
1057-
ctx.lineWidth = this.strokeWidth;
1054+
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
1055+
ctx.closePath();
10581056

1059-
ctx.fillStyle = this.fillColor;
1057+
ctx.strokeStyle = this.strokeColor;
1058+
ctx.lineWidth = this.strokeWidth;
10601059

1061-
ctx.fill();
1062-
ctx.stroke();
1060+
ctx.fillStyle = this.fillColor;
10631061

1062+
ctx.fill();
1063+
ctx.stroke();
1064+
}
10641065

10651066

10661067
//Quick debug for bezier curve splining
@@ -2419,6 +2420,7 @@
24192420
this.PointClass = Chart.Point.extend({
24202421
strokeWidth : this.options.pointDotStrokeWidth,
24212422
radius : this.options.pointDotRadius,
2423+
display: this.options.pointDot,
24222424
hitDetectionRadius : this.options.pointHitDetectionRadius,
24232425
ctx : this.chart.ctx,
24242426
inRange : function(mouseX){
@@ -3023,6 +3025,7 @@
30233025
this.PointClass = Chart.Point.extend({
30243026
strokeWidth : this.options.pointDotStrokeWidth,
30253027
radius : this.options.pointDotRadius,
3028+
display: this.options.pointDot,
30263029
hitDetectionRadius : this.options.pointHitDetectionRadius,
30273030
ctx : this.chart.ctx
30283031
});

Chart.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Chart.Core.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,20 +1047,21 @@
10471047
return ((Math.pow(chartX-this.x, 2)+Math.pow(chartY-this.y, 2)) < Math.pow(hitDetectionRange,2));
10481048
},
10491049
draw : function(){
1050-
var ctx = this.ctx;
1051-
ctx.beginPath();
1052-
1053-
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
1054-
ctx.closePath();
1050+
if (this.display){
1051+
var ctx = this.ctx;
1052+
ctx.beginPath();
10551053

1056-
ctx.strokeStyle = this.strokeColor;
1057-
ctx.lineWidth = this.strokeWidth;
1054+
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
1055+
ctx.closePath();
10581056

1059-
ctx.fillStyle = this.fillColor;
1057+
ctx.strokeStyle = this.strokeColor;
1058+
ctx.lineWidth = this.strokeWidth;
10601059

1061-
ctx.fill();
1062-
ctx.stroke();
1060+
ctx.fillStyle = this.fillColor;
10631061

1062+
ctx.fill();
1063+
ctx.stroke();
1064+
}
10641065

10651066

10661067
//Quick debug for bezier curve splining

src/Chart.Line.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
this.PointClass = Chart.Point.extend({
5858
strokeWidth : this.options.pointDotStrokeWidth,
5959
radius : this.options.pointDotRadius,
60+
display: this.options.pointDot,
6061
hitDetectionRadius : this.options.pointHitDetectionRadius,
6162
ctx : this.chart.ctx,
6263
inRange : function(mouseX){

src/Chart.Radar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
this.PointClass = Chart.Point.extend({
7171
strokeWidth : this.options.pointDotStrokeWidth,
7272
radius : this.options.pointDotRadius,
73+
display: this.options.pointDot,
7374
hitDetectionRadius : this.options.pointHitDetectionRadius,
7475
ctx : this.chart.ctx
7576
});

0 commit comments

Comments
 (0)