diff --git a/.codeclimate.yml b/.codeclimate.yml
index d865954a2..ee3a5fdac 100644
--- a/.codeclimate.yml
+++ b/.codeclimate.yml
@@ -6,6 +6,7 @@ engines:
- javascript
eslint:
enabled: true
+ channel: "eslint-3"
fixme:
enabled: true
ratings:
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 426edad8d..7d57bbd0c 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,9 +1,40 @@
+
-Example of issue on an interactive website such as the following:
-- http://jsbin.com/
-- http://jsfiddle.net/
-- http://codepen.io/pen/
-- Premade template: http://codepen.io/pen?template=JXVYzq
\ No newline at end of file
+
+
+## Expected Behavior
+
+
+
+## Current Behavior
+
+
+
+## Possible Solution
+
+
+
+## Steps to Reproduce (for bugs)
+
+
+1.
+2.
+3.
+4.
+
+## Context
+
+
+
+## Environment
+
+* Chart.js version:
+* Browser name and version:
+* Link to your project:
diff --git a/.gitignore b/.gitignore
index 478edb5ec..8ef0139ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@
.DS_Store
.idea
+.vscode
bower.json
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b8b96cbe2..6ec102439 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -21,7 +21,7 @@ Reporting bugs
Well structured, detailed bug reports are hugely valuable for the project.
-Guidlines for reporting bugs:
+Guidelines for reporting bugs:
- Check the issue search to see if it has already been reported
- Isolate the problem to a simple test case
diff --git a/README.md b/README.md
index 49d09c017..daec17a46 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
## Installation
-You can download the latest version of [Chart.js on GitHub](https://github.com/chartjs/Chart.js/releases/latest) or just use these [Chart.js CDN](https://cdnjs.com/libraries/Chart.js) links.
+You can download the latest version of Chart.js from the [GitHub releases](https://github.com/chartjs/Chart.js/releases/latest) or use a [Chart.js CDN](https://cdnjs.com/libraries/Chart.js).
To install via npm:
@@ -16,7 +16,16 @@ To install via npm:
npm install chart.js --save
```
-To Install via bower, please follow [these instructions](http://www.chartjs.org/docs/#getting-started-installation).
+To install via bower:
+```bash
+bower install chart.js --save
+```
+
+#### Selecting the Correct Build
+
+Chart.js provides two different builds that are available for your use. The `Chart.js` and `Chart.min.js` files include Chart.js and the accompanying color parsing library. If this version is used and you require the use of the time axis, [Moment.js](http://momentjs.com/) will need to be included before Chart.js.
+
+The `Chart.bundle.js` and `Chart.bundle.min.js` builds include Moment.js in a single file. This version should be used if you require time axes and want a single file to include, select this version. Do not use this build if your application already includes Moment.js. If you do, Moment.js will be included twice, increasing the page load time and potentially introducing version issues.
## Documentation
diff --git a/docs/00-Getting-Started.md b/docs/00-Getting-Started.md
index 910ea5bea..b7eb09dfc 100644
--- a/docs/00-Getting-Started.md
+++ b/docs/00-Getting-Started.md
@@ -71,6 +71,7 @@ To create a chart, we need to instantiate the `Chart` class. To do this, we need
var ctx = document.getElementById("myChart");
var ctx = document.getElementById("myChart").getContext("2d");
var ctx = $("#myChart");
+var ctx = "myChart";
```
Once you have the element or context, you're ready to instantiate a pre-defined chart-type or create your own!
diff --git a/docs/01-Chart-Configuration.md b/docs/01-Chart-Configuration.md
index 43e762ba4..a46922088 100644
--- a/docs/01-Chart-Configuration.md
+++ b/docs/01-Chart-Configuration.md
@@ -36,13 +36,13 @@ This concept was introduced in Chart.js 1.0 to keep configuration [DRY](https://
Chart.js merges the options object passed to the chart with the global configuration using chart type defaults and scales defaults appropriately. This way you can be as specific as you would like in your individual chart configuration, while still changing the defaults for all chart types where applicable. The global general options are defined in `Chart.defaults.global`. The defaults for each chart type are discussed in the documentation for that chart type.
-The following example would set the hover mode to 'single' for all charts where this was not overridden by the chart type defaults or the options passed to the constructor on creation.
+The following example would set the hover mode to 'nearest' for all charts where this was not overridden by the chart type defaults or the options passed to the constructor on creation.
```javascript
-Chart.defaults.global.hover.mode = 'single';
+Chart.defaults.global.hover.mode = 'nearest';
-// Hover mode is set to single because it was not overridden here
-var chartInstanceHoverModeSingle = new Chart(ctx, {
+// Hover mode is set to nearest because it was not overridden here
+var chartInstanceHoverModeNearest = new Chart(ctx, {
type: 'line',
data: data,
});
@@ -54,7 +54,7 @@ var chartInstanceDifferentHoverMode = new Chart(ctx, {
options: {
hover: {
// Overrides the global setting
- mode: 'label'
+ mode: 'index'
}
}
})
@@ -83,7 +83,16 @@ maintainAspectRatio | Boolean | true | Maintain the original canvas aspect ratio
events | Array[String] | `["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"]` | Events that the chart should listen to for tooltips and hovering
onClick | Function | null | Called if the event is of type 'mouseup' or 'click'. Called in the context of the chart and passed an array of active elements
legendCallback | Function | ` function (chart) { }` | Function to generate a legend. Receives the chart object to generate a legend from. Default implementation returns an HTML string.
-onResize | Function | null | Called when a resize occurs. Gets passed two arguemnts: the chart instance and the new size.
+onResize | Function | null | Called when a resize occurs. Gets passed two arguments: the chart instance and the new size.
+
+### Layout Configuration
+
+The layout configuration is passed into the `options.layout` namespace. The global options for the chart layout is defined in `Chart.defaults.global.layout`.
+
+Name | Type | Default | Description
+--- | --- | --- | ---
+padding | Number or Object | 0 | The padding to add inside the chart. If this value is a number, it is applied to all sides of the chart (left, top, right, bottom). If this value is an object, the `left` property defines the left padding. Similarly the `right`, `top`, and `bottom` properties can also be specified.
+
### Title Configuration
@@ -130,6 +139,7 @@ fullWidth | Boolean | true | Marks that this box should take the full width of t
onClick | Function | `function(event, legendItem) {}` | A callback that is called when a 'click' event is registered on top of a label item
onHover | Function | `function(event, legendItem) {}` | A callback that is called when a 'mousemove' event is registered on top of a label item
labels |Object|-| See the [Legend Label Configuration](#chart-configuration-legend-label-configuration) section below.
+reverse | Boolean | false | Legend will show datasets in reverse order
#### Legend Label Configuration
@@ -145,7 +155,6 @@ fontFamily | String | "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" | Fon
padding | Number | 10 | Padding between rows of colored boxes
generateLabels: | Function | `function(chart) { }` | Generates legend items for each thing in the legend. Default implementation returns the text + styling for the color box. See [Legend Item](#chart-configuration-legend-item-interface) for details.
usePointStyle | Boolean | false | Label style will match corresponding point style (size is based on fontSize, boxWidth is not used in this case).
-reverse | Boolean | false | Legend will show datasets in reverse order
#### Legend Item Interface
@@ -200,7 +209,7 @@ var chartInstance = new Chart(ctx, {
fontColor: 'rgb(255, 99, 132)'
}
}
- }
+}
});
```
@@ -212,8 +221,11 @@ Name | Type | Default | Description
--- | --- | --- | ---
enabled | Boolean | true | Are tooltips enabled
custom | Function | null | See [section](#advanced-usage-external-tooltips) below
-mode | String | 'single' | Sets which elements appear in the tooltip. Acceptable options are `'single'`, `'label'` or `'x-axis'`.
`single` highlights the closest element.
`label` highlights elements in all datasets at the same `X` value.
`'x-axis'` also highlights elements in all datasets at the same `X` value, but activates when hovering anywhere within the vertical slice of the x-axis representing that `X` value.
+mode | String | 'nearest' | Sets which elements appear in the tooltip. See [Interaction Modes](#interaction-modes) for details
+intersect | Boolean | true | if true, the tooltip mode applies only when the mouse position intersects with an element. If false, the mode will be applied at all times.
+position | String | 'average' | The mode for positioning the tooltip. 'average' mode will place the tooltip at the average position of the items displayed in the tooltip. 'nearest' will place the tooltip at the position of the element closest to the event position. New modes can be defined by adding functions to the Chart.Tooltip.positioners map.
itemSort | Function | undefined | Allows sorting of [tooltip items](#chart-configuration-tooltip-item-interface). Must implement at minimum a function that can be passed to [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). This function can also accept a third parameter that is the data object passed to the chart.
+filter | Function | undefined | Allows filtering of [tooltip items](#chart-configuration-tooltip-item-interface). Must implement at minimum a function that can be passed to [Array.prototype.filter](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). This function can also accept a second parameter that is the data object passed to the chart.
backgroundColor | Color | 'rgba(0,0,0,0.8)' | Background color of the tooltip
titleFontFamily | String | "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" | Font family for tooltip title inherited from global font family
titleFontSize | Number | 12 | Font size for tooltip title inherited from global font size
@@ -237,6 +249,7 @@ yPadding | Number | 6 | Padding to add on top and bottom of tooltip
caretSize | Number | 5 | Size, in px, of the tooltip arrow
cornerRadius | Number | 6 | Radius of tooltip corner curves
multiKeyBackground | Color | "#fff" | Color to draw behind the colored boxes when multiple items are in the tooltip
+displayColors | Boolean | true | if true, color boxes are shown in the tooltip
callbacks | Object | | See the [callbacks section](#chart-configuration-tooltip-callbacks) below
#### Tooltip Callbacks
@@ -253,12 +266,13 @@ afterTitle | `Array[tooltipItem], data` | Text to render after the title
beforeBody | `Array[tooltipItem], data` | Text to render before the body section
beforeLabel | `tooltipItem, data` | Text to render before an individual label
label | `tooltipItem, data` | Text to render for an individual item in the tooltip
-labelColor | `tooltipItem, chartInstace` | Returns the colors to render for the tooltip item. Return as an object containing two parameters: `borderColor` and `backgroundColor`.
+labelColor | `tooltipItem, chartInstance` | Returns the colors to render for the tooltip item. Return as an object containing two parameters: `borderColor` and `backgroundColor`.
afterLabel | `tooltipItem, data` | Text to render after an individual label
afterBody | `Array[tooltipItem], data` | Text to render after the body section
beforeFooter | `Array[tooltipItem], data` | Text to render before the footer section
footer | `Array[tooltipItem], data` | Text to render as the footer
afterFooter | `Array[tooltipItem], data` | Text to render after the footer section
+dataPoints | `Array[tooltipItem]` | List of matching point informations.
#### Tooltip Item Interface
@@ -276,7 +290,13 @@ The tooltip items passed to the tooltip callbacks implement the following interf
datasetIndex: Number,
// Index of this data item in the dataset
- index: Number
+ index: Number,
+
+ // X position of matching point
+ x: Number,
+
+ // Y position of matching point
+ y: Number,
}
```
@@ -286,10 +306,28 @@ The hover configuration is passed into the `options.hover` namespace. The global
Name | Type | Default | Description
--- | --- | --- | ---
-mode | String | 'single' | Sets which elements hover. Acceptable options are `'single'`, `'label'`, `'x-axis'`, or `'dataset'`.
`single` highlights the closest element.
`label` highlights elements in all datasets at the same `X` value.
`'x-axis'` also highlights elements in all datasets at the same `X` value, but activates when hovering anywhere within the vertical slice of the x-axis representing that `X` value.
`dataset` highlights the closest dataset.
+mode | String | 'nearest' | Sets which elements appear in the tooltip. See [Interaction Modes](#interaction-modes) for details
+intersect | Boolean | true | if true, the hover mode only applies when the mouse position intersects an item on the chart
animationDuration | Number | 400 | Duration in milliseconds it takes to animate hover style changes
onHover | Function | null | Called when any of the events fire. Called in the context of the chart and passed an array of active elements (bars, points, etc)
+### Interaction Modes
+When configuring interaction with the graph via hover or tooltips, a number of different modes are available.
+
+The following table details the modes and how they behave in conjunction with the `intersect` setting
+
+Mode | Behaviour
+--- | ---
+point | Finds all of the items that intersect the point
+nearest | Gets the item that is nearest to the point. The nearest item is determined based on the distance to the center of the chart item (point, bar). If 2 or more items are at the same distance, the one with the smallest area is used. If `intersect` is true, this is only triggered when the mouse position intersects an item in the graph. This is very useful for combo charts where points are hidden behind bars.
+single (deprecated) | Finds the first item that intersects the point and returns it. Behaves like 'nearest' mode with intersect = true.
+label (deprecated) | See `'index'` mode
+index | Finds item at the same index. If the `intersect` setting is true, the first intersecting item is used to determine the index in the data. If `intersect` false the nearest item is used to determine the index.
+x-axis (deprecated) | Behaves like `'index'` mode with `intersect = true`
+dataset | Finds items in the same dataset. If the `intersect` setting is true, the first intersecting item is used to determine the index in the data. If `intersect` false the nearest item is used to determine the index.
+x | Returns all items that would intersect based on the `X` coordinate of the position only. Would be useful for a vertical cursor implementation. Note that this only applies to cartesian charts
+y | Returns all items that would intersect based on the `Y` coordinate of the position. This would be useful for a horizontal cursor implementation. Note that this only applies to cartesian charts.
+
### Animation Configuration
The following animation options are available. The global options for are defined in `Chart.defaults.global.animation`.
@@ -305,7 +343,7 @@ onComplete | Function | none | Callback called at the end of an animation. Passe
The `onProgress` and `onComplete` callbacks are useful for synchronizing an external draw to the chart animation. The callback is passed an object that implements the following interface. An example usage of these callbacks can be found on [Github](https://github.com/chartjs/Chart.js/blob/master/samples/AnimationCallbacks/progress-bar.html). This sample displays a progress bar showing how far along the animation is.
-```javscript
+```javascript
{
// Chart object
chartInstance,
@@ -345,7 +383,7 @@ The animation object passed to the callbacks is of type `Chart.Animation`. The o
The global options for elements are defined in `Chart.defaults.global.elements`.
-Options can be configured for four different types of elements; arc, lines, points, and rectangles. When set, these options apply to all objects of that type unless specifically overridden by the configuration attached to a dataset.
+Options can be configured for four different types of elements: arc, lines, points, and rectangles. When set, these options apply to all objects of that type unless specifically overridden by the configuration attached to a dataset.
#### Arc Configuration
@@ -372,7 +410,7 @@ borderDash | Array | `[]` | Default line dash. See [MDN](https://developer.mozil
borderDashOffset | Number | 0.0 | Default line dash offset. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset)
borderJoinStyle | String | 'miter' | Default line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin)
capBezierPoints | Boolean | true | If true, bezier control points are kept inside the chart. If false, no restriction is enforced.
-fill | Boolean | true | If true, the line is filled.
+fill | Boolean or String | true | If true, the fill is assumed to be to zero. String values are 'zero', 'top', and 'bottom' to fill to different locations. If `false`, no fill is added
stepped | Boolean | false | If true, the line is shown as a stepped line and 'tension' will be ignored
#### Point Configuration
@@ -451,7 +489,7 @@ var chartData = {
### Mixed Chart Types
-When creating a chart, you have the option to overlay different chart types on top of eachother as separate datasets.
+When creating a chart, you have the option to overlay different chart types on top of each other as separate datasets.
To do this, you must set a `type` for each dataset individually. You can create mixed chart types with bar and line chart types.
diff --git a/docs/02-Scales.md b/docs/02-Scales.md
index c776355eb..ae7758326 100644
--- a/docs/02-Scales.md
+++ b/docs/02-Scales.md
@@ -59,7 +59,7 @@ offsetGridLines | Boolean | false | If true, labels are shifted to be between gr
#### Scale Title Configuration
-The grid line configuration is nested under the scale configuration in the `scaleLabel` key. It defines options for the scale title.
+The scale label configuration is nested under the scale configuration in the `scaleLabel` key. It defines options for the scale title.
Name | Type | Default | Description
--- | --- | --- | ---
@@ -72,11 +72,12 @@ fontStyle | String | "normal" | Font style for the scale title, follows CSS font
#### Tick Configuration
-The grid line configuration is nested under the scale configuration in the `ticks` key. It defines options for the tick marks that are generated by the axis.
+The tick configuration is nested under the scale configuration in the `ticks` key. It defines options for the tick marks that are generated by the axis.
Name | Type | Default | Description
--- | --- | --- | ---
autoSkip | Boolean | true | If true, automatically calculates how many labels that can be shown and hides labels accordingly. Turn it off to show all labels no matter what
+autoSkipPadding | Number | 0 | Padding between the ticks on the horizontal axis when `autoSkip` is enabled. *Note: Only applicable to horizontal scales.*
callback | Function | `function(value) { return helpers.isArray(value) ? value : '' + value; }` | Returns the string representation of the tick value as it should be displayed on the chart. See [callback](#scales-creating-custom-tick-formats) section below.
display | Boolean | true | If true, show the ticks.
fontColor | Color | "#666" | Font color for the tick labels.
@@ -301,7 +302,7 @@ var chartInstance = new Chart(ctx, {
### Radial Linear Scale
-The radial linear scale is used specifically for the radar and polar are chart types. It overlays the chart area, rather than being positioned on one of the edges.
+The radial linear scale is used specifically for the radar and polar area chart types. It overlays the chart area, rather than being positioned on one of the edges.
#### Configuration Options
diff --git a/docs/09-Advanced.md b/docs/09-Advanced.md
index 3a361bcff..062bf59e8 100644
--- a/docs/09-Advanced.md
+++ b/docs/09-Advanced.md
@@ -28,19 +28,27 @@ myLineChart.destroy();
Triggers an update of the chart. This can be safely called after replacing the entire data object. This will update all scales, legends, and then re-render the chart.
```javascript
-// duration is the time for the animation of the redraw in miliseconds
-// lazy is a boolean. if true, the animation can be interupted by other animations
+// duration is the time for the animation of the redraw in milliseconds
+// lazy is a boolean. if true, the animation can be interrupted by other animations
myLineChart.data.datasets[0].data[2] = 50; // Would update the first dataset's value of 'March' to be 50
myLineChart.update(); // Calling update now animates the position of March from 90 to 50.
```
+#### .reset()
+
+Reset the chart to it's state before the initial animation. A new animation can then be triggered using `update`.
+
+```javascript
+myLineChart.reset();
+```
+
#### .render(duration, lazy)
Triggers a redraw of all chart elements. Note, this does not update elements for new data. Use `.update()` in that case.
```javascript
-// duration is the time for the animation of the redraw in miliseconds
-// lazy is a boolean. if true, the animation can be interupted by other animations
+// duration is the time for the animation of the redraw in milliseconds
+// lazy is a boolean. if true, the animation can be interrupted by other animations
myLineChart.render(duration, lazy);
```
@@ -165,6 +173,8 @@ var myPieChart = new Chart(ctx, {
// tooltip.text
// tooltip.x
// tooltip.y
+ // tooltip.caretX
+ // tooltip.caretY
// etc...
}
}
@@ -216,12 +226,12 @@ Scale instances are given the following properties during the fitting process.
{
left: Number, // left edge of the scale bounding box
right: Number, // right edge of the bounding box'
- top: Number,
+ top: Number,
bottom: Number,
width: Number, // the same as right - left
height: Number, // the same as bottom - top
- // Margin on each side. Like css, this is outside the bounding box.
+ // Margin on each side. Like css, this is outside the bounding box.
margins: {
left: Number,
right: Number,
@@ -238,7 +248,7 @@ Scale instances are given the following properties during the fitting process.
```
#### Scale Interface
-To work with Chart.js, custom scale types must implement the following interface.
+To work with Chart.js, custom scale types must implement the following interface.
```javascript
{
@@ -273,10 +283,10 @@ To work with Chart.js, custom scale types must implement the following interface
Optionally, the following methods may also be overwritten, but an implementation is already provided by the `Chart.Scale` base class.
```javascript
- // Transform the ticks array of the scale instance into strings. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks);
+ // Transform the ticks array of the scale instance into strings. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks);
convertTicksToLabels: function() {},
- // Determine how much the labels will rotate by. The default implementation will only rotate labels if the scale is horizontal.
+ // Determine how much the labels will rotate by. The default implementation will only rotate labels if the scale is horizontal.
calculateTickRotation: function() {},
// Fits the scale into the canvas.
@@ -293,7 +303,7 @@ Optionally, the following methods may also be overwritten, but an implementation
The Core.Scale base class also has some utility functions that you may find useful.
```javascript
-{
+{
// Returns true if the scale instance is horizontal
isHorizontal: function() {},
@@ -363,7 +373,7 @@ The following methods may optionally be overridden by derived dataset controller
// chart types using a single scale
linkScales: function() {},
- // Called by the main chart controller when an update is triggered. The default implementation handles the number of data points changing and creating elements appropriately.
+ // Called by the main chart controller when an update is triggered. The default implementation handles the number of data points changing and creating elements appropriately.
buildOrUpdateElements: function() {}
}
```
@@ -432,7 +442,7 @@ Plugins should derive from Chart.PluginBase and implement the following interfac
### Building Chart.js
-Chart.js uses gulp to build the library into a single JavaScript file.
+Chart.js uses gulp to build the library into a single JavaScript file.
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:
diff --git a/docs/10-Notes.md b/docs/10-Notes.md
index 85cc6507a..fd2125e17 100644
--- a/docs/10-Notes.md
+++ b/docs/10-Notes.md
@@ -49,31 +49,31 @@ Library Features
| Feature | Chart.js | D3 | HighCharts | Chartist |
| ------- | -------- | --- | ---------- | -------- |
-| Completely Free | ✓ | ✓ | | ✓ |
-| Canvas | ✓ | | | |
-| SVG | | ✓ | ✓ | ✓ |
-| Built-in Charts | ✓ | | ✓ | ✓ |
-| 8+ Chart Types | ✓ | ✓ | ✓ | |
-| Extendable to Custom Charts | ✓ | ✓ | | |
-| Supports Modern Browsers | ✓ | ✓ | ✓ | ✓ |
-| Extensive Documentation | ✓ | ✓ | ✓ | ✓ |
-| Open Source | ✓ | ✓ | ✓ | ✓ |
+| Completely Free | ✓ | ✓ | | ✓ |
+| Canvas | ✓ | | | |
+| SVG | | ✓ | ✓ | ✓ |
+| Built-in Charts | ✓ | | ✓ | ✓ |
+| 8+ Chart Types | ✓ | ✓ | ✓ | |
+| Extendable to Custom Charts | ✓ | ✓ | | |
+| Supports Modern Browsers | ✓ | ✓ | ✓ | ✓ |
+| Extensive Documentation | ✓ | ✓ | ✓ | ✓ |
+| Open Source | ✓ | ✓ | ✓ | ✓ |
Built in Chart Types
| Type | Chart.js | HighCharts | Chartist |
| ---- | -------- | ---------- | -------- |
-| Combined Types | ✓ | ✓ | |
-| Line | ✓ | ✓ | ✓ |
-| Bar | ✓ | ✓ | ✓ |
-| Horizontal Bar | ✓ | ✓ | ✓ |
-| Pie/Doughnut | ✓ | ✓ | ✓ |
-| Polar Area | ✓ | ✓ | |
-| Radar | ✓ | | |
-| Scatter | ✓ | ✓ | ✓ |
-| Bubble | ✓ | | |
-| Gauges | | ✓ | |
-| Maps (Heat/Tree/etc.) | | ✓ | |
+| Combined Types | ✓ | ✓ | |
+| Line | ✓ | ✓ | ✓ |
+| Bar | ✓ | ✓ | ✓ |
+| Horizontal Bar | ✓ | ✓ | ✓ |
+| Pie/Doughnut | ✓ | ✓ | ✓ |
+| Polar Area | ✓ | ✓ | |
+| Radar | ✓ | | |
+| Scatter | ✓ | ✓ | ✓ |
+| Bubble | ✓ | | |
+| Gauges | | ✓ | |
+| Maps (Heat/Tree/etc.) | | ✓ | |
### Popular Plugins
diff --git a/gulpfile.js b/gulpfile.js
index b3dab98d1..1ce312d90 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -17,10 +17,12 @@ var browserify = require('browserify');
var source = require('vinyl-source-stream');
var merge = require('merge-stream');
var collapse = require('bundle-collapser/plugin');
+var argv = require('yargs').argv
var package = require('./package.json');
var srcDir = './src/';
var outDir = './dist/';
+var testDir = './test/';
var header = "/*!\n" +
" * Chart.js\n" +
@@ -33,17 +35,11 @@ var header = "/*!\n" +
" */\n";
var preTestFiles = [
- './node_modules/moment/min/moment.min.js',
+ './node_modules/moment/min/moment.min.js'
];
var testFiles = [
- './test/mockContext.js',
- './test/*.js',
-
- // Disable tests which need to be rewritten based on changes introduced by
- // the following changes: https://github.com/chartjs/Chart.js/pull/2346
- '!./test/core.layoutService.tests.js',
- '!./test/defaultConfig.tests.js'
+ './test/*.js'
];
gulp.task('bower', bowerTask);
@@ -133,6 +129,7 @@ function packageTask() {
function lintTask() {
var files = [
srcDir + '**/*.js',
+ testDir + '**/*.js'
];
// NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict
@@ -142,7 +139,22 @@ function lintTask() {
rules: {
'complexity': [1, 6],
'max-statements': [1, 30]
- }
+ },
+ globals: [
+ 'Chart',
+ 'acquireChart',
+ 'afterAll',
+ 'afterEach',
+ 'beforeAll',
+ 'beforeEach',
+ 'describe',
+ 'expect',
+ 'it',
+ 'jasmine',
+ 'moment',
+ 'spyOn',
+ 'xit'
+ ]
};
return gulp.src(files)
@@ -157,10 +169,13 @@ function validHTMLTask() {
}
function startTest() {
- var files = ['./src/**/*.js'];
- Array.prototype.unshift.apply(files, preTestFiles);
- Array.prototype.push.apply(files, testFiles);
- return files;
+ return [].concat(preTestFiles).concat([
+ './src/**/*.js',
+ './test/mockContext.js'
+ ]).concat(
+ argv.inputs?
+ argv.inputs.split(';'):
+ testFiles);
}
function unittestTask() {
diff --git a/package.json b/package.json
index e901b26c3..b8dba1874 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "chart.js",
"homepage": "http://www.chartjs.org",
"description": "Simple HTML5 charts using the canvas element.",
- "version": "2.3.0",
+ "version": "2.4.0",
"license": "MIT",
"main": "src/chart.js",
"repository": {
@@ -17,7 +17,7 @@
"gulp": "3.9.x",
"gulp-concat": "~2.1.x",
"gulp-connect": "~2.0.5",
- "gulp-eslint": "^2.0.0",
+ "gulp-eslint": "^3.0.0",
"gulp-file": "^0.3.0",
"gulp-html-validator": "^0.0.2",
"gulp-insert": "~0.5.0",
@@ -38,7 +38,9 @@
"karma-jasmine": "^0.3.6",
"karma-jasmine-html-reporter": "^0.1.8",
"merge-stream": "^1.0.0",
- "vinyl-source-stream": "^1.1.0"
+ "vinyl-source-stream": "^1.1.0",
+ "watchify": "^3.7.0",
+ "yargs": "^5.0.0"
},
"spm": {
"main": "Chart.js"
diff --git a/samples/AnimationCallbacks/progress-bar.html b/samples/AnimationCallbacks/progress-bar.html
deleted file mode 100644
index 7d79d6c1d..000000000
--- a/samples/AnimationCallbacks/progress-bar.html
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-