Merge pull request #553 from masteradhoc/patch-1

Update ChartJS to 1.0.2
pull/564/head
Abdullah Almsaeed 2015-07-08 16:58:53 -04:00
commit 477c0ec8af
1 changed files with 27 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/*!
* Chart.js
* http://chartjs.org/
* Version: 1.0.1
* Version: 1.0.2
*
* Copyright 2015 Nick Downie
* Released under the MIT license
@ -25,6 +25,25 @@
this.ctx = context;
//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 height = this.height = context.canvas.height;
this.aspectRatio = this.width / this.height;
@ -825,7 +844,7 @@
},
stop : function(){
// Stops any current animation loop occuring
helpers.cancelAnimFrame.call(root, this.animationFrame);
cancelAnimFrame(this.animationFrame);
return this;
},
resize : function(callback){
@ -1368,7 +1387,6 @@
var halfHeight = this.height/2;
//Check to ensure the height will fit on the canvas
//The three is to buffer form the very
if (this.y - halfHeight < 0 ){
this.y = halfHeight;
} else if (this.y + halfHeight > this.chart.height){
@ -1575,7 +1593,7 @@
var isRotated = (this.xLabelRotation > 0),
// innerWidth = (this.offsetGridLines) ? this.width - offsetLeft - this.padding : this.width - (offsetLeft + halfLabelWidth * 2) - this.padding,
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;
if (this.offsetGridLines){
@ -2416,12 +2434,12 @@
}
},
calculateCircumference : function(value){
return (Math.PI*2)*(value / this.total);
return (Math.PI*2)*(Math.abs(value) / this.total);
},
calculateTotal : function(data){
this.total = 0;
helpers.each(data,function(segment){
this.total += segment.value;
this.total += Math.abs(segment.value);
},this);
},
update : function(){
@ -3061,6 +3079,8 @@
helpers.each(this.segments,function(segment){
segment.save();
});
this.reflow();
this.render();
},
reflow : function(){
@ -3454,4 +3474,4 @@
}).call(this);
}).call(this);