Comparar commits

...

19 Commits

Autor SHA1 Mensagem Data
Nick Downie 02e535cdad Update bower & package.json with version bump
Forget this literally every time…
2014-07-02 21:51:31 +01:00
Nick Downie 3e1b120cbe Build latest output files for new version 2014-07-02 21:42:10 +01:00
Nick Downie 95844701bd Mention not committing built files in README.md 2014-07-02 21:39:44 +01:00
Nick Downie 403b6751ab Change case of README file 2014-07-02 21:38:14 +01:00
Nick Downie 2b81ac832a Merge pull request #415 from nnnick/fix/radar-chart-scale-updates
Reflow the Radar before updating to update scale
2014-07-02 21:36:51 +01:00
Nick Downie 3f9e5ab7a2 Merge pull request #414 from nnnick/feature/dataset-label-tooltip
Add datasetLabel to elements for tooltip templates
2014-07-02 21:36:39 +01:00
Nick Downie 23deaa9307 Merge pull request #413 from nnnick/fix/sparse-dataset-tooltip
Prevent spare datasets from breaking MultiTooltips
2014-07-02 21:36:28 +01:00
Nick Downie 2183d09b58 Merge pull request #409 from BrettBukowski/commonjs
Add support for CommonJS module definition
2014-07-02 21:36:17 +01:00
Nick Downie ea9d144c71 Reflow the Radar before updating to update scale 2014-07-02 21:28:59 +01:00
Nick Downie 7a23131366 Add datasetLabel to elements for tooltip templates 2014-07-02 21:27:03 +01:00
Nick Downie d7632efe65 Prevent spare datasets from breaking MultiTooltips 2014-07-02 21:09:04 +01:00
Brett Bukowski 477e09f1d4 Add support for CommonJS module definition 2014-07-01 15:39:28 -06:00
Nick Downie 641fc02212 1.0.1-beta Update for bower/package.json 2014-07-01 11:02:28 +01:00
Nick Downie a55fdaad57 Merge pull request #402 from nnnick/fix/point-dot-option
Fix option for pointDot not being obeyed
2014-06-30 22:12:27 +01:00
Nick Downie d006558e69 Merge pull request #392 from jbrooksuk/doc-update
Make javascript JavaScript and Github GitHub
2014-06-30 22:02:33 +01:00
Nick Downie 29ae3200a7 Default display of chart point to true 2014-06-30 21:54:24 +01:00
Nick Downie 38d1b87e1c Adhere to pointDot option in config
- Added `display` property on Point classes, to determine whether the
draw sequence should run or not.
2014-06-30 20:24:47 +01:00
James Brooks e139ab8596 Make javascript JavaScript and Github GitHub 2014-06-30 11:50:35 +01:00
Nick Downie 28dd492460 Extending chart types docs typo error 2014-06-30 10:04:01 +01:00
12 arquivos alterados com 59 adições e 39 exclusões
externo
+24 -14
Ver Arquivo
@@ -873,7 +873,9 @@
yMin;
helpers.each(this.datasets, function(dataset){
dataCollection = dataset.points || dataset.bars || dataset.segments;
Elements.push(dataCollection[dataIndex]);
if (dataCollection[dataIndex]){
Elements.push(dataCollection[dataIndex]);
}
});
helpers.each(Elements, function(element) {
@@ -1042,25 +1044,27 @@
Chart.Point = Chart.Element.extend({
inRange : function(chartX,chartY){
display: true,
inRange: function(chartX,chartY){
var hitDetectionRange = this.hitDetectionRadius + this.radius;
return ((Math.pow(chartX-this.x, 2)+Math.pow(chartY-this.y, 2)) < Math.pow(hitDetectionRange,2));
},
draw : function(){
var ctx = this.ctx;
ctx.beginPath();
if (this.display){
var ctx = this.ctx;
ctx.beginPath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
ctx.closePath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
ctx.closePath();
ctx.strokeStyle = this.strokeColor;
ctx.lineWidth = this.strokeWidth;
ctx.strokeStyle = this.strokeColor;
ctx.lineWidth = this.strokeWidth;
ctx.fillStyle = this.fillColor;
ctx.fill();
ctx.stroke();
ctx.fillStyle = this.fillColor;
ctx.fill();
ctx.stroke();
}
//Quick debug for bezier curve splining
@@ -1871,6 +1875,8 @@
define(function(){
return Chart;
});
} else if (typeof module === 'object' && module.exports) {
module.exports = Chart;
}
root.Chart = Chart;
@@ -1992,6 +1998,7 @@
datasetObject.bars.push(new this.BarClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : dataset.strokeColor,
fillColor : dataset.fillColor,
highlightFill : dataset.highlightFill || dataset.fillColor,
@@ -2419,6 +2426,7 @@
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
hitDetectionRadius : this.options.pointHitDetectionRadius,
ctx : this.chart.ctx,
inRange : function(mouseX){
@@ -2465,8 +2473,7 @@
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
// x: this.scale.calculateX(index),
// y: this.scale.endPoint,
datasetLabel: dataset.label,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
@@ -3023,6 +3030,7 @@
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
hitDetectionRadius : this.options.pointHitDetectionRadius,
ctx : this.chart.ctx
});
@@ -3073,6 +3081,7 @@
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
x: (this.options.animation) ? this.scale.xCenter : pointPosition.x,
y: (this.options.animation) ? this.scale.yCenter : pointPosition.y,
strokeColor : dataset.pointStrokeColor,
@@ -3227,6 +3236,7 @@
this.eachPoints(function(point){
point.save();
});
this.reflow();
this.render();
},
reflow: function(){
+2 -2
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+2 -1
Ver Arquivo
@@ -22,4 +22,5 @@ New contributions to the library are welcome, just a couple of guidelines:
- Please ensure you're changing the individual files in `/src`, not the concatenated output in the `Chart.js` file in the root of the repo.
- Please check that your code will pass `jshint` code standards, `gulp jshint` will run this for you.
- Please keep pull requests concise, and document new functionality in the relevant `.md` file.
- Consider whether your changes are useful for all users, or if creating a Chart.js extension would be more appropriate.
- Consider whether your changes are useful for all users, or if creating a Chart.js extension would be more appropriate.
- Please avoid committing in the build Chart.js & Chart.min.js file, as it causes conflicts when merging.
+1 -1
Ver Arquivo
@@ -1,6 +1,6 @@
{
"name": "Chart.js",
"version": "1.0.0-beta",
"version": "1.0.1-beta.2",
"description": "Simple HTML5 Charts using the canvas element",
"homepage": "https://github.com/nnnick/Chart.js",
"author": "nnnick",
+1 -1
Ver Arquivo
@@ -11,7 +11,7 @@ First we need to include the Chart.js library on the page. The library occupies
<script src="Chart.js"></script>
```
Alternatively, if you're using an AMD loader for javascript modules, that is also supported in the Chart.js core. Please note: the library will still occupy a global variable of `Chart`, even if it detects `define` and `define.amd`. If this is a problem, you can call `noConflict` to restore the global Chart variable to it's previous owner.
Alternatively, if you're using an AMD loader for JavaScript modules, that is also supported in the Chart.js core. Please note: the library will still occupy a global variable of `Chart`, even if it detects `define` and `define.amd`. If this is a problem, you can call `noConflict` to restore the global Chart variable to it's previous owner.
```javascript
// Using requirejs
+3 -3
Ver Arquivo
@@ -111,7 +111,7 @@ Chart.types.Line.extend({
name: "LineAlt",
initialize: function(data){
console.log('My Line chart extension');
Chart.types.Line.prototype.apply(this, arguments);
Chart.types.Line.prototype.initialize.apply(this, arguments);
}
});
@@ -122,7 +122,7 @@ new Chart(ctx).LineAlt(data);
### Creating custom builds
Chart.js uses <a href="http://gulpjs.com/" target="_blank">gulp</a> to build the library into a single javascript file. We can use this same build script with custom parameters in order to build a custom version.
Chart.js uses <a href="http://gulpjs.com/" target="_blank">gulp</a> to build the library into a single JavaScript file. We can use this same build script with custom parameters in order to build a custom version.
Firstly, we need to ensure development dependencies are installed. With node and npm installed, after cloning the Chart.js repo to a local directory, and navigating to that directory in the command line, we can run the following:
@@ -131,7 +131,7 @@ npm install
npm install -g gulp
```
This will install the local development dependencies for Chart.js, along with a CLI for the javascript task runner <a href="http://gulpjs.com/" target="_blank">gulp</a>.
This will install the local development dependencies for Chart.js, along with a CLI for the JavaScript task runner <a href="http://gulpjs.com/" target="_blank">gulp</a>.
Now, we can run the `gulp build` task, and pass in a comma seperated list of types as an argument to build a custom version of Chart.js with only specified chart types.
+1 -1
Ver Arquivo
@@ -26,7 +26,7 @@ Some important points to note in my experience using ExplorerCanvas as a fallbac
### Bugs & issues
Please report these on the Github page - at <a href="https://github.com/nnnick/Chart.js" target="_blank">github.com/nnnick/Chart.js</a>. If you could include a link to a simple <a href="http://jsbin.com/" target="_blank">jsbin</a> or similar to demonstrate the issue, that'd be really helpful.
Please report these on the GitHub page - at <a href="https://github.com/nnnick/Chart.js" target="_blank">github.com/nnnick/Chart.js</a>. If you could include a link to a simple <a href="http://jsbin.com/" target="_blank">jsbin</a> or similar to demonstrate the issue, that'd be really helpful.
### Contributing
+1 -2
Ver Arquivo
@@ -2,8 +2,7 @@
"name": "Chart.js",
"homepage": "http://www.chartjs.org",
"description": "Simple HTML5 charts using the canvas element.",
"private": true,
"version": "1.0.0-beta",
"version": "1.0.1-beta.2",
"repository": {
"type": "git",
"url": "https://github.com/nnnick/Chart.js.git"
+1
Ver Arquivo
@@ -109,6 +109,7 @@
datasetObject.bars.push(new this.BarClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : dataset.strokeColor,
fillColor : dataset.fillColor,
highlightFill : dataset.highlightFill || dataset.fillColor,
+18 -12
Ver Arquivo
@@ -873,7 +873,9 @@
yMin;
helpers.each(this.datasets, function(dataset){
dataCollection = dataset.points || dataset.bars || dataset.segments;
Elements.push(dataCollection[dataIndex]);
if (dataCollection[dataIndex]){
Elements.push(dataCollection[dataIndex]);
}
});
helpers.each(Elements, function(element) {
@@ -1042,25 +1044,27 @@
Chart.Point = Chart.Element.extend({
inRange : function(chartX,chartY){
display: true,
inRange: function(chartX,chartY){
var hitDetectionRange = this.hitDetectionRadius + this.radius;
return ((Math.pow(chartX-this.x, 2)+Math.pow(chartY-this.y, 2)) < Math.pow(hitDetectionRange,2));
},
draw : function(){
var ctx = this.ctx;
ctx.beginPath();
if (this.display){
var ctx = this.ctx;
ctx.beginPath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
ctx.closePath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);
ctx.closePath();
ctx.strokeStyle = this.strokeColor;
ctx.lineWidth = this.strokeWidth;
ctx.strokeStyle = this.strokeColor;
ctx.lineWidth = this.strokeWidth;
ctx.fillStyle = this.fillColor;
ctx.fill();
ctx.stroke();
ctx.fillStyle = this.fillColor;
ctx.fill();
ctx.stroke();
}
//Quick debug for bezier curve splining
@@ -1871,6 +1875,8 @@
define(function(){
return Chart;
});
} else if (typeof module === 'object' && module.exports) {
module.exports = Chart;
}
root.Chart = Chart;
+2 -2
Ver Arquivo
@@ -57,6 +57,7 @@
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
hitDetectionRadius : this.options.pointHitDetectionRadius,
ctx : this.chart.ctx,
inRange : function(mouseX){
@@ -103,8 +104,7 @@
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
// x: this.scale.calculateX(index),
// y: this.scale.endPoint,
datasetLabel: dataset.label,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
+3
Ver Arquivo
@@ -70,6 +70,7 @@
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
hitDetectionRadius : this.options.pointHitDetectionRadius,
ctx : this.chart.ctx
});
@@ -120,6 +121,7 @@
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
x: (this.options.animation) ? this.scale.xCenter : pointPosition.x,
y: (this.options.animation) ? this.scale.yCenter : pointPosition.y,
strokeColor : dataset.pointStrokeColor,
@@ -274,6 +276,7 @@
this.eachPoints(function(point){
point.save();
});
this.reflow();
this.render();
},
reflow: function(){