-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust the size of rectRounded/rectRot point to fit pointRadius
- Calculate the vertices of the shapes so that they are inscribed in the circle that has the radius of `pointRadius` - Remove `translate()` and `rotate()` to fix the regression introduced by #5319 - Refactor `rectRounded` for better performance
- Loading branch information
Showing
12 changed files
with
237 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var gradient; | ||
|
||
var datasets = ['circle', 'cross', 'crossRot', 'dash', 'line', 'rect', 'rectRounded', 'rectRot', 'star', 'triangle'].map(function(style, y) { | ||
return { | ||
pointStyle: style, | ||
data: Array.apply(null, Array(17)).map(function(v, x) { | ||
return {x: x, y: 10 - y}; | ||
}) | ||
}; | ||
}); | ||
|
||
var angles = Array.apply(null, Array(17)).map(function(v, i) { | ||
return -180 + i * 22.5; | ||
}); | ||
|
||
module.exports = { | ||
config: { | ||
type: 'bubble', | ||
data: { | ||
datasets: datasets | ||
}, | ||
options: { | ||
responsive: false, | ||
legend: false, | ||
title: false, | ||
elements: { | ||
point: { | ||
rotation: angles, | ||
radius: 10, | ||
backgroundColor: function(context) { | ||
if (!gradient) { | ||
gradient = context.chart.ctx.createLinearGradient(0, 0, 512, 256); | ||
gradient.addColorStop(0, '#ff0000'); | ||
gradient.addColorStop(1, '#0000ff'); | ||
} | ||
return gradient; | ||
}, | ||
borderColor: '#cccccc' | ||
} | ||
}, | ||
layout: { | ||
padding: 20 | ||
}, | ||
scales: { | ||
xAxes: [{display: false}], | ||
yAxes: [{display: false}] | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
var roundedRect = Chart.helpers.canvas.roundedRect; | ||
|
||
module.exports = { | ||
config: { | ||
type: 'line', | ||
plugins: [{ | ||
afterDraw: function(chart) { | ||
var ctx = chart.ctx; | ||
ctx.strokeStyle = '#0000ff'; | ||
ctx.lineWidth = 4; | ||
ctx.fillStyle = '#00ff00'; | ||
ctx.beginPath(); | ||
roundedRect(ctx, 10, 10, 50, 50, 25); | ||
roundedRect(ctx, 70, 10, 100, 50, 25); | ||
roundedRect(ctx, 10, 70, 50, 100, 25); | ||
roundedRect(ctx, 70, 70, 100, 100, 25); | ||
roundedRect(ctx, 180, 10, 50, 50, 100); | ||
roundedRect(ctx, 240, 10, 100, 50, 100); | ||
roundedRect(ctx, 180, 70, 50, 100, 100); | ||
roundedRect(ctx, 240, 70, 100, 100, 100); | ||
roundedRect(ctx, 350, 10, 50, 50, 0); | ||
ctx.fill(); | ||
ctx.stroke(); | ||
} | ||
}], | ||
options: { | ||
scales: { | ||
xAxes: [{display: false}], | ||
yAxes: [{display: false}] | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.