Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add markdown linting, fix errors #8449

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MD013: false # line-length
MD033: false # inline HTML
MD041: false # first line heading
2 changes: 2 additions & 0 deletions MAINTAINING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Maintaining

## Release Process

Chart.js relies on [Travis CI](https://travis-ci.org/) to automate the library [releases](https://github.com/chartjs/Chart.js/releases).

### Releasing a New Version
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Currently, there are two versions of the library (2.9.4 and 3.x.x). Version 2 is
* Source currently points to 3.x.x version. 2.9.4 source is available [here](https://github.com/chartjs/Chart.js/tree/2.9)
* Docs for version 3.x.x are available [here](https://www.chartjs.org/docs/master/)

- [Introduction](https://www.chartjs.org/docs/latest/)
- [Getting Started](https://www.chartjs.org/docs/latest/getting-started/)
- [General](https://www.chartjs.org/docs/latest/general/)
- [Configuration](https://www.chartjs.org/docs/latest/configuration/)
- [Charts](https://www.chartjs.org/docs/latest/charts/)
- [Axes](https://www.chartjs.org/docs/latest/axes/)
- [Developers](https://www.chartjs.org/docs/latest/developers/)
- [Popular Extensions](https://github.com/chartjs/awesome)
- [Samples](https://www.chartjs.org/samples/)
* [Introduction](https://www.chartjs.org/docs/latest/)
* [Getting Started](https://www.chartjs.org/docs/latest/getting-started/)
* [General](https://www.chartjs.org/docs/latest/general/)
* [Configuration](https://www.chartjs.org/docs/latest/configuration/)
* [Charts](https://www.chartjs.org/docs/latest/charts/)
* [Axes](https://www.chartjs.org/docs/latest/axes/)
* [Developers](https://www.chartjs.org/docs/latest/developers/)
* [Popular Extensions](https://github.com/chartjs/awesome)
* [Samples](https://www.chartjs.org/samples/)

## Contributing

Expand Down
20 changes: 10 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

### Installation
## Installation

```
$ npm install
```bash
npm install
```

### Local Development
## Local Development

```
$ npm run start
```bash
npm run start
```

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ npm run build
```bash
npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

```
$ GIT_USER=<Your GitHub username> USE_SSH=true npm run deploy
```bash
GIT_USER=<Your GitHub username> USE_SSH=true npm run deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
6 changes: 3 additions & 3 deletions docs/docs/charts/area.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Both [line](./line.mdx) and [radar](./radar.mdx) charts support a `fill` option

> <sup>1</sup> for backward compatibility, `fill: true` is equivalent to `fill: 'origin'`<br/>

**Example**
### Example

```javascript
new Chart(ctx, {
Expand All @@ -44,7 +44,7 @@ If you need to support multiple colors when filling from one dataset to another,
| `above` | `Color` | If no color is set, the default color will be the background color of the chart. |
| `below` | `Color` | Same as the above. |

**Example**
### Example with multiple colors

```javascript
new Chart(ctx, {
Expand Down Expand Up @@ -74,7 +74,7 @@ new Chart(ctx, {

If `true`, the fill area will be recursively extended to the visible target defined by the `fill` value of hidden dataset targets:

**Example**
#### Example using propagate

```javascript
new Chart(ctx, {
Expand Down
1 change: 1 addition & 0 deletions docs/docs/configuration/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The layout configuration is passed into the `options.layout` namespace. The glob
| `padding` | `number`\|`object` | `0` | Yes | The padding to add inside the chart. [more...](#padding)

## Padding

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.

Lets say you wanted to add 50px of padding to the left side of the chart canvas, you would do:
Expand Down
1 change: 0 additions & 1 deletion docs/docs/configuration/tooltip.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ var chart = new Chart(ctx, {
});
```


### Tooltip Item Context

The tooltip items passed to the tooltip callbacks implement the following interface.
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/developers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Developer features allow extending and enhancing Chart.js in many different ways

Latest documentation and samples, including unreleased features, are available at:

- https://www.chartjs.org/docs/master/
- https://www.chartjs.org/samples/master/
- <https://www.chartjs.org/docs/master/>
- <https://www.chartjs.org/samples/master/>

## Development releases

Latest builds are available for testing at:

- https://www.chartjs.org/dist/master/chart.js
- https://www.chartjs.org/dist/master/chart.min.js
- <https://www.chartjs.org/dist/master/chart.js>
- <https://www.chartjs.org/dist/master/chart.min.js>

**WARNING: Development builds MUST not be used for production purposes or as replacement for CDN.**

Expand Down
2 changes: 2 additions & 0 deletions docs/docs/general/interactions/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ The following properties define how the chart interacts with events.
| `onClick` | `function` | `null` | Called if the event is of type `'mouseup'` or `'click'`. Passed the event, an array of active elements, and the chart.

## Event Option

For example, to have the chart only respond to click events, you could do:

```javascript
var chart = new Chart(ctx, {
type: 'line',
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/general/interactions/modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ var chart = new Chart(ctx, {
```

## 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.

```javascript
Expand All @@ -87,6 +88,7 @@ var chart = new Chart(ctx, {
```

## 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.

```javascript
Expand All @@ -102,6 +104,7 @@ var chart = new Chart(ctx, {
```

## 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.

```javascript
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/general/locale.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A Unicode BCP 47 locale identifier consists of
4. (optionally) one or more variant codes, and
5. (optionally) one or more extension sequences,

with all present components separated by hyphens.
with all present components separated by hyphens.

By default the chart is using the default locale of the platform which is running on.

Expand Down
1 change: 1 addition & 0 deletions docs/docs/general/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ new Chart(ctx, {
Chromium (Chrome: version 69, Edge: 79, Opera: 56) added the ability to [transfer rendering control of a canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen) to a web worker. Web workers can use the [OffscreenCanvas API](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) to render from a web worker onto canvases in the DOM. Chart.js is a canvas-based library and supports rendering in a web worker - just pass an OffscreenCanvas into the Chart constructor instead of a Canvas element. Note that as of today, this API is only supported in Chromium based browsers.

By moving all Chart.js calculations onto a separate thread, the main thread can be freed up for other uses. Some tips and tricks when using Chart.js in a web worker:

* Transferring data between threads can be expensive, so ensure that your config and data objects are as small as possible. Try generating them on the worker side if you can (workers can make HTTP requests!) or passing them to your worker as ArrayBuffers, which can be transferred quickly from one thread to another.
* You can't transfer functions between threads, so if your config object includes functions you'll have to strip them out before transferring and then add them back later.
* You can't access the DOM from worker threads, so Chart.js plugins that use the DOM (including any mouse interactions) will likely not work.
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/general/responsive.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ You may also find that, due to complexities in when the browser lays out the doc

```javascript
window.addEventListener('beforeprint', () => {
myChart.resize(600, 600);
myChart.resize(600, 600);
});
window.addEventListener('afterprint', () => {
myChart.resize();
myChart.resize();
});
```
10 changes: 7 additions & 3 deletions docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@ title: Installation
---

## npm

[![npm](https://img.shields.io/npm/v/chart.js.svg?style=flat-square&maxAge=600)](https://npmjs.com/package/chart.js)
[![npm](https://img.shields.io/npm/dm/chart.js.svg?style=flat-square&maxAge=600)](https://npmjs.com/package/chart.js)

```sh
npm install chart.js
npm install chart.js
```

## CDN

### CDNJS

[![cdnjs](https://img.shields.io/cdnjs/v/Chart.js.svg?style=flat-square&maxAge=600)](https://cdnjs.com/libraries/Chart.js)

Chart.js built files are available on [CDNJS](https://cdnjs.com/):

https://cdnjs.com/libraries/Chart.js
<https://cdnjs.com/libraries/Chart.js>

### jsDelivr

[![jsdelivr](https://img.shields.io/npm/v/chart.js.svg?label=jsdelivr&style=flat-square&maxAge=600)](https://cdn.jsdelivr.net/npm/chart.js@latest/dist/) [![jsdelivr hits](https://data.jsdelivr.com/v1/package/npm/chart.js/badge)](https://www.jsdelivr.com/package/npm/chart.js)

Chart.js built files are also available through [jsDelivr](https://www.jsdelivr.com/):

https://www.jsdelivr.com/package/npm/chart.js?path=dist
<https://www.jsdelivr.com/package/npm/chart.js?path=dist>

## Github

[![github](https://img.shields.io/github/release/chartjs/Chart.js.svg?style=flat-square&maxAge=600)](https://github.com/chartjs/Chart.js/releases/latest)

You can download the latest version of [Chart.js on GitHub](https://github.com/chartjs/Chart.js/releases/latest).
Expand Down
1 change: 1 addition & 0 deletions docs/docs/getting-started/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var myChart = new Chart(ctx, {...});
Chart.js 3 is tree-shakeable, so it is necessary to import and register the controllers, elements, scales and plugins you are going to use.

For all available imports see the example below.

```javascript
import {
Chart,
Expand Down
32 changes: 16 additions & 16 deletions docs/docs/getting-started/v3-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ A few changes were made to controllers that are more straight-forward, but will

The following properties and methods were removed:

#### Chart
#### Removed from Chart

* `Chart.animationService`
* `Chart.active`
Expand Down Expand Up @@ -294,14 +294,14 @@ The following properties and methods were removed:
* `Chart.Tooltip` is now provided by the tooltip plugin. The positioners can be accessed from `tooltipPlugin.positioners`
* `ILayoutItem.minSize`

#### Dataset Controllers
#### Removed from Dataset Controllers

* `BarController.getDatasetMeta().bar`
* `DatasetController.addElementAndReset`
* `DatasetController.createMetaData`
* `DatasetController.createMetaDataset`

#### Elements
#### Removed from Elements

* `Element.getArea`
* `Element.height`
Expand All @@ -310,7 +310,7 @@ The following properties and methods were removed:
* `Element.inLabelRange`
* `Line.calculatePointY`

#### Helpers
#### Removed from Helpers

* `helpers.addEvent`
* `helpers.aliasPixel`
Expand All @@ -336,11 +336,11 @@ The following properties and methods were removed:
* `helpers.scaleMerge`
* `helpers.where`

#### Layout
#### Removed from Layout

* `Layout.defaults`

#### Scales
#### Removed from Scales

* `LinearScaleBase.handleDirectionalChanges`
* `LogarithmicScale.minNotZero`
Expand All @@ -354,7 +354,7 @@ The following properties and methods were removed:
* `TimeScale.getLabelCapacity` is now private
* `TimeScale.tickFormatFunction` is now private

#### Plugins (Legend, Title, and Tooltip)
#### Removed from Plugins (Legend, Title, and Tooltip)

* `IPlugin.afterScaleUpdate`. Use `afterLayout` instead
* `Legend.margins` is now private
Expand Down Expand Up @@ -448,12 +448,12 @@ The private APIs listed below were renamed:

The APIs listed in this section have changed in signature or behaviour from version 2.

#### Scales
#### Changed in Scales

* `Scale.getLabelForIndex` was replaced by `scale.getLabelForValue`
* `Scale.getPixelForValue` now has only one parameter. For the `TimeScale` that parameter must be millis since the epoch

##### Ticks
##### Changed in Ticks

* `Scale.afterBuildTicks` now has no parameters like the other callbacks
* `Scale.buildTicks` is now expected to return tick objects
Expand All @@ -462,11 +462,11 @@ The APIs listed in this section have changed in signature or behaviour from vers
* When the `autoSkip` option is enabled, `Scale.ticks` now contains only the non-skipped ticks instead of all ticks.
* Ticks are now always generated in monotonically increasing order

##### Time Scale
##### Changed in Time Scale

* `getValueForPixel` now returns milliseconds since the epoch

#### Controllers
#### Changed in Controllers

##### Core Controller

Expand All @@ -478,15 +478,15 @@ The APIs listed in this section have changed in signature or behaviour from vers
* `updateElement` was replaced with `updateElements` now taking the elements to update, the `start` index, `count`, and `mode`
* `setHoverStyle` and `removeHoverStyle` now additionally take the `datasetIndex` and `index`

#### Interactions
#### Changed in Interactions

* Interaction mode methods now return an array of objects containing the `element`, `datasetIndex`, and `index`

#### Layout
#### Changed in Layout

* `ILayoutItem.update` no longer has a return value

#### Helpers
#### Changed in Helpers

All helpers are now exposed in a flat hierarchy, e.g., `Chart.helpers.canvas.clipArea` -> `Chart.helpers.clipArea`

Expand All @@ -498,14 +498,14 @@ All helpers are now exposed in a flat hierarchy, e.g., `Chart.helpers.canvas.cli
* `helpers.clear` was renamed to `helpers.clearCanvas` and now takes `canvas` and optionally `ctx` as parameter(s).
* `helpers.retinaScale` accepts optional third parameter `forceStyle`, which forces overriding current canvas style. `forceRatio` no longer falls back to `window.devicePixelRatio`, instead it defaults to `1`.

#### Platform
#### Changed in Platform

* `Chart.platform` is no longer the platform object used by charts. Every chart instance now has a separate platform instance.
* `Chart.platforms` is an object that contains two usable platform classes, `BasicPlatform` and `DomPlatform`. It also contains `BasePlatform`, a class that all platforms must extend from.
* If the canvas passed in is an instance of `OffscreenCanvas`, the `BasicPlatform` is automatically used.
* `isAttached` method was added to platform.

#### IPlugin interface
#### Changed in IPlugin interface

* All plugin hooks have unified signature with 3 arguments: `chart`, `args` and `options`. This means change in signature for these hooks: `beforeInit`, `afterInit`, `reset`, `beforeLayout`, `afterLayout`, `beforeRender`, `afterRender`, `beforeDraw`, `afterDraw`, `beforeDatasetsDraw`, `afterDatasetsDraw`, `beforeEvent`, `afterEvent`, `resize`, `destroy`.
* `afterDatasetsUpdate`, `afterUpdate`, `beforeDatasetsUpdate`, and `beforeUpdate` now receive `args` object as second argument. `options` argument is always the last and thus was moved from 2nd to 3rd place.
Expand Down
Loading