mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
make charts dependent on calculated width
This commit is contained in:
parent
dc2ebab883
commit
657e53c117
16
Chart.js
vendored
16
Chart.js
vendored
@ -25,8 +25,20 @@
|
||||
this.ctx = context;
|
||||
|
||||
//Variables global to the chart
|
||||
var width = this.width = context.canvas.width;
|
||||
var height = this.height = context.canvas.height;
|
||||
var computeDimension = function(element,dimension)
|
||||
{
|
||||
if (element['offset'+dimension])
|
||||
{
|
||||
return element['offset'+dimension];
|
||||
}
|
||||
else
|
||||
{
|
||||
return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
|
||||
}
|
||||
}
|
||||
|
||||
var width = this.width = computeDimension(context.canvas,'Width');
|
||||
var height = this.height = computeDimension(context.canvas,'Height');
|
||||
this.aspectRatio = this.width / this.height;
|
||||
//High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale.
|
||||
helpers.retinaScale(this);
|
||||
|
Loading…
Reference in New Issue
Block a user