mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 20:29:12 +02:00
Merge pull request #1485 from BenWoodford/label-patches
Label customisation fixes
This commit is contained in:
commit
d1067f956c
@ -147,7 +147,7 @@
|
|||||||
var datasetWidth = Math.floor(this.getPixelForValue(0, 1) - this.getPixelForValue(0, 0)) - 6;
|
var datasetWidth = Math.floor(this.getPixelForValue(0, 1) - this.getPixelForValue(0, 0)) - 6;
|
||||||
|
|
||||||
//Max label rotation can be set or default to 90 - also act as a loop counter
|
//Max label rotation can be set or default to 90 - also act as a loop counter
|
||||||
while (this.labelWidth > datasetWidth && this.labelRotation <= this.options.labels.maxRotation) {
|
while (this.labelWidth > datasetWidth && this.labelRotation < this.options.labels.maxRotation) {
|
||||||
cosRotation = Math.cos(helpers.toRadians(this.labelRotation));
|
cosRotation = Math.cos(helpers.toRadians(this.labelRotation));
|
||||||
sinRotation = Math.sin(helpers.toRadians(this.labelRotation));
|
sinRotation = Math.sin(helpers.toRadians(this.labelRotation));
|
||||||
|
|
||||||
@ -303,7 +303,7 @@
|
|||||||
|
|
||||||
if (this.options.labels.show) {
|
if (this.options.labels.show) {
|
||||||
this.ctx.save();
|
this.ctx.save();
|
||||||
this.ctx.translate(xLabelValue, (isRotated) ? this.top + 12 : this.top + 8);
|
this.ctx.translate(xLabelValue, (isRotated) ? this.top + 12 + this.options.labels.padding : this.top + this.options.labels.padding);
|
||||||
this.ctx.rotate(helpers.toRadians(this.labelRotation) * -1);
|
this.ctx.rotate(helpers.toRadians(this.labelRotation) * -1);
|
||||||
this.ctx.font = this.font;
|
this.ctx.font = this.font;
|
||||||
this.ctx.textAlign = (isRotated) ? "right" : "center";
|
this.ctx.textAlign = (isRotated) ? "right" : "center";
|
||||||
|
Loading…
Reference in New Issue
Block a user