Skip to content

Commit

Permalink
Merge branch 'master' into ZeroBorderWidthFix
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaenchen authored Apr 25, 2018
2 parents 02fb541 + 73b8cee commit 48e6bf2
Show file tree
Hide file tree
Showing 103 changed files with 6,089 additions and 5,780 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ extends: chartjs
env:
browser: true
node: true

plugins: ['html']
19 changes: 19 additions & 0 deletions .htmllintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"indent-style": "tabs",
"line-end-style": false,
"attr-quote-style": "double",
"spec-char-escape": false,
"attr-bans": [
"align",
"background",
"bgcolor",
"border",
"frameborder",
"longdesc",
"marginwidth",
"marginheight",
"scrolling"
],
"tag-bans": [ "b", "i" ],
"id-class-style": false
}
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chart.js

[![travis](https://img.shields.io/travis/chartjs/Chart.js.svg?style=flat-square&maxAge=60)](https://travis-ci.org/chartjs/Chart.js) [![coveralls](https://img.shields.io/coveralls/chartjs/Chart.js.svg?style=flat-square&maxAge=600)](https://coveralls.io/github/chartjs/Chart.js?branch=master) [![codeclimate](https://img.shields.io/codeclimate/maintainability/chartjs/Chart.js.svg?style=flat-square&maxAge=600)](https://codeclimate.com/github/chartjs/Chart.js) [![slack](https://img.shields.io/badge/slack-Chart.js-blue.svg?style=flat-square&maxAge=3600)](https://chart-js-automation.herokuapp.com/)
[![travis](https://img.shields.io/travis/chartjs/Chart.js.svg?style=flat-square&maxAge=60)](https://travis-ci.org/chartjs/Chart.js) [![coveralls](https://img.shields.io/coveralls/chartjs/Chart.js.svg?style=flat-square&maxAge=600)](https://coveralls.io/github/chartjs/Chart.js?branch=master) [![codeclimate](https://img.shields.io/codeclimate/maintainability/chartjs/Chart.js.svg?style=flat-square&maxAge=600)](https://codeclimate.com/github/chartjs/Chart.js) [![slack](https://img.shields.io/badge/slack-chartjs-blue.svg?style=flat-square&maxAge=3600)](https://chartjs-slack.herokuapp.com/)

*Simple HTML5 Charts using the canvas element* [chartjs.org](http://www.chartjs.org)

Expand All @@ -19,11 +19,23 @@ To install via bower:
bower install chart.js --save
```

#### Selecting the Correct Build
### 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.
Chart.js provides two different builds for you to choose: `Stand-Alone Build`, `Bundled Build`.

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.
#### Stand-Alone Build
Files:
* `dist/Chart.js`
* `dist/Chart.min.js`

The stand-alone build includes Chart.js as well as the color parsing library. If this version is used, you are required to include [Moment.js](http://momentjs.com/) before Chart.js for the functionality of the time axis.

#### Bundled Build
Files:
* `dist/Chart.bundle.js`
* `dist/Chart.bundle.min.js`

The bundled build includes Moment.js in a single file. You should use this version if you require time axes and want to include a single file. You should not use this build if your application already included Moment.js. Otherwise, Moment.js will be included twice which results in increasing page load time and possible version compatability issues.

## Documentation

Expand Down
1 change: 1 addition & 0 deletions book.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"root": "./docs",
"title": "Chart.js documentation",
"author": "chartjs",
"gitbook": "3.2.2",
"plugins": ["-lunr", "-search", "search-plus", "anchorjs", "chartjs", "ga"],
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chart.js

[![slack](https://img.shields.io/badge/slack-Chart.js-blue.svg?style=flat-square&maxAge=600)](https://chart-js-automation.herokuapp.com/)
[![slack](https://img.shields.io/badge/slack-chartjs-blue.svg?style=flat-square&maxAge=3600)](https://chartjs-slack.herokuapp.com/)

## Installation

Expand Down
8 changes: 4 additions & 4 deletions docs/axes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ There are a number of config callbacks that can be used to change parameters in
| Name | Arguments | Description
| ---- | --------- | -----------
| `beforeUpdate` | `axis` | Callback called before the update process starts.
| `beforeSetDimensions` | `axis` | Callback that runs before dimensions are set.
| `beforeSetDimensions` | `axis` | Callback that runs before dimensions are set.
| `afterSetDimensions` | `axis` | Callback that runs after dimensions are set.
| `beforeDataLimits` | `axis` | Callback that runs before data limits are determined.
| `afterDataLimits` | `axis` | Callback that runs after data limits are determined.
| `beforeBuildTicks` | `axis` | Callback that runs before ticks are created.
| `afterBuildTicks` | `axis` | Callback that runs after ticks are created. Useful for filtering ticks.
| `beforeTickToLabelConversion` | `axis` | Callback that runs before ticks are converted into strings.
| `afterTickToLabelConversion` | `axis` | Callback that runs after ticks are converted into strings.
| `afterTickToLabelConversion` | `axis` | Callback that runs after ticks are converted into strings.
| `beforeCalculateTickRotation` | `axis` | Callback that runs before tick rotation is determined.
| `afterCalculateTickRotation` | `axis` | Callback that runs after tick rotation is determined.
| `beforeFit` | `axis` | Callback that runs before the scale fits to the canvas.
| `afterFit` | `axis` | Callback that runs after the scale fits to the canvas.
| `beforeFit` | `axis` | Callback that runs before the scale fits to the canvas.
| `afterFit` | `axis` | Callback that runs after the scale fits to the canvas.
| `afterUpdate` | `axis` | Callback that runs at the end of the update process.

## Updating Axis Defaults
Expand Down
1 change: 1 addition & 0 deletions docs/axes/cartesian/linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The following options are provided by the linear scale. They are all located in
| `min` | `Number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](#axis-range-settings)
| `max` | `Number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](#axis-range-settings)
| `maxTicksLimit` | `Number` | `11` | Maximum number of ticks and gridlines to show.
| `precision` | `Number` | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places.
| `stepSize` | `Number` | | User defined fixed step size for the scale. [more...](#step-size)
| `suggestedMax` | `Number` | | Adjustment used when calculating the maximum data value. [more...](#axis-range-settings)
| `suggestedMin` | `Number` | | Adjustment used when calculating the minimum data value. [more...](#axis-range-settings)
Expand Down
2 changes: 1 addition & 1 deletion docs/axes/cartesian/time.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ The `ticks.source` property controls the ticks generation
* `'labels'`: generates ticks from user given `data.labels` values ONLY

### Parser
If this property is defined as a string, it is interpreted as a custom format to be used by moment to parse the date.
If this property is defined as a string, it is interpreted as a custom format to be used by moment to parse the date.

If this is a function, it must return a moment.js object given the appropriate data value.
3 changes: 2 additions & 1 deletion docs/axes/radial/linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The following options are provided by the linear scale. They are all located in
| `min` | `Number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](#axis-range-settings)
| `max` | `Number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](#axis-range-settings)
| `maxTicksLimit` | `Number` | `11` | Maximum number of ticks and gridlines to show.
| `precision` | `Number` | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places.
| `stepSize` | `Number` | | User defined fixed step size for the scale. [more...](#step-size)
| `suggestedMax` | `Number` | | Adjustment used when calculating the maximum data value. [more...](#axis-range-settings)
| `suggestedMin` | `Number` | | Adjustment used when calculating the minimum data value. [more...](#axis-range-settings)
Expand Down Expand Up @@ -104,7 +105,7 @@ The following options are used to configure the point labels that are shown on t
| Name | Type | Default | Description
| -----| ---- | --------| -----------
| `callback` | `Function` | | Callback function to transform data labels to point labels. The default implementation simply returns the current string.
| `fontColor` | `Color` | `'#666'` | Font color for point labels.
| `fontColor` | `Color/Color[]` | `'#666'` | Font color for point labels.
| `fontFamily` | `String` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Font family to use when rendering labels.
| `fontSize` | `Number` | 10 | font size in pixels
| `fontStyle` | `String` | `'normal'` | Font style to use when rendering point labels.
12 changes: 6 additions & 6 deletions docs/charts/bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ A bar chart provides a way of showing data values represented as vertical bars.
"type": "bar",
"data": {
"labels": [
"January",
"February",
"March",
"April",
"May",
"June",
"January",
"February",
"March",
"April",
"May",
"June",
"July"
],
"datasets": [{
Expand Down
6 changes: 3 additions & 3 deletions docs/charts/mixed.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ At this point we have a chart rendering how we'd like. It's important to note th
"type": "bar",
"data": {
"labels": [
"January",
"February",
"March",
"January",
"February",
"March",
"April"
],
"datasets": [{
Expand Down
10 changes: 5 additions & 5 deletions docs/charts/radar.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ They are often useful for comparing the points of two or more different data set
"type": "radar",
"data": {
"labels": [
"Eating",
"Drinking",
"Sleeping",
"Eating",
"Drinking",
"Sleeping",
"Designing",
"Coding",
"Cycling",
Expand Down Expand Up @@ -94,7 +94,7 @@ The style of point. Options are:
* 'circle'
* 'cross'
* 'crossRot'
* 'dash'.
* 'dash'.
* 'line'
* 'rect'
* 'rectRounded'
Expand Down Expand Up @@ -127,7 +127,7 @@ It is common to want to apply a configuration setting to all created radar chart

## Data Structure

The `data` property of a dataset for a radar chart is specified as a an array of numbers. Each point in the data array corresponds to the label at the same index on the x axis.
The `data` property of a dataset for a radar chart is specified as a an array of numbers. Each point in the data array corresponds to the label at the same index on the x axis.

```javascript
data: [20, 10]
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/legend.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Legend Configuration

The chart legend displays data about the datasets that area appearing on the chart.
The chart legend displays data about the datasets that are appearing on the chart.

## Configuration options
The legend configuration is passed into the `options.legend` namespace. The global options for the chart legend is defined in `Chart.defaults.global.legend`.
Expand All @@ -10,7 +10,7 @@ The legend configuration is passed into the `options.legend` namespace. The glob
| `display` | `Boolean` | `true` | is the legend shown
| `position` | `String` | `'top'` | Position of the legend. [more...](#position)
| `fullWidth` | `Boolean` | `true` | Marks that this box should take the full width of the canvas (pushing down other boxes). This is unlikely to need to be changed in day-to-day use.
| `onClick` | `Function` | | A callback that is called when a click event is registered on a label item
| `onClick` | `Function` | | A callback that is called when a click event is registered on a label item
| `onHover` | `Function` | | A callback that is called when a 'mousemove' event is registered on top of a label item
| `reverse` | `Boolean` | `false` | Legend will show datasets in reverse order.
| `labels` | `Object` | | See the [Legend Label Configuration](#legend-label-configuration) section below.
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/tooltip.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ Example:
Chart.Tooltip.positioners.custom = function(elements, eventPosition) {
/** @type {Chart.Tooltip} */
var tooltip = this;

/* ... */

return {
x: 0,
y: 0
Expand Down
4 changes: 2 additions & 2 deletions docs/developers/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ To get an item that was clicked on, `getElementAtEvent` can be used.

```javascript
function clickHandler(evt) {
var item = myChart.getElementAtEvent(evt)[0];
var firstPoint = myChart.getElementAtEvent(evt)[0];

if (item) {
if (firstPoint) {
var label = myChart.data.labels[firstPoint._index];
var value = myChart.data.datasets[firstPoint._datasetIndex].data[firstPoint._index];
}
Expand Down
4 changes: 2 additions & 2 deletions docs/developers/charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The built in controller types are:
For example, to derive a new chart type that extends from a bubble chart, you would do the following.

```javascript
// Sets the default config for 'derivedBubble' to be the same as the bubble defaults.
// Sets the default config for 'derivedBubble' to be the same as the bubble defaults.
// We look for the defaults by doing Chart.defaults[chartType]
// It looks like a bug exists when the defaults don't exist
Chart.defaults.derivedBubble = Chart.defaults.bubble;
Expand All @@ -102,7 +102,7 @@ var custom = Chart.controllers.bubble.extend({

// Stores the controller so that the chart initialization routine can look it up with
// Chart.controllers[type]
Chart.controllers.derivedBubble = custom;
Chart.controllers.derivedBubble = custom;

// Now we can create and use our new chart type
new Chart(ctx, {
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ New contributions to the library are welcome, but we ask that you please follow

# Joining the project

Active committers and contributors are invited to introduce yourself and request commit access to this project. We have a very active Slack community that you can join [here](https://chart-js-automation.herokuapp.com/). If you think you can help, we'd love to have you!
Active committers and contributors are invited to introduce yourself and request commit access to this project. We have a very active Slack community that you can join [here](https://chartjs-slack.herokuapp.com/). If you think you can help, we'd love to have you!

# Building and Testing

Expand Down
2 changes: 1 addition & 1 deletion docs/general/colors.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can also pass a [CanvasGradient](https://developer.mozilla.org/en-US/docs/We

## Patterns and Gradients

An alternative option is to pass a [CanvasPattern](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern) or [CanvasGradient](https://developer.mozilla.org/en/docs/Web/API/CanvasGradient) object instead of a string colour.
An alternative option is to pass a [CanvasPattern](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern) or [CanvasGradient](https://developer.mozilla.org/en/docs/Web/API/CanvasGradient) object instead of a string colour.

For example, if you wanted to fill a dataset with a pattern from an image you could do the following.

Expand Down
2 changes: 1 addition & 1 deletion docs/general/interactions/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Interactions

The hover configuration is passed into the `options.hover` namespace. The global hover configuration is at `Chart.defaults.global.hover`. To configure which events trigger chart interactions, see [events](./events.md#events).
The hover configuration is passed into the `options.hover` namespace. The global hover configuration is at `Chart.defaults.global.hover`. To configure which events trigger chart interactions, see [events](./events.md#events).

| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
Expand Down
2 changes: 1 addition & 1 deletion docs/general/interactions/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The following properties define how the chart interacts with events.
| `onHover` | `Function` | `null` | Called when any of the events fire. Called in the context of the chart and passed the event and an array of active elements (bars, points, etc).
| `onClick` | `Function` | `null` | Called if the event is of type 'mouseup' or 'click'. Called in the context of the chart and passed the event and an array of active elements

## Event Option
## Event Option
For example, to have the chart only respond to click events, you could do
```javascript
var chart = new Chart(ctx, {
Expand Down
2 changes: 1 addition & 1 deletion docs/general/interactions/modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Finds the first item that intersects the point and returns it. Behaves like 'nea
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, in the x direction, is used to determine the 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, in the x direction, is used to determine the index.

```javascript
var chart = new Chart(ctx, {
Expand Down
6 changes: 3 additions & 3 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ If you download or clone the repository, you must [build](../developers/contribu

# Selecting the Correct Build

Chart.js provides two different builds that are available for your use.
Chart.js provides two different builds for you to choose: `Stand-Alone Build`, `Bundled Build`.

## Stand-Alone Build
Files:
* `dist/Chart.js`
* `dist/Chart.min.js`

This version only includes Chart.js. 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 stand-alone build includes Chart.js as well as the color parsing library. If this version is used, you are required to include [Moment.js](http://momentjs.com/) before Chart.js for the functionality of the time axis.

## Bundled Build
Files:
* `dist/Chart.bundle.js`
* `dist/Chart.bundle.min.js`

The bundled version includes Moment.js built into the same file. This version should be used if you wish to use time axes and want a single file to include. 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.
The bundled build includes Moment.js in a single file. You should use this version if you require time axes and want to include a single file. You should not use this build if your application already included Moment.js. Otherwise, Moment.js will be included twice which results in increasing page load time and possible version compatability issues.
4 changes: 4 additions & 0 deletions docs/notes/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ In addition, many charts can be found on the [npm registry](https://www.npmjs.co
- <a href="https://github.com/chartjs/chartjs-plugin-deferred" target="_blank">chartjs-plugin-deferred</a> - Defers initial chart update until chart scrolls into viewport.
- <a href="https://github.com/compwright/chartjs-plugin-draggable" target="_blank">chartjs-plugin-draggable</a> - Makes select chart elements draggable with the mouse.
- <a href="https://github.com/y-takey/chartjs-plugin-stacked100" target="_blank">chartjs-plugin-stacked100</a> - Draws 100% stacked bar chart.
- <a href="https://github.com/nagix/chartjs-plugin-streaming" target="_blank">chartjs-plugin-streaming</a> - Enables to create live streaming charts.
- <a href="https://github.com/everestate/chartjs-plugin-waterfall" target="_blank">chartjs-plugin-waterfall</a> - Enables easy use of waterfall charts.
- <a href="https://github.com/chartjs/chartjs-plugin-zoom" target="_blank">chartjs-plugin-zoom</a> - Enables zooming and panning on charts.

Expand Down Expand Up @@ -56,5 +57,8 @@ In addition, many plugins can be found on the [npm registry](https://www.npmjs.c
### Java
- <a href="https://github.com/mdewilde/chart/" target="_blank">Chart.java</a>

### GWT (Google Web toolkit)
- <a href="https://github.com/pepstock-org/Charba" target="_blank">Charba</a>

### Ember.js
- <a href="https://github.com/aomran/ember-cli-chart" target="_blank">ember-cli-chart</a>
Loading

0 comments on commit 48e6bf2

Please sign in to comment.