mirror of https://github.com/ColorlibHQ/AdminLTE
commit
477c0ec8af
|
@ -1,7 +1,7 @@
|
||||||
/*!
|
/*!
|
||||||
* Chart.js
|
* Chart.js
|
||||||
* http://chartjs.org/
|
* http://chartjs.org/
|
||||||
* Version: 1.0.1
|
* Version: 1.0.2
|
||||||
*
|
*
|
||||||
* Copyright 2015 Nick Downie
|
* Copyright 2015 Nick Downie
|
||||||
* Released under the MIT license
|
* Released under the MIT license
|
||||||
|
@ -25,6 +25,25 @@
|
||||||
this.ctx = context;
|
this.ctx = context;
|
||||||
|
|
||||||
//Variables global to the chart
|
//Variables global to the chart
|
||||||
|
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');
|
||||||
|
|
||||||
|
// Firefox requires this to work correctly
|
||||||
|
context.canvas.width = width;
|
||||||
|
context.canvas.height = height;
|
||||||
|
|
||||||
var width = this.width = context.canvas.width;
|
var width = this.width = context.canvas.width;
|
||||||
var height = this.height = context.canvas.height;
|
var height = this.height = context.canvas.height;
|
||||||
this.aspectRatio = this.width / this.height;
|
this.aspectRatio = this.width / this.height;
|
||||||
|
@ -825,7 +844,7 @@
|
||||||
},
|
},
|
||||||
stop : function(){
|
stop : function(){
|
||||||
// Stops any current animation loop occuring
|
// Stops any current animation loop occuring
|
||||||
helpers.cancelAnimFrame.call(root, this.animationFrame);
|
cancelAnimFrame(this.animationFrame);
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
resize : function(callback){
|
resize : function(callback){
|
||||||
|
@ -1368,7 +1387,6 @@
|
||||||
var halfHeight = this.height/2;
|
var halfHeight = this.height/2;
|
||||||
|
|
||||||
//Check to ensure the height will fit on the canvas
|
//Check to ensure the height will fit on the canvas
|
||||||
//The three is to buffer form the very
|
|
||||||
if (this.y - halfHeight < 0 ){
|
if (this.y - halfHeight < 0 ){
|
||||||
this.y = halfHeight;
|
this.y = halfHeight;
|
||||||
} else if (this.y + halfHeight > this.chart.height){
|
} else if (this.y + halfHeight > this.chart.height){
|
||||||
|
@ -1575,7 +1593,7 @@
|
||||||
var isRotated = (this.xLabelRotation > 0),
|
var isRotated = (this.xLabelRotation > 0),
|
||||||
// innerWidth = (this.offsetGridLines) ? this.width - offsetLeft - this.padding : this.width - (offsetLeft + halfLabelWidth * 2) - this.padding,
|
// innerWidth = (this.offsetGridLines) ? this.width - offsetLeft - this.padding : this.width - (offsetLeft + halfLabelWidth * 2) - this.padding,
|
||||||
innerWidth = this.width - (this.xScalePaddingLeft + this.xScalePaddingRight),
|
innerWidth = this.width - (this.xScalePaddingLeft + this.xScalePaddingRight),
|
||||||
valueWidth = innerWidth/(this.valuesCount - ((this.offsetGridLines) ? 0 : 1)),
|
valueWidth = innerWidth/Math.max((this.valuesCount - ((this.offsetGridLines) ? 0 : 1)), 1),
|
||||||
valueOffset = (valueWidth * index) + this.xScalePaddingLeft;
|
valueOffset = (valueWidth * index) + this.xScalePaddingLeft;
|
||||||
|
|
||||||
if (this.offsetGridLines){
|
if (this.offsetGridLines){
|
||||||
|
@ -2416,12 +2434,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
calculateCircumference : function(value){
|
calculateCircumference : function(value){
|
||||||
return (Math.PI*2)*(value / this.total);
|
return (Math.PI*2)*(Math.abs(value) / this.total);
|
||||||
},
|
},
|
||||||
calculateTotal : function(data){
|
calculateTotal : function(data){
|
||||||
this.total = 0;
|
this.total = 0;
|
||||||
helpers.each(data,function(segment){
|
helpers.each(data,function(segment){
|
||||||
this.total += segment.value;
|
this.total += Math.abs(segment.value);
|
||||||
},this);
|
},this);
|
||||||
},
|
},
|
||||||
update : function(){
|
update : function(){
|
||||||
|
@ -3061,6 +3079,8 @@
|
||||||
helpers.each(this.segments,function(segment){
|
helpers.each(this.segments,function(segment){
|
||||||
segment.save();
|
segment.save();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.reflow();
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
reflow : function(){
|
reflow : function(){
|
||||||
|
|
Loading…
Reference in New Issue