Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "Chart.js", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Simple HTML5 Charts using the canvas element", | ||
@@ -8,3 +8,3 @@ "homepage": "https://github.com/nnnick/Chart.js", | ||
"main": [ | ||
"Chart.js" | ||
"dist/Chart.js" | ||
], | ||
@@ -11,0 +11,0 @@ "devDependencies": { |
@@ -51,12 +51,12 @@ --- | ||
// String - cap style of the line. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap | ||
borderCapStyle: 'butt', | ||
borderCapStyle: 'butt', | ||
// Array - Length and spacing of dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash | ||
borderDash: [], | ||
// Array - Length and spacing of dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash | ||
borderDash: [], | ||
// Number - Offset for line dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset | ||
borderDashOffset: 0.0, | ||
// Number - Offset for line dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset | ||
borderDashOffset: 0.0, | ||
// String - line join style. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin | ||
borderJoinStyle: 'miter', | ||
// String - line join style. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin | ||
borderJoinStyle: 'miter', | ||
@@ -87,2 +87,5 @@ // String or array - Point stroke color | ||
// Number - the pixel size of the point shape. Can be set to 0 to not render a circle over the point | ||
radius: 1, | ||
// The actual data | ||
@@ -128,2 +131,5 @@ data: [65, 59, 80, 81, 56, 55, 40], | ||
*hover*.mode | String | "label" | Label's hover mode. "label" is used since the x axis displays data by the index in the dataset. | ||
elements | - | - | - | ||
*elements*.point | - | - | - | ||
*elements.point*.radius | Number | `3` | Defines the size of the Point shape. Can be set to zero to skip rendering a point. | ||
scales | - | - | - | ||
@@ -130,0 +136,0 @@ *scales*.xAxes | Array | `[{type:"category","id":"x-axis-1"}]` | Defines all of the x axes used in the chart. See the [scale documentation](#getting-started-scales) for details on the available options. |
@@ -5,3 +5,3 @@ { | ||
"description": "Simple HTML5 charts using the canvas element.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "src/chart.js", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -29,2 +29,3 @@ /*global window: false */ | ||
dropFrames: 0, | ||
request: null, | ||
addAnimation: function(chartInstance, animationObject, duration, lazy) { | ||
@@ -51,3 +52,3 @@ | ||
if (this.animations.length === 1) { | ||
helpers.requestAnimFrame.call(window, this.digestWrapper); | ||
this.requestAnimationFrame(); | ||
} | ||
@@ -66,5 +67,13 @@ }, | ||
}, | ||
// calls startDigest with the proper context | ||
digestWrapper: function() { | ||
Chart.animationService.startDigest.call(Chart.animationService); | ||
requestAnimationFrame: function() { | ||
var me = this; | ||
if (me.request === null) { | ||
// Skip animation frame requests until the active one is executed. | ||
// This can happen when processing mouse events, e.g. 'mousemove' | ||
// and 'mouseout' events will trigger multiple renders. | ||
me.request = helpers.requestAnimFrame.call(window, function() { | ||
me.request = null; | ||
me.startDigest(); | ||
}); | ||
} | ||
}, | ||
@@ -119,3 +128,3 @@ startDigest: function() { | ||
if (this.animations.length > 0) { | ||
helpers.requestAnimFrame.call(window, this.digestWrapper); | ||
this.requestAnimationFrame(); | ||
} | ||
@@ -122,0 +131,0 @@ } |
@@ -833,9 +833,14 @@ /*global window: false */ | ||
helpers.each(arrayOfStrings, function(string) { | ||
var textWidth = cache.data[string]; | ||
if (!textWidth) { | ||
textWidth = cache.data[string] = ctx.measureText(string).width; | ||
cache.garbageCollect.push(string); | ||
// Undefined strings should not be measured | ||
if (string !== undefined && string !== null) { | ||
var textWidth = cache.data[string]; | ||
if (!textWidth) { | ||
textWidth = cache.data[string] = ctx.measureText(string).width; | ||
cache.garbageCollect.push(string); | ||
} | ||
if (textWidth > longest) { | ||
longest = textWidth; | ||
} | ||
} | ||
if (textWidth > longest) | ||
longest = textWidth; | ||
}); | ||
@@ -871,2 +876,8 @@ | ||
} | ||
/* global CanvasGradient */ | ||
if (c instanceof CanvasGradient) { | ||
return color(Chart.defaults.global.defaultColor); | ||
} | ||
return color(c); | ||
@@ -941,2 +952,2 @@ }; | ||
}; | ||
}; |
@@ -89,7 +89,7 @@ "use strict"; | ||
for (var i = 0; i < chart.data.datasets.length; i++) { | ||
text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '">'); | ||
text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '"></span>'); | ||
if (chart.data.datasets[i].label) { | ||
text.push(chart.data.datasets[i].label); | ||
} | ||
text.push('</span></li>'); | ||
text.push('</li>'); | ||
} | ||
@@ -105,2 +105,2 @@ text.push('</ul>'); | ||
}; | ||
}; |
@@ -667,2 +667,19 @@ describe('Core helper tests', function() { | ||
describe('Color helper', function() { | ||
function isColorInstance(obj) { | ||
return typeof obj === 'object' && obj.hasOwnProperty('values') && obj.values.hasOwnProperty('rgb'); | ||
} | ||
it('should return a color when called with a color', function() { | ||
expect(isColorInstance(helpers.color('rgb(1, 2, 3)'))).toBe(true); | ||
}); | ||
it('should return a color when called with a CanvasGradient instance', function() { | ||
var context = document.createElement('canvas').getContext('2d'); | ||
var gradient = context.createLinearGradient(0, 1, 2, 3); | ||
expect(isColorInstance(helpers.color(gradient))).toBe(true); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1846376
113
38315
1