Repository: chartjs/Chart.js
Branch: master
Commit: a15355686107
Files: 1068
Total size: 2.5 MB
Directory structure:
gitextract_dt3kbibo/
├── .browserslistrc
├── .codeclimate.yml
├── .editorconfig
├── .eslintignore
├── .eslintrc.yml
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug.yml
│ │ ├── config.yml
│ │ ├── docs.yml
│ │ └── feature.yml
│ ├── ISSUE_TEMPLATE.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── dependabot.yml
│ ├── release-drafter.yml
│ └── workflows/
│ ├── ci.yml
│ ├── compressed-size.yml
│ ├── deploy-docs.yml
│ ├── release-drafter.yml
│ └── release.yml
├── .gitignore
├── .htmllintrc
├── LICENSE.md
├── MAINTAINING.md
├── README.md
├── auto/
│ ├── auto.cjs
│ ├── auto.d.ts
│ ├── auto.js
│ └── package.json
├── composer.json
├── docs/
│ ├── .vuepress/
│ │ ├── config.ts
│ │ ├── redirects
│ │ └── styles/
│ │ └── index.styl
│ ├── axes/
│ │ ├── _common.md
│ │ ├── _common_ticks.md
│ │ ├── cartesian/
│ │ │ ├── _common.md
│ │ │ ├── _common_ticks.md
│ │ │ ├── category.md
│ │ │ ├── index.md
│ │ │ ├── linear.md
│ │ │ ├── logarithmic.md
│ │ │ ├── time.md
│ │ │ └── timeseries.md
│ │ ├── index.md
│ │ ├── labelling.md
│ │ ├── radial/
│ │ │ ├── index.md
│ │ │ └── linear.md
│ │ └── styling.md
│ ├── charts/
│ │ ├── area.md
│ │ ├── bar.md
│ │ ├── bubble.md
│ │ ├── doughnut.md
│ │ ├── line.md
│ │ ├── mixed.md
│ │ ├── polar.md
│ │ ├── radar.md
│ │ └── scatter.md
│ ├── configuration/
│ │ ├── animations.md
│ │ ├── canvas-background.md
│ │ ├── decimation.md
│ │ ├── device-pixel-ratio.md
│ │ ├── elements.md
│ │ ├── index.md
│ │ ├── interactions.md
│ │ ├── layout.md
│ │ ├── legend.md
│ │ ├── locale.md
│ │ ├── responsive.md
│ │ ├── subtitle.md
│ │ ├── title.md
│ │ └── tooltip.md
│ ├── developers/
│ │ ├── api.md
│ │ ├── axes.md
│ │ ├── charts.md
│ │ ├── contributing.md
│ │ ├── index.md
│ │ ├── plugin_flowcharts.drawio
│ │ ├── plugins.md
│ │ ├── publishing.md
│ │ └── updates.md
│ ├── general/
│ │ ├── accessibility.md
│ │ ├── colors.md
│ │ ├── data-structures.md
│ │ ├── fonts.md
│ │ ├── options.md
│ │ ├── padding.md
│ │ └── performance.md
│ ├── getting-started/
│ │ ├── index.md
│ │ ├── installation.md
│ │ ├── integration.md
│ │ ├── usage.md
│ │ └── using-from-node-js.md
│ ├── index.md
│ ├── migration/
│ │ ├── v3-migration.md
│ │ └── v4-migration.md
│ ├── package.json
│ ├── samples/
│ │ ├── .eslintrc.yml
│ │ ├── advanced/
│ │ │ ├── data-decimation.md
│ │ │ ├── derived-axis-type.md
│ │ │ ├── derived-chart-type.md
│ │ │ ├── linear-gradient.md
│ │ │ ├── programmatic-events.md
│ │ │ ├── progress-bar.md
│ │ │ └── radial-gradient.md
│ │ ├── animations/
│ │ │ ├── delay.md
│ │ │ ├── drop.md
│ │ │ ├── loop.md
│ │ │ ├── progressive-line-easing.md
│ │ │ └── progressive-line.md
│ │ ├── area/
│ │ │ ├── line-boundaries.md
│ │ │ ├── line-datasets.md
│ │ │ ├── line-drawtime.md
│ │ │ ├── line-stacked.md
│ │ │ └── radar.md
│ │ ├── bar/
│ │ │ ├── border-radius.md
│ │ │ ├── floating.md
│ │ │ ├── horizontal.md
│ │ │ ├── stacked-groups.md
│ │ │ ├── stacked.md
│ │ │ └── vertical.md
│ │ ├── information.md
│ │ ├── legend/
│ │ │ ├── events.md
│ │ │ ├── html.md
│ │ │ ├── point-style.md
│ │ │ ├── position.md
│ │ │ └── title.md
│ │ ├── line/
│ │ │ ├── interpolation.md
│ │ │ ├── line.md
│ │ │ ├── multi-axis.md
│ │ │ ├── point-styling.md
│ │ │ ├── segments.md
│ │ │ ├── stepped.md
│ │ │ └── styling.md
│ │ ├── other-charts/
│ │ │ ├── bubble.md
│ │ │ ├── combo-bar-line.md
│ │ │ ├── doughnut.md
│ │ │ ├── multi-series-pie.md
│ │ │ ├── pie.md
│ │ │ ├── polar-area-center-labels.md
│ │ │ ├── polar-area.md
│ │ │ ├── radar-skip-points.md
│ │ │ ├── radar.md
│ │ │ ├── scatter-multi-axis.md
│ │ │ ├── scatter.md
│ │ │ └── stacked-bar-line.md
│ │ ├── plugins/
│ │ │ ├── chart-area-border.md
│ │ │ ├── doughnut-empty-state.md
│ │ │ └── quadrants.md
│ │ ├── scale-options/
│ │ │ ├── center.md
│ │ │ ├── grid.md
│ │ │ ├── ticks.md
│ │ │ └── titles.md
│ │ ├── scales/
│ │ │ ├── linear-min-max-suggested.md
│ │ │ ├── linear-min-max.md
│ │ │ ├── linear-step-size.md
│ │ │ ├── log.md
│ │ │ ├── stacked.md
│ │ │ ├── time-combo.md
│ │ │ ├── time-line.md
│ │ │ └── time-max-span.md
│ │ ├── scriptable/
│ │ │ ├── bar.md
│ │ │ ├── bubble.md
│ │ │ ├── line.md
│ │ │ ├── pie.md
│ │ │ ├── polar.md
│ │ │ └── radar.md
│ │ ├── subtitle/
│ │ │ └── basic.md
│ │ ├── title/
│ │ │ └── alignment.md
│ │ ├── tooltip/
│ │ │ ├── content.md
│ │ │ ├── html.md
│ │ │ ├── interactions.md
│ │ │ ├── point-style.md
│ │ │ └── position.md
│ │ └── utils.md
│ └── scripts/
│ ├── analyzer.js
│ ├── components.js
│ ├── derived-bubble.js
│ ├── helpers.js
│ ├── log2.js
│ ├── register.js
│ └── utils.js
├── helpers/
│ ├── helpers.cjs
│ ├── helpers.d.ts
│ ├── helpers.js
│ └── package.json
├── karma.conf.cjs
├── package.json
├── pnpm-workspace.yaml
├── rollup.config.js
├── scripts/
│ ├── deploy-docs.sh
│ ├── docs-config.sh
│ ├── publish.sh
│ ├── sample-redirect-template.html
│ └── utils.sh
├── src/
│ ├── controllers/
│ │ ├── controller.bar.js
│ │ ├── controller.bubble.js
│ │ ├── controller.doughnut.js
│ │ ├── controller.line.js
│ │ ├── controller.pie.js
│ │ ├── controller.polarArea.js
│ │ ├── controller.radar.js
│ │ ├── controller.scatter.js
│ │ └── index.js
│ ├── core/
│ │ ├── core.adapters.ts
│ │ ├── core.animation.js
│ │ ├── core.animations.defaults.js
│ │ ├── core.animations.js
│ │ ├── core.animator.js
│ │ ├── core.config.js
│ │ ├── core.controller.js
│ │ ├── core.datasetController.js
│ │ ├── core.defaults.js
│ │ ├── core.element.ts
│ │ ├── core.interaction.js
│ │ ├── core.layouts.defaults.js
│ │ ├── core.layouts.js
│ │ ├── core.plugins.js
│ │ ├── core.registry.js
│ │ ├── core.scale.autoskip.js
│ │ ├── core.scale.defaults.js
│ │ ├── core.scale.js
│ │ ├── core.ticks.js
│ │ ├── core.typedRegistry.js
│ │ └── index.ts
│ ├── elements/
│ │ ├── element.arc.ts
│ │ ├── element.bar.js
│ │ ├── element.line.js
│ │ ├── element.point.ts
│ │ └── index.js
│ ├── helpers/
│ │ ├── helpers.canvas.ts
│ │ ├── helpers.collection.ts
│ │ ├── helpers.color.ts
│ │ ├── helpers.config.ts
│ │ ├── helpers.config.types.ts
│ │ ├── helpers.core.ts
│ │ ├── helpers.curve.ts
│ │ ├── helpers.dataset.ts
│ │ ├── helpers.dom.ts
│ │ ├── helpers.easing.ts
│ │ ├── helpers.extras.ts
│ │ ├── helpers.interpolation.ts
│ │ ├── helpers.intl.ts
│ │ ├── helpers.math.ts
│ │ ├── helpers.options.ts
│ │ ├── helpers.rtl.ts
│ │ ├── helpers.segment.js
│ │ └── index.ts
│ ├── index.ts
│ ├── index.umd.ts
│ ├── platform/
│ │ ├── index.js
│ │ ├── platform.base.js
│ │ ├── platform.basic.js
│ │ └── platform.dom.js
│ ├── plugins/
│ │ ├── index.js
│ │ ├── plugin.colors.ts
│ │ ├── plugin.decimation.js
│ │ ├── plugin.filler/
│ │ │ ├── filler.drawing.js
│ │ │ ├── filler.helper.js
│ │ │ ├── filler.options.js
│ │ │ ├── filler.segment.js
│ │ │ ├── filler.target.js
│ │ │ ├── filler.target.stack.js
│ │ │ ├── index.js
│ │ │ └── simpleArc.js
│ │ ├── plugin.legend.js
│ │ ├── plugin.subtitle.js
│ │ ├── plugin.title.js
│ │ └── plugin.tooltip.js
│ ├── scales/
│ │ ├── index.js
│ │ ├── scale.category.js
│ │ ├── scale.linear.js
│ │ ├── scale.linearbase.js
│ │ ├── scale.logarithmic.js
│ │ ├── scale.radialLinear.js
│ │ ├── scale.time.js
│ │ └── scale.timeseries.js
│ ├── types/
│ │ ├── animation.d.ts
│ │ ├── basic.d.ts
│ │ ├── color.d.ts
│ │ ├── geometric.d.ts
│ │ ├── index.d.ts
│ │ ├── layout.d.ts
│ │ └── utils.d.ts
│ └── types.ts
├── test/
│ ├── .eslintrc.yml
│ ├── BasicChartWebWorker.js
│ ├── fixtures/
│ │ ├── controller.bar/
│ │ │ ├── aligned-pixels.js
│ │ │ ├── backgroundColor/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── loopable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── bar-animation-hide-show.js
│ │ │ ├── bar-base-value.js
│ │ │ ├── bar-default-begin-at-zero.js
│ │ │ ├── bar-thickness-absolute.json
│ │ │ ├── bar-thickness-flex-offset.json
│ │ │ ├── bar-thickness-flex-single-reverse.json
│ │ │ ├── bar-thickness-flex-single.json
│ │ │ ├── bar-thickness-flex.json
│ │ │ ├── bar-thickness-max.json
│ │ │ ├── bar-thickness-min-interval-multi.json
│ │ │ ├── bar-thickness-min-interval.json
│ │ │ ├── bar-thickness-multiple.json
│ │ │ ├── bar-thickness-no-overlap.json
│ │ │ ├── bar-thickness-offset.json
│ │ │ ├── bar-thickness-per-dataset-stacked.json
│ │ │ ├── bar-thickness-per-dataset.json
│ │ │ ├── bar-thickness-reverse.json
│ │ │ ├── bar-thickness-single-xy.json
│ │ │ ├── bar-thickness-single.json
│ │ │ ├── bar-thickness-stacked.json
│ │ │ ├── baseLine/
│ │ │ │ ├── bottom.js
│ │ │ │ ├── left.js
│ │ │ │ ├── mid-x.js
│ │ │ │ ├── mid-y.js
│ │ │ │ ├── right.js
│ │ │ │ ├── top.js
│ │ │ │ ├── value-x.js
│ │ │ │ └── value-y.js
│ │ │ ├── borderColor/
│ │ │ │ ├── border+dpr.js
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderRadius/
│ │ │ │ ├── border-radius-stacked-number-mixed-chart.js
│ │ │ │ ├── border-radius-stacked-number-with-order.js
│ │ │ │ ├── border-radius-stacked-number.js
│ │ │ │ ├── border-radius.js
│ │ │ │ └── no-spacing.js
│ │ │ ├── borderSkipped/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── middle.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderWidth/
│ │ │ │ ├── indexable-object.js
│ │ │ │ ├── indexable.js
│ │ │ │ ├── negative.js
│ │ │ │ ├── object.js
│ │ │ │ ├── scriptable-object.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── chart-area-clip.js
│ │ │ ├── data/
│ │ │ │ ├── object-index-axis-y.js
│ │ │ │ ├── object.js
│ │ │ │ └── parsing.js
│ │ │ ├── floatBar/
│ │ │ │ ├── data-as-objects-horizontal.js
│ │ │ │ ├── data-as-objects.js
│ │ │ │ ├── float-bar-horizontal.json
│ │ │ │ ├── float-bar-stacked-horizontal.json
│ │ │ │ ├── float-bar-stacked.json
│ │ │ │ └── float-bar.json
│ │ │ ├── horizontal-borders.js
│ │ │ ├── minBarLength/
│ │ │ │ ├── horizontal-neg.js
│ │ │ │ ├── horizontal-pos.js
│ │ │ │ ├── horizontal-stacked-no-overlap.js
│ │ │ │ ├── horizontal-stacked.js
│ │ │ │ ├── horizontal.js
│ │ │ │ ├── vertical-neg.js
│ │ │ │ ├── vertical-pos.js
│ │ │ │ ├── vertical-stacked-no-overlap.js
│ │ │ │ ├── vertical-stacked.js
│ │ │ │ └── vertical.js
│ │ │ ├── not-grouped/
│ │ │ │ ├── mixed.js
│ │ │ │ └── on-time.js
│ │ │ ├── skipNull/
│ │ │ │ ├── bar-skip-null-object-data.js
│ │ │ │ ├── bar-skip-null.js
│ │ │ │ └── combinations.js
│ │ │ └── stacking/
│ │ │ ├── issue-9105.js
│ │ │ ├── logarithmic-strings.js
│ │ │ ├── logarithmic.js
│ │ │ ├── order-default.json
│ │ │ ├── order-specified.json
│ │ │ ├── remove-dataset.js
│ │ │ ├── replace-data.js
│ │ │ └── stacked-and-multiple-axis.js
│ │ ├── controller.bubble/
│ │ │ ├── autoPadding-disabled.js
│ │ │ ├── clip.js
│ │ │ ├── hover-radius-zero.js
│ │ │ ├── padding-update.js
│ │ │ ├── padding.js
│ │ │ ├── point-style.json
│ │ │ ├── radius-data.js
│ │ │ └── radius-scriptable.js
│ │ ├── controller.doughnut/
│ │ │ ├── backgroundColor/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderAlign/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderColor/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderDash/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderJoinStyle/
│ │ │ │ ├── bevel-default.js
│ │ │ │ ├── miter.js
│ │ │ │ └── round.js
│ │ │ ├── borderRadius/
│ │ │ │ ├── scriptable.js
│ │ │ │ ├── value-corners.js
│ │ │ │ ├── value-large-radius.js
│ │ │ │ └── value-small-number.js
│ │ │ ├── borderWidth/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── doughnut-NaN.js
│ │ │ ├── doughnut-animation-hide-last.js
│ │ │ ├── doughnut-animation.js
│ │ │ ├── doughnut-border-align-center.json
│ │ │ ├── doughnut-border-align-inner.json
│ │ │ ├── doughnut-circumference-over-2pi.json
│ │ │ ├── doughnut-circumference-per-dataset.js
│ │ │ ├── doughnut-circumference.json
│ │ │ ├── doughnut-full-to-semi.js
│ │ │ ├── doughnut-hidden-single.js
│ │ │ ├── doughnut-hidden.js
│ │ │ ├── doughnut-offset.js
│ │ │ ├── doughnut-outer-radius-percent.js
│ │ │ ├── doughnut-outer-radius-pixels.js
│ │ │ ├── doughnut-parsing.js
│ │ │ ├── doughnut-rotation-300.js
│ │ │ ├── doughnut-rotation-circumference-8x8.js
│ │ │ ├── doughnut-rotation-per-dataset.js
│ │ │ ├── doughnut-set-active-elements.js
│ │ │ ├── doughnut-spacing-and-offset.js
│ │ │ ├── doughnut-spacing.js
│ │ │ ├── doughnut-weight.json
│ │ │ ├── event-replay.js
│ │ │ ├── pie-border-align-center.json
│ │ │ ├── pie-border-align-inner.json
│ │ │ ├── pie-circumference.json
│ │ │ ├── pie-offset.js
│ │ │ ├── pie-weight.json
│ │ │ ├── selfJoin/
│ │ │ │ ├── doughnut.js
│ │ │ │ └── pie.js
│ │ │ ├── single-slice-circumference-405.js
│ │ │ ├── single-slice-offset.js
│ │ │ └── single-slice-opacity.js
│ │ ├── controller.line/
│ │ │ ├── backgroundColor/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderCapStyle/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderColor/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderDash/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderDashOffset/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderJoinStyle/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderWidth/
│ │ │ │ ├── scriptable.js
│ │ │ │ ├── value.js
│ │ │ │ └── zero.js
│ │ │ ├── clip/
│ │ │ │ ├── default-x-max.json
│ │ │ │ ├── default-x-min.json
│ │ │ │ ├── default-x.json
│ │ │ │ ├── default-y-max.json
│ │ │ │ ├── default-y-min.json
│ │ │ │ ├── default-y.json
│ │ │ │ ├── false.js
│ │ │ │ └── specified.json
│ │ │ ├── cubicInterpolationMode/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── fill/
│ │ │ │ ├── no-border.js
│ │ │ │ ├── order-default.js
│ │ │ │ ├── order.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── issue-8902.js
│ │ │ ├── non-numeric-y.json
│ │ │ ├── point-style-offscreen-canvas.json
│ │ │ ├── point-style.json
│ │ │ ├── pointBackgroundColor/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── pointBorderColor/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── pointBorderWidth/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── pointStyle/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── radius/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable-to-value.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── rotation/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── segments/
│ │ │ │ ├── gap.js
│ │ │ │ ├── gradient.js
│ │ │ │ ├── range.js
│ │ │ │ ├── single.js
│ │ │ │ ├── slope.js
│ │ │ │ └── spanGaps.js
│ │ │ ├── showLine/
│ │ │ │ ├── dataset.js
│ │ │ │ └── false.js
│ │ │ └── stacking/
│ │ │ ├── bounds-data.js
│ │ │ ├── order-default.js
│ │ │ ├── order-specified.js
│ │ │ ├── single.js
│ │ │ ├── stacked-scatter.js
│ │ │ └── updates.js
│ │ ├── controller.polarArea/
│ │ │ ├── angle-array.json
│ │ │ ├── angle-lines.json
│ │ │ ├── angle-undefined.json
│ │ │ ├── backgroundColor/
│ │ │ │ ├── indexable-dataset.js
│ │ │ │ ├── indexable-element-options.js
│ │ │ │ ├── scriptable-dataset.js
│ │ │ │ ├── scriptable-element-options.js
│ │ │ │ ├── value-dataset.js
│ │ │ │ └── value-element-options.js
│ │ │ ├── border-align-center.json
│ │ │ ├── border-align-inner.json
│ │ │ ├── borderAlign/
│ │ │ │ ├── indexable-dataset.js
│ │ │ │ ├── indexable-element-options.js
│ │ │ │ ├── scriptable-dataset.js
│ │ │ │ ├── scriptable-element-options.js
│ │ │ │ ├── value-dataset.js
│ │ │ │ └── value-element-options.js
│ │ │ ├── borderColor/
│ │ │ │ ├── indexable-dataset.js
│ │ │ │ ├── indexable-element-options.js
│ │ │ │ ├── scriptable-dataset.js
│ │ │ │ ├── scriptable-element-options.js
│ │ │ │ ├── value-dataset.js
│ │ │ │ └── value-element-options.js
│ │ │ ├── borderDash/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderWidth/
│ │ │ │ ├── indexable-dataset.js
│ │ │ │ ├── indexable-element-options.js
│ │ │ │ ├── scriptable-dataset.js
│ │ │ │ ├── scriptable-element-options.js
│ │ │ │ ├── value-dataset.js
│ │ │ │ └── value-element-options.js
│ │ │ ├── last-slice-animate.js
│ │ │ ├── parse-object-data.json
│ │ │ ├── pointLabels/
│ │ │ │ ├── centered-180.js
│ │ │ │ ├── centered-45.js
│ │ │ │ ├── centered.js
│ │ │ │ ├── default-180.js
│ │ │ │ ├── default-45.js
│ │ │ │ ├── default.js
│ │ │ │ ├── displayAuto-180.js
│ │ │ │ ├── displayAuto.js
│ │ │ │ ├── overlapping.js
│ │ │ │ └── withTitle/
│ │ │ │ ├── bottom-centered-45.js
│ │ │ │ ├── bottom-centered.js
│ │ │ │ ├── left-centered-45.js
│ │ │ │ ├── left-centered.js
│ │ │ │ ├── right-centered-45.js
│ │ │ │ ├── right-centered.js
│ │ │ │ ├── top-centered-45.js
│ │ │ │ ├── top-centered.js
│ │ │ │ ├── top-default-45.js
│ │ │ │ └── top-default.js
│ │ │ ├── polar-area-animation-rotate.js
│ │ │ └── polar-area-animation-scale.js
│ │ ├── controller.radar/
│ │ │ ├── backgroundColor/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderCapStyle/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderColor/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderDash/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderDashOffset/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderJoinStyle/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── borderWidth/
│ │ │ │ ├── scriptable.js
│ │ │ │ ├── value.js
│ │ │ │ └── zero.js
│ │ │ ├── fill/
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── point-style.json
│ │ │ ├── pointBackgroundColor/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── pointBorderColor/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── pointBorderWidth/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── pointStyle/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── radius/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── rotation/
│ │ │ │ ├── indexable.js
│ │ │ │ ├── scriptable.js
│ │ │ │ └── value.js
│ │ │ ├── showLine/
│ │ │ │ └── value.js
│ │ │ └── startAngle/
│ │ │ ├── 135.js
│ │ │ ├── 180.js
│ │ │ ├── 225.js
│ │ │ ├── 270.js
│ │ │ ├── 315.js
│ │ │ ├── 45.js
│ │ │ ├── 90.js
│ │ │ └── default.js
│ │ ├── controller.scatter/
│ │ │ └── showLine/
│ │ │ ├── changed.js
│ │ │ ├── true.js
│ │ │ └── undefined.js
│ │ ├── core.datasetController/
│ │ │ └── stacked-initial-render.js
│ │ ├── core.interaction/
│ │ │ ├── drawActiveElementsOnTop-false.js
│ │ │ ├── nearest-partial-bar.js
│ │ │ └── nearest-point-behind-scale.js
│ │ ├── core.layouts/
│ │ │ ├── hidden-vertical-boxes.js
│ │ │ ├── long-labels.js
│ │ │ ├── no-boxes-all-padding.js
│ │ │ ├── refit-vertical-boxes.js
│ │ │ ├── scriptable.js
│ │ │ ├── stacked-boxes-max-index-without-clip.js
│ │ │ ├── stacked-boxes-max-index.js
│ │ │ ├── stacked-boxes-max-without-clip.js
│ │ │ ├── stacked-boxes-max.js
│ │ │ ├── stacked-boxes-with-weight.js
│ │ │ └── stacked-boxes.js
│ │ ├── core.scale/
│ │ │ ├── autoSkip/
│ │ │ │ ├── fit-after.js
│ │ │ │ ├── no-offset.js
│ │ │ │ └── offset.js
│ │ │ ├── backgroundColor.js
│ │ │ ├── border-behind-elements.js
│ │ │ ├── cartesian-axis-border-settings.json
│ │ │ ├── crossAlignment/
│ │ │ │ ├── cross-align-bottom-center.js
│ │ │ │ ├── cross-align-bottom-far.js
│ │ │ │ ├── cross-align-bottom-near.js
│ │ │ │ ├── cross-align-left-center.js
│ │ │ │ ├── cross-align-left-far-clipped.js
│ │ │ │ ├── cross-align-left-far.js
│ │ │ │ ├── cross-align-left-near.js
│ │ │ │ ├── cross-align-right-center.js
│ │ │ │ ├── cross-align-right-far-clipped.js
│ │ │ │ ├── cross-align-right-far.js
│ │ │ │ ├── cross-align-right-near.js
│ │ │ │ ├── cross-align-top-center.js
│ │ │ │ ├── cross-align-top-far.js
│ │ │ │ ├── cross-align-top-near.js
│ │ │ │ ├── mirror-cross-align-left-center.js
│ │ │ │ ├── mirror-cross-align-left-far.js
│ │ │ │ ├── mirror-cross-align-left-near.js
│ │ │ │ ├── mirror-cross-align-right-center.js
│ │ │ │ ├── mirror-cross-align-right-far.js
│ │ │ │ └── mirror-cross-align-right-near.js
│ │ │ ├── grid/
│ │ │ │ ├── border-over-grid.js
│ │ │ │ ├── colors.js
│ │ │ │ └── scriptable-borderDash.js
│ │ │ ├── label-align-center.js
│ │ │ ├── label-align-end.js
│ │ │ ├── label-align-inner-onlyX.js
│ │ │ ├── label-align-inner-reverse.js
│ │ │ ├── label-align-inner-rotate.js
│ │ │ ├── label-align-inner.js
│ │ │ ├── label-align-start.js
│ │ │ ├── label-offset-vertical-axes.json
│ │ │ ├── tick-backdrop-alignment-inner.js
│ │ │ ├── tick-backdrop-rotation.js
│ │ │ ├── tick-backdrop.js
│ │ │ ├── tick-drawing.json
│ │ │ ├── tick-override-styles.json
│ │ │ ├── ticks/
│ │ │ │ ├── rotated-long.js
│ │ │ │ ├── rotated-multi-line.js
│ │ │ │ └── skip-by-callback.js
│ │ │ ├── ticks-mirror-x.js
│ │ │ ├── ticks-mirror.js
│ │ │ ├── title/
│ │ │ │ ├── align-end.js
│ │ │ │ ├── align-start.js
│ │ │ │ ├── default.js
│ │ │ │ ├── horizontal-center.js
│ │ │ │ ├── horizontal-value.js
│ │ │ │ ├── multi-line/
│ │ │ │ │ ├── align-end.js
│ │ │ │ │ ├── align-start.js
│ │ │ │ │ └── default.js
│ │ │ │ ├── vertical-center.js
│ │ │ │ └── vertical-value.js
│ │ │ ├── x-axis-position-center.json
│ │ │ ├── x-axis-position-dynamic-margin.js
│ │ │ ├── x-axis-position-dynamic.json
│ │ │ ├── y-axis-position-center.json
│ │ │ └── y-axis-position-dynamic.json
│ │ ├── element.line/
│ │ │ ├── cubicInterpolationMode/
│ │ │ │ ├── monotone-horizontal.js
│ │ │ │ └── monotone-vertical.js
│ │ │ ├── default.js
│ │ │ ├── skip/
│ │ │ │ ├── all.js
│ │ │ │ ├── first-span.js
│ │ │ │ ├── first.js
│ │ │ │ ├── last-span.js
│ │ │ │ ├── last.js
│ │ │ │ ├── middle-span.js
│ │ │ │ └── middle.js
│ │ │ ├── stepped/
│ │ │ │ ├── after.js
│ │ │ │ ├── before.js
│ │ │ │ ├── default.js
│ │ │ │ └── middle.js
│ │ │ └── tension/
│ │ │ ├── default.js
│ │ │ ├── one.js
│ │ │ └── zero.js
│ │ ├── element.point/
│ │ │ ├── point-style-circle.json
│ │ │ ├── point-style-cross-rot.json
│ │ │ ├── point-style-cross.json
│ │ │ ├── point-style-dash.json
│ │ │ ├── point-style-image.js
│ │ │ ├── point-style-line.json
│ │ │ ├── point-style-rect-rot.json
│ │ │ ├── point-style-rect-rounded.json
│ │ │ ├── point-style-rect.json
│ │ │ ├── point-style-star.json
│ │ │ ├── point-style-triangle.json
│ │ │ └── rotation.js
│ │ ├── mixed/
│ │ │ ├── bar+line-stacked.js
│ │ │ └── bar+line.js
│ │ ├── plugin.colors/
│ │ │ ├── bar.js
│ │ │ ├── bubble.js
│ │ │ ├── chart-options-colors.js
│ │ │ ├── doughnut.js
│ │ │ ├── dynamic-datasets-default.js
│ │ │ ├── dynamic-datasets-force-override.js
│ │ │ ├── line.js
│ │ │ ├── mixed.js
│ │ │ ├── pie.js
│ │ │ ├── polarArea.js
│ │ │ ├── radar.js
│ │ │ └── scatter.js
│ │ ├── plugin.filler/
│ │ │ ├── line/
│ │ │ │ ├── above-below-vertical-linechart.js
│ │ │ │ ├── before-dataset-draw.js
│ │ │ │ ├── before-datasets-draw.js
│ │ │ │ ├── boundary/
│ │ │ │ │ ├── above-below-line-null-start.json
│ │ │ │ │ ├── above-below-line-null.json
│ │ │ │ │ ├── end-span.json
│ │ │ │ │ ├── end.json
│ │ │ │ │ ├── origin-span-dual.json
│ │ │ │ │ ├── origin-span.json
│ │ │ │ │ ├── origin-spline-above.json
│ │ │ │ │ ├── origin-spline-span.json
│ │ │ │ │ ├── origin-spline.json
│ │ │ │ │ ├── origin-stepped-span.json
│ │ │ │ │ ├── origin-stepped.json
│ │ │ │ │ ├── origin.json
│ │ │ │ │ ├── start-span.json
│ │ │ │ │ └── start.json
│ │ │ │ ├── dataset/
│ │ │ │ │ ├── border.json
│ │ │ │ │ ├── clip-bounds-x-off.js
│ │ │ │ │ ├── clip-bounds-x.js
│ │ │ │ │ ├── clip-bounds-y-off.js
│ │ │ │ │ ├── clip-bounds-y.js
│ │ │ │ │ ├── dual.json
│ │ │ │ │ ├── interpolated.js
│ │ │ │ │ ├── no-border.json
│ │ │ │ │ ├── span-dual.json
│ │ │ │ │ ├── span.json
│ │ │ │ │ ├── spline-span-above.json
│ │ │ │ │ ├── spline-span-below.json
│ │ │ │ │ ├── spline-span.json
│ │ │ │ │ ├── spline.json
│ │ │ │ │ └── stepped.json
│ │ │ │ ├── drawTimeFillFalse/
│ │ │ │ │ ├── beforeDatasetDraw.js
│ │ │ │ │ ├── beforeDatasetsDraw.js
│ │ │ │ │ └── beforeDraw.js
│ │ │ │ ├── points-outside-canvas-initial.js
│ │ │ │ ├── points-outside-canvas-update.js
│ │ │ │ ├── segments/
│ │ │ │ │ ├── alignToPixels.js
│ │ │ │ │ ├── gap.js
│ │ │ │ │ └── slope.js
│ │ │ │ ├── shape.js
│ │ │ │ ├── stack-multiple-scales.js
│ │ │ │ ├── stack.json
│ │ │ │ ├── value.json
│ │ │ │ └── vertical.js
│ │ │ └── radar/
│ │ │ ├── beforeDraw.js
│ │ │ ├── boundary/
│ │ │ │ ├── end-circular.json
│ │ │ │ ├── end-span.json
│ │ │ │ ├── end.json
│ │ │ │ ├── origin-circular.json
│ │ │ │ ├── origin-span.json
│ │ │ │ ├── origin-spline-span.json
│ │ │ │ ├── origin-spline.json
│ │ │ │ ├── origin.json
│ │ │ │ ├── start-circular.json
│ │ │ │ ├── start-span.json
│ │ │ │ └── start.json
│ │ │ ├── dataset/
│ │ │ │ ├── border.json
│ │ │ │ ├── default.json
│ │ │ │ ├── order.js
│ │ │ │ ├── span.json
│ │ │ │ └── spline.json
│ │ │ └── value.json
│ │ ├── plugin.legend/
│ │ │ ├── borderRadius/
│ │ │ │ └── legend-border-radius.js
│ │ │ ├── horizontal-rtl-hitbox.js
│ │ │ ├── label-textAlign/
│ │ │ │ ├── center.js
│ │ │ │ ├── horizontal-left.js
│ │ │ │ ├── horizontal-right.js
│ │ │ │ ├── horizontal-rtl-left.js
│ │ │ │ ├── horizontal-rtl-right.js
│ │ │ │ ├── left.js
│ │ │ │ ├── right.js
│ │ │ │ ├── rtl-center.js
│ │ │ │ ├── rtl-left.js
│ │ │ │ └── rtl-right.js
│ │ │ ├── legend-doughnut-bottom-center-mulitiline.json
│ │ │ ├── legend-doughnut-bottom-center-single.json
│ │ │ ├── legend-doughnut-bottom-end-mulitiline.json
│ │ │ ├── legend-doughnut-bottom-start-mulitiline.json
│ │ │ ├── legend-doughnut-left-center-mulitiline.json
│ │ │ ├── legend-doughnut-left-center-single.json
│ │ │ ├── legend-doughnut-left-default-center.json
│ │ │ ├── legend-doughnut-left-end-mulitiline.json
│ │ │ ├── legend-doughnut-left-start-mulitiline.json
│ │ │ ├── legend-doughnut-point-style.json
│ │ │ ├── legend-doughnut-right-center-mulitiline-labels.json
│ │ │ ├── legend-doughnut-right-center-mulitiline.json
│ │ │ ├── legend-doughnut-right-center-single.json
│ │ │ ├── legend-doughnut-right-default-center.json
│ │ │ ├── legend-doughnut-right-end-mulitiline.json
│ │ │ ├── legend-doughnut-right-start-mulitiline.json
│ │ │ ├── legend-doughnut-top-center-mulitiline.json
│ │ │ ├── legend-doughnut-top-center-single.json
│ │ │ ├── legend-doughnut-top-end-mulitiline.json
│ │ │ ├── legend-doughnut-top-start-mulitiline.json
│ │ │ ├── legend-line-chart-area.json
│ │ │ ├── maxWidth/
│ │ │ │ ├── infinity.js
│ │ │ │ ├── undefined.js
│ │ │ │ └── value.js
│ │ │ ├── padding/
│ │ │ │ ├── 2cols-with-padding.js
│ │ │ │ └── add-column.js
│ │ │ ├── pointStyle-width/
│ │ │ │ ├── legend-pointStyle-width-default.json
│ │ │ │ └── legend-pointStyle-width.json
│ │ │ └── title/
│ │ │ ├── bottom-center-center.js
│ │ │ ├── bottom-end-end.js
│ │ │ ├── bottom-start-start.js
│ │ │ ├── left-center-center.js
│ │ │ ├── left-end-end.js
│ │ │ ├── left-start-start.js
│ │ │ ├── right-center-center.js
│ │ │ ├── right-end-end.js
│ │ │ ├── right-start-start.js
│ │ │ ├── top-center-center.js
│ │ │ ├── top-end-end.js
│ │ │ └── top-start-start.js
│ │ ├── plugin.subtitle/
│ │ │ └── basic.js
│ │ ├── plugin.title/
│ │ │ └── scriptable-options.js
│ │ ├── plugin.tooltip/
│ │ │ ├── box-padding.js
│ │ │ ├── caret-position.js
│ │ │ ├── color-box-border-dash.js
│ │ │ ├── color-box-border-radius.js
│ │ │ ├── corner-radius.js
│ │ │ ├── opacity.js
│ │ │ ├── point-style.js
│ │ │ └── positioning.js
│ │ ├── scale.category/
│ │ │ ├── invalid-data.js
│ │ │ ├── max-ticks-limit-a.js
│ │ │ ├── max-ticks-limit-b.js
│ │ │ ├── max-ticks-limit-norotation.js
│ │ │ └── ticks-from-data.js
│ │ ├── scale.linear/
│ │ │ ├── grace/
│ │ │ │ ├── grace-10%.js
│ │ │ │ ├── grace-beginAtZero.js
│ │ │ │ ├── grace-neg.js
│ │ │ │ ├── grace-pos.js
│ │ │ │ ├── grace.js
│ │ │ │ └── issue-8912.js
│ │ │ ├── issue-8806.js
│ │ │ ├── min-max-skip/
│ │ │ │ ├── edge-case-1.js
│ │ │ │ ├── edge-case-2.js
│ │ │ │ ├── edge-case-3.js
│ │ │ │ ├── edge-case-4.js
│ │ │ │ ├── includeBounds.js
│ │ │ │ ├── min-max-skip.js
│ │ │ │ ├── no-collision.js
│ │ │ │ ├── rotated-case-1.js
│ │ │ │ ├── rotated-case-2.js
│ │ │ │ ├── rotated-case-3.js
│ │ │ │ └── rotated-case-4.js
│ │ │ ├── rotated-45.js
│ │ │ ├── rotated-5.js
│ │ │ ├── rotated-85.js
│ │ │ ├── tick-count-data-limits.js
│ │ │ ├── tick-count-min-max-not-aligned.js
│ │ │ ├── tick-count-min-max-not-int.js
│ │ │ ├── tick-count-min-max.js
│ │ │ ├── tick-step-min-max-step-fp.js
│ │ │ ├── tick-step-min-max.js
│ │ │ └── tiny-numbers.js
│ │ ├── scale.logarithmic/
│ │ │ ├── large-range.js
│ │ │ ├── large-values-small-range.js
│ │ │ ├── med-range.js
│ │ │ ├── min-max.js
│ │ │ ├── null-values.js
│ │ │ └── small-range.js
│ │ ├── scale.radialLinear/
│ │ │ ├── anglelines-disable.json
│ │ │ ├── anglelines-indexable.js
│ │ │ ├── anglelines-reverse-scale.js
│ │ │ ├── anglelines-scriptable.js
│ │ │ ├── backgroundColor.js
│ │ │ ├── border-dash.json
│ │ │ ├── circular-backgroundColor.js
│ │ │ ├── circular-border-dash.json
│ │ │ ├── gridlines-disable.json
│ │ │ ├── gridlines-no-z.json
│ │ │ ├── gridlines-scriptable.js
│ │ │ ├── gridlines-z.json
│ │ │ ├── indexable-gridlines.json
│ │ │ ├── pointLabels/
│ │ │ │ ├── background.js
│ │ │ │ ├── border-radius.js
│ │ │ │ ├── no-more-than-half-radius.js
│ │ │ │ ├── padding.js
│ │ │ │ └── scriptable-color-small.js
│ │ │ └── ticks-below-zero.js
│ │ ├── scale.time/
│ │ │ ├── autoskip-major.js
│ │ │ ├── bar-large-gap-between-data.js
│ │ │ ├── custom-parser.js
│ │ │ ├── data-ty.js
│ │ │ ├── data-xy.js
│ │ │ ├── invalid-data.js
│ │ │ ├── labels-date.js
│ │ │ ├── labels-strings.js
│ │ │ ├── labels.js
│ │ │ ├── negative-times.js
│ │ │ ├── offset-auto-skip-ticks.js
│ │ │ ├── offset-with-1-tick.js
│ │ │ ├── offset-with-2-ticks.js
│ │ │ ├── offset-with-no-ticks.js
│ │ │ ├── skip-null-gridlines.js
│ │ │ ├── skip-undefined-gridlines.js
│ │ │ ├── source-auto-linear.js
│ │ │ ├── source-data-linear.js
│ │ │ ├── source-labels-linear-offset-min-max.js
│ │ │ ├── source-labels-linear.js
│ │ │ ├── ticks-capacity.js
│ │ │ ├── ticks-minunit.js
│ │ │ ├── ticks-reverse-linear-min-max.js
│ │ │ ├── ticks-reverse-linear.js
│ │ │ ├── ticks-reverse-offset.js
│ │ │ ├── ticks-reverse.js
│ │ │ ├── ticks-round.js
│ │ │ ├── ticks-stepsize.js
│ │ │ └── ticks-unit.js
│ │ └── scale.timeseries/
│ │ ├── data-timestamps.js
│ │ ├── financial-daily.js
│ │ ├── normalize.js
│ │ ├── source-auto.js
│ │ ├── source-data-offset-min-max.js
│ │ ├── source-data.js
│ │ ├── source-labels-offset-min-max.js
│ │ ├── source-labels.js
│ │ ├── ticks-reverse-max.js
│ │ ├── ticks-reverse-min-max.js
│ │ ├── ticks-reverse-min.js
│ │ └── ticks-reverse.js
│ ├── index.js
│ ├── integration/
│ │ ├── node/
│ │ │ ├── package.json
│ │ │ ├── test.cjs
│ │ │ └── test.js
│ │ ├── node-commonjs/
│ │ │ ├── package.json
│ │ │ ├── test-auto.js
│ │ │ └── test.js
│ │ ├── react-browser/
│ │ │ ├── package.json
│ │ │ ├── public/
│ │ │ │ └── index.html
│ │ │ ├── src/
│ │ │ │ ├── App.tsx
│ │ │ │ ├── AppAuto.tsx
│ │ │ │ └── index.tsx
│ │ │ └── tsconfig.json
│ │ ├── typescript-node/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ └── typescript-node-next/
│ │ ├── package.json
│ │ ├── src/
│ │ │ └── index.ts
│ │ └── tsconfig.json
│ ├── seed-reporter.cjs
│ ├── specs/
│ │ ├── controller.bar.tests.js
│ │ ├── controller.bubble.tests.js
│ │ ├── controller.doughnut.tests.js
│ │ ├── controller.line.tests.js
│ │ ├── controller.polarArea.tests.js
│ │ ├── controller.radar.tests.js
│ │ ├── controller.scatter.tests.js
│ │ ├── core.animation.tests.js
│ │ ├── core.animations.tests.js
│ │ ├── core.animator.tests.js
│ │ ├── core.controller.tests.js
│ │ ├── core.datasetController.tests.js
│ │ ├── core.defaults.tests.js
│ │ ├── core.element.tests.js
│ │ ├── core.helpers.tests.js
│ │ ├── core.interaction.tests.js
│ │ ├── core.layouts.tests.js
│ │ ├── core.plugin.tests.js
│ │ ├── core.registry.tests.js
│ │ ├── core.scale.tests.js
│ │ ├── core.ticks.tests.js
│ │ ├── element.arc.tests.js
│ │ ├── element.bar.tests.js
│ │ ├── element.line.tests.js
│ │ ├── element.point.tests.js
│ │ ├── global.defaults.tests.js
│ │ ├── global.namespace.tests.js
│ │ ├── helpers.canvas.tests.js
│ │ ├── helpers.collection.tests.js
│ │ ├── helpers.color.tests.js
│ │ ├── helpers.config.tests.js
│ │ ├── helpers.core.tests.js
│ │ ├── helpers.curve.tests.js
│ │ ├── helpers.dom.tests.js
│ │ ├── helpers.easing.tests.js
│ │ ├── helpers.interpolation.tests.js
│ │ ├── helpers.math.tests.js
│ │ ├── helpers.options.tests.js
│ │ ├── helpers.segment.tests.js
│ │ ├── mixed.tests.js
│ │ ├── platform.basic.tests.js
│ │ ├── platform.dom.tests.js
│ │ ├── plugin.colors.tests.js
│ │ ├── plugin.decimation.tests.js
│ │ ├── plugin.filler.tests.js
│ │ ├── plugin.legend.tests.js
│ │ ├── plugin.subtitle.tests.js
│ │ ├── plugin.title.tests.js
│ │ ├── plugin.tooltip.tests.js
│ │ ├── scale.category.tests.js
│ │ ├── scale.linear.tests.js
│ │ ├── scale.logarithmic.tests.js
│ │ ├── scale.radialLinear.tests.js
│ │ └── scale.time.tests.js
│ └── types/
│ ├── .eslintrc.yml
│ ├── animation.ts
│ ├── autogen.js
│ ├── chart_types.ts
│ ├── controllers/
│ │ ├── bar_floating_data.ts
│ │ ├── bubble_chart_options.ts
│ │ ├── doughnut_meta_total.ts
│ │ ├── doughnut_offset.ts
│ │ ├── doughnut_outer_radius.ts
│ │ ├── doughnut_spacing_offset.ts
│ │ ├── line_scriptable_parsed_data.ts
│ │ ├── line_segments.ts
│ │ ├── line_span_gaps.ts
│ │ ├── line_styling_array.ts
│ │ └── radar_dataset_indexable_options.ts
│ ├── data_types.ts
│ ├── dataset_null_data.ts
│ ├── date_adapter.ts
│ ├── defaults.ts
│ ├── elements/
│ │ └── scriptable_element_options.ts
│ ├── extensions/
│ │ ├── plugin.ts
│ │ └── scale.ts
│ ├── helpers/
│ │ ├── dom.ts
│ │ └── options.ts
│ ├── interaction.ts
│ ├── layout/
│ │ └── position.ts
│ ├── options.ts
│ ├── overrides.ts
│ ├── parsed.data.type.ts
│ ├── plugins/
│ │ ├── defaults.ts
│ │ ├── plugin.colors/
│ │ │ └── colors.ts
│ │ ├── plugin.decimation/
│ │ │ └── decimation_algorithm.ts
│ │ ├── plugin.filler/
│ │ │ └── fill_target_true.ts
│ │ └── plugin.tooltip/
│ │ ├── chart.tooltip.ts
│ │ ├── tooltip_dataset_type.ts
│ │ ├── tooltip_parsed_data.ts
│ │ ├── tooltip_parsed_data_chart_defaults.ts
│ │ └── tooltip_scriptable_background_color.ts
│ ├── register.ts
│ ├── scales/
│ │ ├── chart_options.ts
│ │ ├── options.ts
│ │ └── time_string_max.ts
│ ├── scriptable.ts
│ ├── scriptable_core_chart_options.ts
│ ├── test_instance_assignment.ts
│ ├── ticks/
│ │ └── ticks.ts
│ └── tsconfig.json
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .browserslistrc
================================================
defaults
not IE 11
not IE_Mob 11
maintained node versions
================================================
FILE: .codeclimate.yml
================================================
version: "2"
plugins:
duplication:
enabled: true
config:
languages:
- javascript
fixme:
enabled: true
checks:
argument-count:
config:
threshold: 5
method-complexity:
config:
threshold: 7
exclude_patterns:
- "dist/"
- "docs/"
- "scripts/"
- "test/"
- "*.js"
- "*.json"
- "*.md"
- ".*"
================================================
FILE: .editorconfig
================================================
# https://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.html]
indent_style = tab
indent_size = 4
================================================
FILE: .eslintignore
================================================
dist/*
test/integration/react-browser/*
================================================
FILE: .eslintrc.yml
================================================
extends:
- chartjs
- plugin:es/restrict-to-es2018
- plugin:markdown/recommended
settings:
es:
aggressive: true
env:
es6: true
browser: true
node: true
parserOptions:
ecmaVersion: 2022
sourceType: module
ecmaFeatures:
impliedStrict: true
modules: true
plugins: ['html', 'es']
rules:
class-methods-use-this: "off"
complexity: ["warn", 10]
max-statements: ["warn", 30]
no-empty-function: "off"
no-use-before-define: ["error", { "functions": false }]
# disable everything, except Rest/Spread Properties in ES2018
es/no-import-meta: "off"
es/no-async-iteration: "error"
es/no-malformed-template-literals: "error"
es/no-regexp-lookbehind-assertions: "error"
es/no-regexp-named-capture-groups: "error"
es/no-regexp-s-flag: "error"
es/no-regexp-unicode-property-escapes: "error"
es/no-dynamic-import: "off"
overrides:
- files: ['**/*.ts']
parser: '@typescript-eslint/parser'
plugins:
- '@typescript-eslint'
extends:
- chartjs
- plugin:@typescript-eslint/recommended
rules:
complexity: ["warn", 10]
max-statements: ["warn", 30]
# Replace stock eslint rules with typescript-eslint equivalents for proper
# TypeScript support.
indent: "off"
"@typescript-eslint/indent": ["error", 2]
no-use-before-define: "off"
'@typescript-eslint/no-use-before-define': "error"
no-shadow: "off"
'@typescript-eslint/no-shadow': "error"
space-before-function-paren: "off"
'@typescript-eslint/space-before-function-paren': [2, never]
================================================
FILE: .github/ISSUE_TEMPLATE/bug.yml
================================================
name: Bug Report
description: Something went awry
labels: ["type: bug"]
body:
- type: markdown
attributes:
value: |
Need help or support?
Please don't open an issue! Head to https://stackoverflow.com/questions/tagged/chart.js.
- type: markdown
attributes:
value: "Bug reports MUST be submitted with an interactive example: https://codepen.io/leelenaleee/pen/WNyJXEe."
- type: markdown
attributes:
value: Chart.js versions lower then 4.x are NOT supported anymore, new issues will be disregarded.
- type: textarea
attributes:
label: Expected behavior
description: Tell us what should happen.
validations:
required: true
- type: textarea
attributes:
label: Current behavior
description: Tell us what happens instead of the expected behavior.
validations:
required: true
- type: input
attributes:
label: Reproducible sample
description: |
Please provide issue reproduction.
You can use [this codepen](https://codepen.io/leelenaleee/pen/WNyJXEe) to make a reproducible sample.
Major framework wrappers for chart.js templates:
[vue-chart-3 sandbox (Vue)](https://codesandbox.io/s/vue-chart-3-chart-js-issue-template-bpg7k?file=/src/App.vue)
[ng2-charts sandbox (Angular)](https://codesandbox.io/s/ng2charts-chart-js-issue-template-fhezt?file=/src/app/app.component.ts)
[react-chartjs-2 sandbox (React)](https://codesandbox.io/p/sandbox/react-chartjs-2-chart-js-issue-template-v4-forked-lqz5tn?file=%2Fsrc%2FApp.tsx)
For typescript issues you can make use of [this TS Playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMMa8fAA0iGxwOXAwemDSAFyk6sBxJOnZuSLoMOglCNW5ueroAEbS6nQlANqmAErSIqaZpjrqEtKjcKYAml3qEPEzpgDiUNJyqwAKElBgmqsA8lC+yqYAulWsLS219XQqPXC9Tbd3n22d6iUkAMRwCB4OAANQgMGkDBun0+DwarwAjAAmTKIgCcmQAzJkAKyZVFwLHXZp3bCXUnYGG5CBgGDACCyF7vT50MjoTTM0ktPiNbl3fk5KmCuB6PkfWFwEXYfkyiU4NjYWyMIA) to make a reproducible sample.
If filing a bug against `master`, you may reference the latest code via
https://www.chartjs.org/dist/master/chart.umd.min.js (changing the filename to
point at the file you need as appropriate). Do not rely on these files for
production purposes as they may be removed at any time.
validations:
required: true
- type: textarea
attributes:
label: Optional extra steps/info to reproduce
- type: textarea
attributes:
label: Possible solution
description: If you have suggestions on a fix for the bug.
- type: textarea
attributes:
label: Context
description: |
How has this issue affected you? What are you trying to accomplish?
Providing context helps us come up with a solution that is most useful in the real world.
- type: input
attributes:
label: chart.js version
description: Which version of `chart.js` are you using?
placeholder: "v0.0.0"
validations:
required: true
- type: input
attributes:
label: Browser name and version
- type: input
attributes:
label: Link to your project
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Support, Help, and Advice
url: https://stackoverflow.com/questions/tagged/chart.js
about: Need help or support? Head to https://stackoverflow.com/questions/tagged/chart.js
================================================
FILE: .github/ISSUE_TEMPLATE/docs.yml
================================================
name: Documentation
description: Are the docs lacking or missing something?
labels: ["type: documentation"]
body:
- type: checkboxes
attributes:
label: "Documentation Is:"
options:
- label: Missing or needed?
- label: Confusing
- label: Not sure?
- type: textarea
attributes:
label: Please Explain in Detail...
validations:
required: true
- type: textarea
attributes:
label: Your Proposal for Changes
validations:
required: true
- type: input
attributes:
label: Example
description: |
Provide a link to a live example demonstrating the issue or feature to be documented:
Normal: https://codepen.io/pen?template=BapRepQ
TS: [TS Playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMMa8fAA0iGxwOXAwemDSAFyk6sBxJOnZuSLoMOglCNW5ueroAEbS6nQlANqmAErSIqaZpjrqEtKjcKYAml3qEPEzpgDiUNJyqwAKElBgmqsA8lC+yqYAulWsLS219XQqPXC9Tbd3n22d6iUkAMRwCB4OAANQgMGkDBun0+DwarwAjAAmTKIgCcmQAzJkAKyZVFwLHXZp3bCXUnYGG5CBgGDACCyF7vT50MjoTTM0ktPiNbl3fk5KmCuB6PkfWFwEXYfkyiU4NjYWyMIA)
================================================
FILE: .github/ISSUE_TEMPLATE/feature.yml
================================================
name: Feature Request
description: Suggest an idea
labels: ["type: enhancement"]
body:
- type: markdown
attributes:
value: |
Most features should start as plugins outside of Chart.js
(https://www.chartjs.org/docs/latest/developers/plugins.html).
Please consider whether your changes are useful for all users, or if this is
specific to your usecase and a Chart.js plugin would be more appropriate.
Need help or tech support? Please don't open an issue!
Head to https://stackoverflow.com/questions/tagged/chart.js
- type: textarea
attributes:
label: Feature Proposal
description: |
What are you trying to accomplish?
Providing context helps us come up with a solution that is most useful in the real world
validations:
required: true
- type: textarea
attributes:
label: Possible Implementation
description: Not obligatory, but suggest ideas for how to implement the addition or change
================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
================================================
FILE: .github/release-drafter.yml
================================================
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: 'Breaking Changes'
labels:
- 'breaking change'
- title: 'Enhancements'
labels:
- 'type: enhancement'
- title: 'Performance'
labels:
- 'type: performance'
- title: 'Bugs Fixed'
labels:
- 'type: bug'
- title: 'Types'
labels:
- 'type: types'
- title: 'Documentation'
labels:
- 'type: documentation'
- title: 'Development'
labels:
- 'type: chore'
- 'dependencies'
exclude-labels:
- 'type: infrastructure'
change-template: '- #$NUMBER $TITLE'
change-title-escapes: '\<*_&`#@'
version-resolver:
major:
labels:
- 'breaking change'
minor:
labels:
- 'type: enhancement'
patch:
labels:
- 'type: bug'
- 'type: chore'
- 'type: types'
default: patch
template: |
# Essential Links
* [npm](https://www.npmjs.com/package/chart.js)
* [Migration guide](https://www.chartjs.org/docs/$RESOLVED_VERSION/migration/v4-migration.html)
* [Docs](https://www.chartjs.org/docs/$RESOLVED_VERSION/)
* [API](https://www.chartjs.org/docs/$RESOLVED_VERSION/api/)
* [Samples](https://www.chartjs.org/docs/$RESOLVED_VERSION/samples/information.html)
$CHANGES
Thanks to $CONTRIBUTORS
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
branches:
- master
- "2.9"
pull_request:
branches:
- master
- "2.9"
workflow_dispatch:
permissions:
contents: read
jobs:
build:
permissions:
checks: write # for coverallsapp/github-action to create new checks
contents: read # for dorny/paths-filter to fetch a list of changed files
pull-requests: read # for dorny/paths-filter to read pull requests
runs-on: ${{ matrix.os }}
outputs:
coveralls: ${{ steps.changes.outputs.src }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4.2.0
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 16
cache: pnpm
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
docs:
- 'docs/**'
- 'package.json'
- 'tsconfig.json'
src:
- 'src/**'
- 'package.json'
test:
- 'test/**'
- 'karma.conf.js'
- 'package.json'
types:
- 'package.json'
- 'tsconfig.json'
- name: Install
run: pnpm install
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
- name: Test
if: |
(steps.changes.outputs.src == 'true' ||
steps.changes.outputs.test == 'true') &&
runner.os != 'Windows'
run: |
pnpm run build
if [ "${{ runner.os }}" == "macOS" ]; then
pnpm run test-ci --browsers chrome,safari
else
xvfb-run --auto-servernum pnpm run test-ci
fi
shell: bash
- name: Package
if: steps.changes.outputs.docs == 'true'
run: |
pnpm run docs
pnpm pack
- name: Coveralls Parallel - Chrome
if: |
steps.changes.outputs.src == 'true' &&
runner.os != 'Windows'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: './coverage/chrome/lcov.info'
flag-name: ${{ matrix.os }}-chrome
parallel: true
- name: Coveralls Parallel - Firefox
if: |
steps.changes.outputs.src == 'true' &&
runner.os != 'Windows'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: './coverage/firefox/lcov.info'
flag-name: ${{ matrix.os }}-firefox
parallel: true
finish:
permissions:
checks: write # for coverallsapp/github-action to create new checks
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
if: needs.build.outputs.coveralls == 'true'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
================================================
FILE: .github/workflows/compressed-size.yml
================================================
name: Compressed Size
on: [pull_request]
permissions:
contents: read
jobs:
build:
permissions:
checks: write # for preactjs/compressed-size-action to create and update the checks
contents: read # for actions/checkout to fetch code
issues: write # for preactjs/compressed-size-action to create comments
pull-requests: write # for preactjs/compressed-size-action to write a PR review
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4.2.0
- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
================================================
FILE: .github/workflows/deploy-docs.yml
================================================
# This workflow publishes new documentation to https://chartjs.org/docs/master after every commit
name: Deploy docs
on:
push:
branches:
- master
permissions:
contents: read
jobs:
correct_repository:
permissions:
contents: none
runs-on: ubuntu-latest
steps:
- name: fail on fork
if: github.repository_owner != 'chartjs'
run: exit 1
build:
needs: correct_repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4.2.0
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 16
cache: pnpm
- name: Package & Deploy Docs
run: |
pnpm install
pnpm run build
./scripts/docs-config.sh "master"
pnpm run docs
pnpm pack
./scripts/deploy-docs.sh "master"
env:
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
GH_AUTH_EMAIL: ${{ secrets.GH_AUTH_EMAIL }}
================================================
FILE: .github/workflows/release-drafter.yml
================================================
name: Release Drafter
on:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: read
jobs:
correct_repository:
permissions:
contents: none
runs-on: ubuntu-latest
steps:
- name: fail on fork
if: github.repository_owner != 'chartjs'
run: exit 1
update_release_draft:
permissions:
contents: write # for release-drafter/release-drafter to create a github release
pull-requests: write # for release-drafter/release-drafter to add label to PR
needs: correct_repository
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/release.yml
================================================
name: Release
on:
release:
types: [published]
permissions:
contents: read
jobs:
setup:
permissions:
contents: none
runs-on: ubuntu-latest
outputs:
version: ${{ steps.trim.outputs.version }}
steps:
- id: trim
run: echo "version=${TAG:1}" >> $GITHUB_OUTPUT
env:
TAG: ${{ github.event.release.tag_name }}
release:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4.2.0
- uses: actions/setup-node@v6
with:
registry-url: https://registry.npmjs.org/
node-version: 16
cache: pnpm
- name: Setup and build
run: |
pnpm install
pnpm install -g json
json -I -f package.json -e "this.version=\"$VERSION\""
pnpm run build
./scripts/docs-config.sh "$VERSION" release
pnpm run docs
pnpm pack
env:
VERSION: ${{ needs.setup.outputs.version }}
- name: Publish to NPM
run: ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
VERSION: ${{ needs.setup.outputs.version }}
- name: Deploy Docs
run: ./scripts/deploy-docs.sh "$VERSION" release
env:
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
GH_AUTH_EMAIL: ${{ secrets.GH_AUTH_EMAIL }}
VERSION: ${{ needs.setup.outputs.version }}
- name: Upload NPM package file
id: upload-npm-package-file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.setup.outputs.version }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ format('chart.js-{0}.tgz', needs.setup.outputs.version) }}
asset_name: ${{ format('chart.js-{0}.tgz', needs.setup.outputs.version) }}
asset_content_type: application/gzip
release-tag:
needs: [setup, release]
runs-on: ubuntu-latest
if: "!github.event.release.prerelease"
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4.2.0
- uses: actions/setup-node@v6
with:
registry-url: https://registry.npmjs.org/
node-version: 16
cache: pnpm
- name: Setup and build
run: |
pnpm install
pnpm install -g json
json -I -f package.json -e "this.version=\"$VERSION\""
pnpm run build
./scripts/docs-config.sh "$VERSION"
pnpm run docs
env:
VERSION: ${{ needs.setup.outputs.version }}
- name: Deploy Docs
run: ./scripts/deploy-docs.sh "$VERSION"
env:
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
GH_AUTH_EMAIL: ${{ secrets.GH_AUTH_EMAIL }}
VERSION: ${{ needs.setup.outputs.version }}
================================================
FILE: .gitignore
================================================
# Deployment
/coverage
/custom
/dist
/gh-pages
# Node.js
node_modules/
npm-debug.log*
# Docs
.cache-loader
build/
# Generated type docs
docs/api
docs/.vuepress/dist
# Development
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.idea
.project
.settings
.vscode
.zed
*.log
*.swp
*.stackdump
# Generated
/test/types/autogen*.ts
# Eslint
.eslintcache
================================================
FILE: .htmllintrc
================================================
{
"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
}
================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)
Copyright (c) 2014-2024 Chart.js Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: MAINTAINING.md
================================================
# 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
1. Update the release version on [GitHub](https://github.com/chartjs/Chart.js/releases/new) for the release drafted by the `release-drafter` tool
2. Publish the release
3. follow the build process on [GitHub Actions](https://github.com/chartjs/Chart.js/actions?query=workflow%3A%22Node.js+Package%22)
Creation of this tag triggers a new build:
* `Chart.js.zip` package is generated, containing dist files and examples
* `dist/*.js`, `types/*.ts`, and `Chart.js.zip` are attached to the GitHub release (downloads)
* A new npm package is published on [npmjs](https://www.npmjs.com/package/chart.js)
Finally, [cdnjs](https://cdnjs.com/libraries/Chart.js) is automatically updated from the npm release.
### Releasing a patch version
If there is a need to create a patch version for an older release:
1. Create a branch for the patch version (without the `v` prefix)
2. Cherry pick the needed commit(s) to that new branch from master
3. Trigger the release-drafter workflow on that branch from the actions.
4. Follow the procedure for [Releasing a New Version](#releasing-a-new-version)
### Further Reading
* [GitHub Action releases](https://github.com/chartjs/Chart.js/pull/7891)
* [dist/* files](https://github.com/chartjs/Chart.js/issues/3033)
* [cdnjs npm auto update](https://github.com/cdnjs/cdnjs/pull/8401)
================================================
FILE: README.md
================================================

Simple yet flexible JavaScript charting for designers & developers
## Documentation
All the links point to the new version 4 of the lib.
* [Introduction](https://www.chartjs.org/docs/latest/)
* [Getting Started](https://www.chartjs.org/docs/latest/getting-started/index)
* [General](https://www.chartjs.org/docs/latest/general/data-structures)
* [Configuration](https://www.chartjs.org/docs/latest/configuration/index)
* [Charts](https://www.chartjs.org/docs/latest/charts/line)
* [Axes](https://www.chartjs.org/docs/latest/axes/index)
* [Developers](https://www.chartjs.org/docs/latest/developers/index)
* [Popular Extensions](https://github.com/chartjs/awesome)
* [Samples](https://www.chartjs.org/samples/)
In case you are looking for an older version of the docs, you will have to specify the specific version in the url like this: [https://www.chartjs.org/docs/2.9.4/](https://www.chartjs.org/docs/2.9.4/)
## Contributing
Instructions on building and testing Chart.js can be found in [the documentation](https://www.chartjs.org/docs/master/developers/contributing.html#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://www.chartjs.org/docs/master/developers/contributing) first. For support, please post questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/chart.js) with the `chart.js` tag.
## License
Chart.js is available under the [MIT license](LICENSE.md).
================================================
FILE: auto/auto.cjs
================================================
const chartjs = require('../dist/chart.cjs');
const {Chart, registerables} = chartjs;
Chart.register(...registerables);
module.exports = Object.assign(Chart, chartjs);
================================================
FILE: auto/auto.d.ts
================================================
import {Chart} from '../dist/types.js';
export * from '../dist/types.js';
export default Chart;
================================================
FILE: auto/auto.js
================================================
import {Chart, registerables} from '../dist/chart.js';
Chart.register(...registerables);
export * from '../dist/chart.js';
export default Chart;
================================================
FILE: auto/package.json
================================================
{
"name": "chart.js-auto",
"private": true,
"description": "Auto registering package. Exists to support bundlers without exports support such as webpack 4.",
"type": "module",
"main": "./auto.cjs",
"module": "./auto.js",
"exports": {
"types": "./auto.d.ts",
"import": "./auto.js",
"require": "./auto.cjs"
},
"types": "./auto.d.ts"
}
================================================
FILE: composer.json
================================================
{
"name": "nnnick/chartjs",
"type": "library",
"description": "Simple HTML5 charts using the canvas element.",
"keywords": [
"chart",
"js"
],
"homepage": "https://www.chartjs.org/",
"license": "MIT",
"authors": [
{
"name": "NICK DOWNIE",
"email": "hello@nickdownie.com"
}
],
"require": {
"php": ">=5.3.3"
},
"minimum-stability": "stable",
"extra": {
"branch-alias": {
"release/2.0": "v2.0-dev"
}
}
}
================================================
FILE: docs/.vuepress/config.ts
================================================
import * as path from 'path';
import markdownItInclude from 'markdown-it-include';
import { DefaultThemeConfig, defineConfig, PluginTuple } from 'vuepress/config';
const docsVersion = "VERSION";
const base: `/${string}/` = process.env.NODE_ENV === "development" ? '/docs/master/' : `/docs/${docsVersion}/`;
export default defineConfig({
title: 'Chart.js',
description: 'Open source HTML5 Charts for your website',
theme: 'chartjs',
base,
dest: path.resolve(__dirname, '../../dist/docs'),
head: [
['link', {rel: 'icon', href: '/favicon.ico'}],
],
plugins: [
'tabs',
['flexsearch'],
['@vuepress/html-redirect', {
countdown: 0,
}],
[
'@vuepress/google-analytics',
{
'ga': 'UA-28909194-3'
}
],
['redirect', {
redirectors: [
// Default sample page when accessing /samples.
{base: '/samples', alternative: ['information']},
],
}],
['vuepress-plugin-code-copy', true],
['vuepress-plugin-typedoc', {
entryPoints: ['../../src/types/index.d.ts'],
hideInPageTOC: true,
tsconfig: path.resolve(__dirname, '../../tsconfig.json'),
},
],
['@simonbrunel/vuepress-plugin-versions', {
filters: {
suffix: (tag) => tag ? ` (${tag})` : '',
title: (v, vars) => {
return window.location.href.includes('master') ? 'Development (master)' :
vars.tag === 'latest' ? 'Latest (' + v + ')' :
v + (vars.tag ? ` (${vars.tag})` : '') + ' (outdated)';
},
},
menu: {
text: '{{version|title}}',
items: [
{
text: 'Documentation',
items: [
{
text: 'Development (master)',
link: '/docs/master/',
},
{
text: 'Latest version',
link: '/docs/latest/',
},
{
type: 'versions',
text: '{{version}}{{tag|suffix}}',
link: '/docs/{{version}}/',
exclude: /^[01]\.|2\.[0-5]\./,
group: 'minor',
}
]
},
{
text: 'Release notes (5 latest)',
items: [
{
type: 'versions',
limit: 5,
target: '_blank',
group: 'patch',
link: 'https://github.com/chartjs/Chart.js/releases/tag/v{{version}}'
}
]
}
]
},
}],
] as PluginTuple[],
chainWebpack(config) {
config.merge({
resolve: {
alias: {
'chart.js': path.resolve(__dirname, '../../dist/chart.js'),
}
}
})
config.module.rule('images').use('url-loader').tap(options => ({
...options,
esModule: false
}))
},
markdown: {
extendMarkdown: md => {
md.use(markdownItInclude, path.resolve(__dirname, '../'));
}
},
themeConfig: {
repo: 'chartjs/Chart.js',
logo: '/favicon.ico',
lastUpdated: 'Last Updated',
searchPlaceholder: 'Search...',
editLinks: false,
docsDir: 'docs',
chart: {
imports: [
['scripts/register.js'],
['scripts/utils.js', 'Utils'],
['scripts/helpers.js', 'helpers'],
['scripts/components.js', 'components']
]
},
nav: [
{text: 'Home', link: '/'},
{text: 'API', link: '/api/'},
{text: 'Samples', link: `/samples/`},
{
text: 'Ecosystem',
ariaLabel: 'Community Menu',
items: [
{ text: 'Awesome', link: 'https://github.com/chartjs/awesome' },
{ text: 'Discord', link: 'https://discord.gg/HxEguTK6av' },
{ text: 'Stack Overflow', link: 'https://stackoverflow.com/questions/tagged/chart.js' }
]
}
],
sidebar: {
'/api/': 'API',
'/samples/': [
'information',
{
title: 'Bar Charts',
children: [
'bar/border-radius',
'bar/floating',
'bar/horizontal',
'bar/stacked',
'bar/stacked-groups',
'bar/vertical',
]
},
{
title: 'Line Charts',
children: [
'line/interpolation',
'line/line',
'line/multi-axis',
'line/point-styling',
'line/segments',
'line/stepped',
'line/styling',
]
},
{
title: 'Other charts',
children: [
'other-charts/bubble',
'other-charts/combo-bar-line',
'other-charts/doughnut',
'other-charts/multi-series-pie',
'other-charts/pie',
'other-charts/polar-area',
'other-charts/polar-area-center-labels',
'other-charts/radar',
'other-charts/radar-skip-points',
'other-charts/scatter',
'other-charts/scatter-multi-axis',
'other-charts/stacked-bar-line',
]
},
{
title: 'Area charts',
children: [
'area/line-boundaries',
'area/line-datasets',
'area/line-drawtime',
'area/line-stacked',
'area/radar'
]
},
{
title: 'Scales',
children: [
'scales/linear-min-max',
'scales/linear-min-max-suggested',
'scales/linear-step-size',
'scales/log',
'scales/stacked',
'scales/time-line',
'scales/time-max-span',
'scales/time-combo',
]
},
{
title: 'Scale Options',
children: [
'scale-options/center',
'scale-options/grid',
'scale-options/ticks',
'scale-options/titles',
]
},
{
title: 'Legend',
children: [
'legend/events',
'legend/html',
'legend/point-style',
'legend/position',
'legend/title',
]
},
{
title: 'Title',
children: [
'title/alignment',
]
},
{
title: 'Subtitle',
children: [
'subtitle/basic',
]
}, {
title: 'Tooltip',
children: [
'tooltip/content',
'tooltip/html',
'tooltip/interactions',
'tooltip/point-style',
'tooltip/position',
]
},
{
title: 'Scriptable Options',
children: [
'scriptable/bar',
'scriptable/bubble',
'scriptable/line',
'scriptable/pie',
'scriptable/polar',
'scriptable/radar',
]
},
{
title: 'Animations',
children: [
'animations/delay',
'animations/drop',
'animations/loop',
'animations/progressive-line',
'animations/progressive-line-easing',
]
},
{
title: 'Advanced',
children: [
'advanced/data-decimation',
'advanced/derived-axis-type',
'advanced/derived-chart-type',
'advanced/linear-gradient',
'advanced/programmatic-events',
'advanced/progress-bar',
'advanced/radial-gradient',
]
},
{
title: 'Plugins',
children: [
'plugins/chart-area-border',
'plugins/doughnut-empty-state',
'plugins/quadrants',
]
},
'utils'
],
'/': [
'',
{
title: 'Getting Started',
children: [
'getting-started/',
'getting-started/installation',
'getting-started/integration',
'getting-started/usage',
'getting-started/using-from-node-js',
]
},
{
title: 'General',
children: [
'general/accessibility',
'general/colors',
'general/data-structures',
'general/fonts',
'general/options',
'general/padding',
'general/performance'
]
},
{
title: 'Configuration',
children: [
'configuration/',
'configuration/animations',
'configuration/canvas-background',
'configuration/decimation',
'configuration/device-pixel-ratio',
'configuration/elements',
'configuration/interactions',
'configuration/layout',
'configuration/legend',
'configuration/locale',
'configuration/responsive',
'configuration/subtitle',
'configuration/title',
'configuration/tooltip',
]
},
{
title: 'Chart Types',
children: [
'charts/area',
'charts/bar',
'charts/bubble',
'charts/doughnut',
'charts/line',
'charts/mixed',
'charts/polar',
'charts/radar',
'charts/scatter',
]
},
{
title: 'Axes',
children: [
'axes/',
{
title: 'Cartesian',
children: [
'axes/cartesian/',
'axes/cartesian/category',
'axes/cartesian/linear',
'axes/cartesian/logarithmic',
'axes/cartesian/time',
'axes/cartesian/timeseries'
],
},
{
title: 'Radial',
children: [
'axes/radial/',
'axes/radial/linear'
],
},
'axes/labelling',
'axes/styling'
]
},
{
title: 'Developers',
children: [
'developers/',
'developers/api',
'developers/axes',
'developers/charts',
'developers/contributing',
'developers/plugins',
'developers/publishing',
['api/', 'TypeDoc'],
'developers/updates',
]
},
{
title: 'Migration',
children: [
'migration/v4-migration',
'migration/v3-migration',
]
},
],
} as any
} as DefaultThemeConfig
});
================================================
FILE: docs/.vuepress/redirects
================================================
/charts/ /charts/line.html
/general/ /general/data-structures.html
/samples/ /samples/information.html
/getting-started/v3-migration/ /migration/v3-migration.html
================================================
FILE: docs/.vuepress/styles/index.styl
================================================
@require '~vuepress-plugin-tabs/dist/themes/default.styl'
.theme-default-content
&:not(.custom)
max-width: unset
.chart-view
max-width 800px
.sidebar-group.is-sub-group.depth-1
> .sidebar-group-items
border-left 1px solid rgba($accentColor, 0.25)
> .sidebar-heading:not(.open)
border-left 1px solid rgba($accentColor, 0.25)
margin-left: 0
> .sidebar-heading
padding-left calc(1.475rem - 1px)
transition border-color .25s
padding 0.35rem 1.475rem
border-left-width 3px
margin-left -1px
font-size 1em
line-height 1.4
opacity 1 !important
&.active, &.open
border-left-color $accentColor
color $accentColor
font-weight bold
>.arrow
display none
>.sidebar-group-items
padding-left: 0
.sidebar-group.is-sub-group.depth-1:hover .sidebar-heading:not(.open)
color $accentColor
margin-left -1px
border-left 3px solid rgba($accentColor, 0.25)
padding-left calc(1.475rem - 1px)
================================================
FILE: docs/axes/_common.md
================================================
### Common options to all axes
Namespace: `options.scales[scaleId]`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `type` | `string` | | Type of scale being employed. Custom scales can be created and registered with a string key. This allows changing the type of an axis for a chart.
| `alignToPixels` | `boolean` | `false` | Align pixel values to device pixels.
| `backgroundColor` | [`Color`](/general/colors.md) | | Background color of the scale area.
| `border` | `object` | | Border configuration. [more...](/axes/styling.md#border-configuration)
| `display` | `boolean`\|`string` | `true` | Controls the axis global visibility (visible when `true`, hidden when `false`). When `display: 'auto'`, the axis is visible only if at least one associated dataset is visible.
| `grid` | `object` | | Grid line configuration. [more...](/axes/styling.md#grid-line-configuration)
| `min` | `number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](/axes/index.md#axis-range-settings)
| `max` | `number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](/axes/index.md#axis-range-settings)
| `reverse` | `boolean` | `false` | Reverse the scale.
| `stacked` | `boolean`\|`string` | `false` | Should the data be stacked. [more...](/axes/index.md#stacking)
| `suggestedMax` | `number` | | Adjustment used when calculating the maximum data value. [more...](/axes/index.md#axis-range-settings)
| `suggestedMin` | `number` | | Adjustment used when calculating the minimum data value. [more...](/axes/index.md#axis-range-settings)
| `ticks` | `object` | | Tick configuration. [more...](/axes/index.md#tick-configuration)
| `weight` | `number` | `0` | The weight used to sort the axis. Higher weights are further away from the chart area.
================================================
FILE: docs/axes/_common_ticks.md
================================================
### Common tick options to all axes
Namespace: `options.scales[scaleId].ticks`
| Name | Type | Scriptable | Default | Description
| ---- | ---- | :-------------------------------: | ------- | -----------
| `backdropColor` | [`Color`](../../general/colors.md) | Yes | `'rgba(255, 255, 255, 0.75)'` | Color of label backdrops.
| `backdropPadding` | [`Padding`](../../general/padding.md) | | `2` | Padding of label backdrop.
| `callback` | `function` | | | Returns the string representation of the tick value as it should be displayed on the chart. See [callback](/axes/labelling.md#creating-custom-tick-formats).
| `display` | `boolean` | | `true` | If true, show tick labels.
| `color` | [`Color`](/general/colors.md) | Yes | `Chart.defaults.color` | Color of ticks.
| `font` | `Font` | Yes | `Chart.defaults.font` | See [Fonts](/general/fonts.md)
| `major` | `object` | | `{}` | [Major ticks configuration](/axes/styling.md#major-tick-configuration).
| `padding` | `number` | | `3` | Sets the offset of the tick labels from the axis
| `showLabelBackdrop` | `boolean` | Yes | `true` for radial scale, `false` otherwise | If true, draw a background behind the tick labels.
| `textStrokeColor` | [`Color`](/general/colors.md) | Yes | `` | The color of the stroke around the text.
| `textStrokeWidth` | `number` | Yes | `0` | Stroke width around the text.
| `z` | `number` | | `0` | z-index of tick layer. Useful when ticks are drawn on chart area. Values <= 0 are drawn under datasets, > 0 on top.
================================================
FILE: docs/axes/cartesian/_common.md
================================================
### Common options to all cartesian axes
Namespace: `options.scales[scaleId]`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `bounds` | `string` | `'ticks'` | Determines the scale bounds. [more...](./index.md#scale-bounds)
| `clip` | `boolean` | `true` | If true, clip the dataset drawing against the size of the scale instead of chart area
| `position` | `string` \| `object` | | Position of the axis. [more...](./index.md#axis-position)
| `stack` | `string` | | Stack group. Axes at the same `position` with same `stack` are stacked.
| `stackWeight` | `number` | 1 | Weight of the scale in stack group. Used to determine the amount of allocated space for the scale within the group.
| `axis` | `string` | | Which type of axis this is. Possible values are: `'x'`, `'y'`. If not set, this is inferred from the first character of the ID which should be `'x'` or `'y'`.
| `offset` | `boolean` | `false` | If true, extra space is added to the both edges and the axis is scaled to fit into the chart area. This is set to `true` for a bar chart by default.
| `title` | `object` | | Scale title configuration. [more...](../labelling.md#scale-title-configuration)
================================================
FILE: docs/axes/cartesian/_common_ticks.md
================================================
### Common tick options to all cartesian axes
Namespace: `options.scales[scaleId].ticks`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `align` | `string` | `'center'` | The tick alignment along the axis. Can be `'start'`, `'center'`, `'end'`, or `'inner'`. `inner` alignment means align `start` for first tick and `end` for the last tick of horizontal axis
| `crossAlign` | `string` | `'near'` | The tick alignment perpendicular to the axis. Can be `'near'`, `'center'`, or `'far'`. See [Tick Alignment](/axes/cartesian/#tick-alignment)
| `sampleSize` | `number` | `ticks.length` | The number of ticks to examine when deciding how many labels will fit. Setting a smaller value will be faster, but may be less accurate when there is large variability in label length.
| `autoSkip` | `boolean` | `true` | If true, automatically calculates how many labels can be shown and hides labels accordingly. Labels will be rotated up to `maxRotation` before skipping any. Turn `autoSkip` off to show all labels no matter what.
| `autoSkipPadding` | `number` | `3` | Padding between the ticks on the horizontal axis when `autoSkip` is enabled.
| `includeBounds` | `boolean` | `true` | Should the defined `min` and `max` values be presented as ticks even if they are not "nice".
| `labelOffset` | `number` | `0` | Distance in pixels to offset the label from the centre point of the tick (in the x-direction for the x-axis, and the y-direction for the y-axis). *Note: this can cause labels at the edges to be cropped by the edge of the canvas*
| `maxRotation` | `number` | `50` | Maximum rotation for tick labels when rotating to condense labels. Note: Rotation doesn't occur until necessary. *Note: Only applicable to horizontal scales.*
| `minRotation` | `number` | `0` | Minimum rotation for tick labels. *Note: Only applicable to horizontal scales.*
| `mirror` | `boolean` | `false` | Flips tick labels around axis, displaying the labels inside the chart instead of outside. *Note: Only applicable to vertical scales.*
| `padding` | `number` | `0` | Padding between the tick label and the axis. When set on a vertical axis, this applies in the horizontal (X) direction. When set on a horizontal axis, this applies in the vertical (Y) direction.
| `maxTicksLimit` | `number` | `11` | Maximum number of ticks and gridlines to show.
================================================
FILE: docs/axes/cartesian/category.md
================================================
# Category Axis
If the global configuration is used, labels are drawn from one of the label arrays included in the chart data. If only `data.labels` is defined, this will be used. If `data.xLabels` is defined and the axis is horizontal, this will be used. Similarly, if `data.yLabels` is defined and the axis is vertical, this property will be used. Using both `xLabels` and `yLabels` together can create a chart that uses strings for both the X and Y axes.
Specifying any of the settings above defines the x-axis as `type: 'category'` if not defined otherwise. For more fine-grained control of category labels, it is also possible to add `labels` as part of the category axis definition. Doing so does not apply the global defaults.
## Category Axis Definition
Globally:
```javascript
let chart = new Chart(ctx, {
type: ...
data: {
labels: ['January', 'February', 'March', 'April', 'May', 'June'],
datasets: ...
}
});
```
As part of axis definition:
```javascript
let chart = new Chart(ctx, {
type: ...
data: ...
options: {
scales: {
x: {
type: 'category',
labels: ['January', 'February', 'March', 'April', 'May', 'June']
}
}
}
});
```
## Configuration Options
### Category Axis specific options
Namespace: `options.scales[scaleId]`
| Name | Type | Description
| ---- | ---- | -----------
| `min` | `string`\|`number` | The minimum item to display. [more...](#min-max-configuration)
| `max` | `string`\|`number` | The maximum item to display. [more...](#min-max-configuration)
| `labels` | `string[]`\|`string[][]` | An array of labels to display. When an individual label is an array of strings, each item is rendered on a new line.
!!!include(axes/cartesian/_common.md)!!!
!!!include(axes/_common.md)!!!
## Tick Configuration
!!!include(axes/cartesian/_common_ticks.md)!!!
!!!include(axes/_common_ticks.md)!!!
## Min Max Configuration
For both the `min` and `max` properties, the value must be `string` in the `labels` array or `numeric` value as an index of a label in that array. In the example below, the x axis would only display "March" through "June".
```javascript
let chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
data: [10, 20, 30, 40, 50, 60]
}],
labels: ['January', 'February', 'March', 'April', 'May', 'June']
},
options: {
scales: {
x: {
min: 'March'
}
}
}
});
```
## Internal data format
Internally category scale uses label indices
================================================
FILE: docs/axes/cartesian/index.md
================================================
# Cartesian Axes
Axes that follow a cartesian grid are known as 'Cartesian Axes'. Cartesian axes are used for line, bar, and bubble charts. Five cartesian axes are included in Chart.js by default.
* [linear](./linear.md)
* [logarithmic](./logarithmic.md)
* [category](./category.md)
* [time](./time.md)
* [timeseries](./timeseries.md)
## Visual Components
A cartesian axis is composed of visual components that can be individually configured. These components are:
* [border](#border)
* [grid lines](#grid-lines)
* [tick](#ticks-and-tick-marks)
* [tick mark](#ticks-and-tick-marks)
* [title](#title)
### Border
The axis border is drawn at the edge of the axis, beside the chart area. In the image below, it is drawn in red.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'line',
data,
options: {
scales: {
x: {
border: {
color: 'red'
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Grid lines
The grid lines for an axis are drawn on the chart area. In the image below, they are red.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'line',
data,
options: {
scales: {
x: {
grid: {
color: 'red',
borderColor: 'grey',
tickColor: 'grey'
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Ticks and Tick Marks
Ticks represent data values on the axis that appear as labels. The tick mark is the extension of the grid line from the axis border to the label.
In this example, the tick mark is drawn in red while the tick label is drawn in blue.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'line',
data,
options: {
scales: {
x: {
grid: {
tickColor: 'red'
},
ticks: {
color: 'blue',
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Title
The title component of the axis is used to label the data. In the example below, it is shown in red.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'line',
data,
options: {
scales: {
x: {
title: {
color: 'red',
display: true,
text: 'Month'
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
## Common Configuration
:::tip Note
These are only the common options supported by all cartesian axes. Please see the specific axis documentation for all the available options for that axis.
:::
!!!include(axes/cartesian/_common.md)!!!
!!!include(axes/_common.md)!!!
### Axis Position
An axis can either be positioned at the edge of the chart, at the center of the chart area, or dynamically with respect to a data value.
To position the axis at the edge of the chart, set the `position` option to one of: `'top'`, `'left'`, `'bottom'`, `'right'`.
To position the axis at the center of the chart area, set the `position` option to `'center'`. In this mode, either the `axis` option must be specified or the axis ID has to start with the letter 'x' or 'y'. This is so chart.js knows what kind of axis (horizontal or vertical) it is.
To position the axis with respect to a data value, set the `position` option to an object such as:
```javascript
{
x: -20
}
```
This will position the axis at a value of -20 on the axis with ID "x". For cartesian axes, only 1 axis may be specified.
### Scale Bounds
The `bounds` property controls the scale boundary strategy (bypassed by `min`/`max` options).
* `'data'`: makes sure data are fully visible, labels outside are removed
* `'ticks'`: makes sure ticks are fully visible, data outside are truncated
### Tick Configuration
:::tip Note
These are only the common tick options supported by all cartesian axes. Please see specific axis documentation for all of the available options for that axis.
:::
!!!include(axes/cartesian/_common_ticks.md)!!!
!!!include(axes/_common_ticks.md)!!!
### Tick Alignment
The alignment of ticks is primarily controlled using two settings on the tick configuration object: `align` and `crossAlign`. The `align` setting configures how labels align with the tick mark along the axis direction (i.e. horizontal for a horizontal axis and vertical for a vertical axis). The `crossAlign` setting configures how labels align with the tick mark in the perpendicular direction (i.e. vertical for a horizontal axis and horizontal for a vertical axis). In the example below, the `crossAlign` setting is used to left align the labels on the Y axis.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 159, 64, 0.2)',
'rgba(255, 205, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(201, 203, 207, 0.2)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(255, 159, 64)',
'rgb(255, 205, 86)',
'rgb(75, 192, 192)',
'rgb(54, 162, 235)',
'rgb(153, 102, 255)',
'rgb(201, 203, 207)'
],
borderWidth: 1,
data: [65, 59, 80, 81, 56, 55, 40],
}]
};
//
//
const config = {
type: 'bar',
data,
options: {
indexAxis: 'y',
scales: {
y: {
ticks: {
crossAlign: 'far',
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
:::tip Note
The `crossAlign` setting is only effective when these preconditions are met:
* tick rotation is `0`
* axis position is `'top'`, '`left'`, `'bottom'` or `'right'`
:::
### Axis ID
The properties `dataset.xAxisID` or `dataset.yAxisID` have to match to `scales` property. This is especially needed if multi-axes charts are used.
```javascript
const myChart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
// This dataset appears on the first axis
yAxisID: 'first-y-axis'
}, {
// This dataset appears on the second axis
yAxisID: 'second-y-axis'
}]
},
options: {
scales: {
'first-y-axis': {
type: 'linear'
},
'second-y-axis': {
type: 'linear'
}
}
}
});
```
## Creating Multiple Axes
With cartesian axes, it is possible to create multiple X and Y axes. To do so, you can add multiple configuration objects to the `xAxes` and `yAxes` properties. When adding new axes, it is important to ensure that you specify the type of the new axes as default types are **not** used in this case.
In the example below, we are creating two Y axes. We then use the `yAxisID` property to map the datasets to their correct axes.
```javascript
const myChart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
data: [20, 50, 100, 75, 25, 0],
label: 'Left dataset',
// This binds the dataset to the left y axis
yAxisID: 'left-y-axis'
}, {
data: [0.1, 0.5, 1.0, 2.0, 1.5, 0],
label: 'Right dataset',
// This binds the dataset to the right y axis
yAxisID: 'right-y-axis'
}],
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
},
options: {
scales: {
'left-y-axis': {
type: 'linear',
position: 'left'
},
'right-y-axis': {
type: 'linear',
position: 'right'
}
}
}
});
```
================================================
FILE: docs/axes/cartesian/linear.md
================================================
# Linear Axis
The linear scale is used to chart numerical data. It can be placed on either the x or y-axis. The scatter chart type automatically configures a line chart to use one of these scales for the x-axis. As the name suggests, linear interpolation is used to determine where a value lies on the axis.
## Configuration Options
### Linear Axis specific options
Namespace: `options.scales[scaleId]`
| Name | Type | Description
| ---- | ---- | -----------
| `beginAtZero` | `boolean` | if true, scale will include 0 if it is not already included.
| `grace` | `number`\|`string` | Percentage (string ending with `%`) or amount (number) for added room in the scale range above and below data. [more...](#grace)
!!!include(axes/cartesian/_common.md)!!!
!!!include(axes/_common.md)!!!
## Tick Configuration
### Linear Axis specific tick options
Namespace: `options.scales[scaleId].ticks`
| Name | Type | Scriptable | Default | Description
| ---- | ---- | ------- | ------- | -----------
| `count` | `number` | Yes | `undefined` | The number of ticks to generate. If specified, this overrides the automatic generation.
| `format` | `object` | Yes | | The [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) options used by the default label formatter
| `precision` | `number` | Yes | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places.
| `stepSize` | `number` | Yes | | User-defined fixed step size for the scale. [more...](#step-size)
!!!include(axes/cartesian/_common_ticks.md)!!!
!!!include(axes/_common_ticks.md)!!!
## Step Size
If set, the scale ticks will be enumerated by multiple of `stepSize`, having one tick per increment. If not set, the ticks are labeled automatically using the nice numbers algorithm.
This example sets up a chart with a y-axis that creates ticks at `0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5`.
```javascript
let options = {
scales: {
y: {
max: 5,
min: 0,
ticks: {
stepSize: 0.5
}
}
}
};
```
## Grace
If the value is a string ending with `%`, it's treated as a percentage. If a number, it's treated as a value.
The value is added to the maximum data value and subtracted from the minimum data. This extends the scale range as if the data values were that much greater.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: ['Positive', 'Negative'],
datasets: [{
data: [100, -50],
backgroundColor: 'rgb(255, 99, 132)'
}],
};
//
//
const config = {
type: 'bar',
data,
options: {
scales: {
y: {
type: 'linear',
grace: '5%'
}
},
plugins: {
legend: false
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
## Internal data format
Internally, the linear scale uses numeric data.
================================================
FILE: docs/axes/cartesian/logarithmic.md
================================================
# Logarithmic Axis
The logarithmic scale is used to chart numerical data. It can be placed on either the x or y-axis. As the name suggests, logarithmic interpolation is used to determine where a value lies on the axis.
## Configuration Options
!!!include(axes/cartesian/_common.md)!!!
!!!include(axes/_common.md)!!!
## Tick Configuration
### Logarithmic Axis specific options
Namespace: `options.scales[scaleId].ticks`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `format` | `object` | | The [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) options used by the default label formatter
!!!include(axes/cartesian/_common_ticks.md)!!!
!!!include(axes/_common_ticks.md)!!!
## Internal data format
Internally, the logarithmic scale uses numeric data.
================================================
FILE: docs/axes/cartesian/time.md
================================================
# Time Cartesian Axis
The time scale is used to display times and dates. Data are spread according to the amount of time between data points. When building its ticks, it will automatically calculate the most comfortable unit based on the size of the scale.
## Date Adapters
The time scale **requires** both a date library and a corresponding adapter to be present. Please choose from the [available adapters](https://github.com/chartjs/awesome#adapters).
## Data Sets
### Input Data
See [data structures](../../general/data-structures.md).
### Date Formats
When providing data for the time scale, Chart.js uses timestamps defined as milliseconds since the epoch (midnight January 1, 1970, UTC) internally. However, Chart.js also supports all of the formats that your chosen date adapter accepts. You should use timestamps if you'd like to set `parsing: false` for better performance.
## Configuration Options
### Time Axis specific options
Namespace: `options.scales[scaleId]`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `min` | `number`\|`string` | | The minimum item to display. [more...](#min-max-configuration)
| `max` | `number`\|`string` | | The maximum item to display. [more...](#min-max-configuration)
| `suggestedMin` | `number`\|`string` | | The minimum item to display if there is no datapoint before it. [more...](../index.md#axis-range-settings)
| `suggestedMax` | `number`\|`string` | | The maximum item to display if there is no datapoint behind it. [more...](../index.md#axis-range-settings)
| `adapters.date` | `object` | `{}` | Options for adapter for external date library if that adapter needs or supports options
| `bounds` | `string` | `'data'` | Determines the scale bounds. [more...](./index.md#scale-bounds)
| `offsetAfterAutoskip` | `boolean` | `false` | If true, bar chart offsets are computed with auto skipped ticks.
| `ticks.source` | `string` | `'auto'` | How ticks are generated. [more...](#ticks-source)
| `time.displayFormats` | `object` | | Sets how different time units are displayed. [more...](#display-formats)
| `time.isoWeekday` | `boolean`\|`number` | `false` | If `boolean` and true and the unit is set to 'week', then the first day of the week will be Monday. Otherwise, it will be Sunday. If `number`, the index of the first day of the week (0 - Sunday, 6 - Saturday)
| `time.parser` | `string`\|`function` | | Custom parser for dates. [more...](#parser)
| `time.round` | `string` | `false` | If defined, dates will be rounded to the start of this unit. See [Time Units](#time-units) below for the allowed units.
| `time.tooltipFormat` | `string` | | The format string to use for the tooltip.
| `time.unit` | `string` | `false` | If defined, will force the unit to be a certain type. See [Time Units](#time-units) section below for details.
| `time.minUnit` | `string` | `'millisecond'` | The minimum display format to be used for a time unit.
!!!include(axes/cartesian/_common.md)!!!
!!!include(axes/_common.md)!!!
#### Time Units
The following time measurements are supported. The names can be passed as strings to the `time.unit` config option to force a certain unit.
* `'millisecond'`
* `'second'`
* `'minute'`
* `'hour'`
* `'day'`
* `'week'`
* `'month'`
* `'quarter'`
* `'year'`
For example, to create a chart with a time scale that always displayed units per month, the following config could be used.
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
x: {
type: 'time',
time: {
unit: 'month'
}
}
}
}
});
```
#### Display Formats
You may specify a map of display formats with a key for each unit:
* `millisecond`
* `second`
* `minute`
* `hour`
* `day`
* `week`
* `month`
* `quarter`
* `year`
The format string used as a value depends on the date adapter you chose to use.
For example, to set the display format for the `quarter` unit to show the month and year, the following config might be passed to the chart constructor.
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
x: {
type: 'time',
time: {
displayFormats: {
quarter: 'MMM YYYY'
}
}
}
}
}
});
```
#### Ticks Source
The `ticks.source` property controls the ticks generation.
* `'auto'`: generates "optimal" ticks based on scale size and time options
* `'data'`: generates ticks from data (including labels from data `{x|y}` objects)
* `'labels'`: generates ticks from user given `labels` ONLY
#### Parser
If this property is defined as a string, it is interpreted as a custom format to be used by the date adapter to parse the date.
If this is a function, it must return a type that can be handled by your date adapter's `parse` method.
## Min Max Configuration
For both the `min` and `max` properties, the value must be `string` that is parsable by your date adapter or a number with the amount of milliseconds that have elapsed since UNIX epoch.
In the example below the x axis will start at 7 November 2021.
```javascript
let chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
data: [{
x: '2021-11-06 23:39:30',
y: 50
}, {
x: '2021-11-07 01:00:28',
y: 60
}, {
x: '2021-11-07 09:00:28',
y: 20
}]
}],
},
options: {
scales: {
x: {
min: '2021-11-07 00:00:00',
}
}
}
});
```
## Changing the scale type from Time scale to Logarithmic/Linear scale.
When changing the scale type from Time scale to Logarithmic/Linear scale, you need to add `bounds: 'ticks'` to the scale options. Changing the `bounds` parameter is necessary because its default value is the `'data'` for the Time scale.
Initial config:
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
x: {
type: 'time',
}
}
}
});
```
Scale update:
```javascript
chart.options.scales.x = {
type: 'logarithmic',
bounds: 'ticks'
};
```
## Internal data format
Internally time scale uses milliseconds since epoch
================================================
FILE: docs/axes/cartesian/timeseries.md
================================================
# Time Series Axis
The time series scale extends from the time scale and supports all the same options. However, for the time series scale, each data point is spread equidistant.
## Example
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
x: {
type: 'timeseries',
}
}
}
});
```
## More details
Please see [the time scale documentation](./time.md) for all other details.
================================================
FILE: docs/axes/index.md
================================================
# Axes
Axes are an integral part of a chart. They are used to determine how data maps to a pixel value on the chart. In a cartesian chart, there is 1 or more X-axis and 1 or more Y-axis to map points onto the 2-dimensional canvas. These axes are known as ['cartesian axes'](./cartesian/).
In a radial chart, such as a radar chart or a polar area chart, there is a single axis that maps points in the angular and radial directions. These are known as ['radial axes'](./radial/).
Scales in Chart.js >v2.0 are significantly more powerful, but also different from those of v1.0.
* Multiple X & Y axes are supported.
* A built-in label auto-skip feature detects would-be overlapping ticks and labels and removes every nth label to keep things displayed normally.
* Scale titles are supported.
* New scale types can be extended without writing an entirely new chart type.
## Default scales
The default `scaleId`'s for cartesian charts are `'x'` and `'y'`. For radial charts: `'r'`.
Each dataset is mapped to a scale for each axis (x, y or r) it requires. The scaleId's that a dataset is mapped to is determined by the `xAxisID`, `yAxisID` or `rAxisID`.
If the ID for an axis is not specified, the first scale for that axis is used. If no scale for an axis is found, a new scale is created.
Some examples:
The following chart will have `'x'` and `'y'` scales:
```js
let chart = new Chart(ctx, {
type: 'line'
});
```
The following chart will have scales `'x'` and `'myScale'`:
```js
let chart = new Chart(ctx, {
type: 'bar',
data: {
datasets: [{
data: [1, 2, 3]
}]
},
options: {
scales: {
myScale: {
type: 'logarithmic',
position: 'right', // `axis` is determined by the position as `'y'`
}
}
}
});
```
The following chart will have scales `'xAxis'` and `'yAxis'`:
```js
let chart = new Chart(ctx, {
type: 'bar',
data: {
datasets: [{
yAxisID: 'yAxis'
}]
},
options: {
scales: {
xAxis: {
// The axis for this scale is determined from the first letter of the id as `'x'`
// It is recommended to specify `position` and / or `axis` explicitly.
type: 'time',
}
}
}
});
```
The following chart will have `'r'` scale:
```js
let chart = new Chart(ctx, {
type: 'radar'
});
```
The following chart will have `'myScale'` scale:
```js
let chart = new Chart(ctx, {
type: 'radar',
scales: {
myScale: {
axis: 'r'
}
}
});
```
## Common Configuration
:::tip Note
These are only the common options supported by all axes. Please see specific axis documentation for all the available options for that axis.
:::
!!!include(axes/_common.md)!!!
## Tick Configuration
:::tip Note
These are only the common tick options supported by all axes. Please see specific axis documentation for all the available tick options for that axis.
:::
!!!include(axes/_common_ticks.md)!!!
## Axis Range Settings
Given the number of axis range settings, it is important to understand how they all interact with each other.
The `suggestedMax` and `suggestedMin` settings only change the data values that are used to scale the axis. These are useful for extending the range of the axis while maintaining the auto-fit behaviour.
```javascript
let minDataValue = Math.min(mostNegativeValue, options.suggestedMin);
let maxDataValue = Math.max(mostPositiveValue, options.suggestedMax);
```
In this example, the largest positive value is 50, but the data maximum is expanded out to 100. However, because the lowest data value is below the `suggestedMin` setting, it is ignored.
```javascript
let chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'First dataset',
data: [0, 20, 40, 50]
}],
labels: ['January', 'February', 'March', 'April']
},
options: {
scales: {
y: {
suggestedMin: 50,
suggestedMax: 100
}
}
}
});
```
In contrast to the `suggested*` settings, the `min` and `max` settings set explicit ends to the axes. When these are set, some data points may not be visible.
## Stacking
By default, data is not stacked. If the `stacked` option of the value scale (y-axis on horizontal chart) is `true`, positive and negative values are stacked separately. Additionally, a `stack` option can be defined per dataset to further divide into stack groups [more...](../general/data-structures/#dataset-configuration).
For some charts, you might want to stack positive and negative values together. That can be achieved by specifying `stacked: 'single'`.
## Callbacks
There are a number of config callbacks that can be used to change parameters in the scale at different points in the update process. The options are supplied at the top level of the axis options.
Namespace: `options.scales[scaleId]`
| Name | Arguments | Description
| ---- | --------- | -----------
| `beforeUpdate` | `axis` | Callback called before the update process starts.
| `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.
| `beforeCalculateLabelRotation` | `axis` | Callback that runs before tick rotation is determined.
| `afterCalculateLabelRotation` | `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.
| `afterUpdate` | `axis` | Callback that runs at the end of the update process.
### Updating Axis Defaults
The default configuration for a scale can be easily changed. All you need to do is set the new options to `Chart.defaults.scales[type]`.
For example, to set the minimum value of 0 for all linear scales, you would do the following. Any linear scales created after this time would now have a minimum of 0.
```javascript
Chart.defaults.scales.linear.min = 0;
```
## Creating New Axes
To create a new axis, see the [developer docs](../developers/axes.md).
================================================
FILE: docs/axes/labelling.md
================================================
# Labeling Axes
When creating a chart, you want to tell the viewer what data they are viewing. To do this, you need to label the axis.
## Scale Title Configuration
Namespace: `options.scales[scaleId].title`, it defines options for the scale title. Note that this only applies to cartesian axes.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `display` | `boolean` | `false` | If true, display the axis title.
| `align` | `string` | `'center'` | Alignment of the axis title. Possible options are `'start'`, `'center'` and `'end'`
| `text` | `string`\|`string[]` | `''` | The text for the title. (i.e. "# of People" or "Response Choices").
| `color` | [`Color`](../general/colors.md) | `Chart.defaults.color` | Color of label.
| `strokeColor` | [`Color`](../general/colors.md) | | Color of text stroke.
| `strokeWidth` | `number` | | Size of stroke width, in pixels.
| `font` | `Font` | `Chart.defaults.font` | See [Fonts](../general/fonts.md)
| `padding` | [`Padding`](../general/padding.md) | `4` | Padding to apply around scale labels. Only `top`, `bottom` and `y` are implemented.
## Creating Custom Tick Formats
It is also common to want to change the tick marks to include information about the data type. For example, adding a dollar sign ('$').
To do this, you need to override the `ticks.callback` method in the axis configuration.
The method receives 3 arguments:
* `value` - the tick value in the **internal data format** of the associated scale. For time scale, it is a timestamp.
* `index` - the tick index in the ticks array.
* `ticks` - the array containing all of the [tick objects](../api/interfaces/Tick).
The call to the method is scoped to the scale. `this` inside the method is the scale object.
If the callback returns `null` or `undefined` the associated grid line will be hidden.
:::tip
The [category axis](../axes/cartesian/category), which is the default x-axis for line and bar charts, uses the `index` as internal data format. For accessing the label, use `this.getLabelForValue(value)`. [API: getLabelForValue](../api/classes/Scale.md#getlabelforvalue)
:::
In the following example, every label of the Y-axis would be displayed with a dollar sign at the front.
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
y: {
ticks: {
// Include a dollar sign in the ticks
callback: function(value, index, ticks) {
return '$' + value;
}
}
}
}
}
});
```
Keep in mind that overriding `ticks.callback` means that you are responsible for all formatting of the label. Depending on your use case, you may want to call the default formatter and then modify its output. In the example above, that would look like:
```javascript
// call the default formatter, forwarding `this`
return '$' + Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]);
```
Related samples:
* [Tick configuration sample](../samples/scale-options/ticks)
================================================
FILE: docs/axes/radial/index.md
================================================
# Radial Axes
Radial axes are used specifically for the radar and polar area chart types. These axes overlay the chart area, rather than being positioned on one of the edges. One radial axis is included by default in Chart.js.
* [radialLinear](./linear.md)
## Visual Components
A radial axis is composed of visual components that can be individually configured. These components are:
* [angle lines](#angle-lines)
* [grid lines](#grid-lines)
* [point labels](#point-labels)
* [ticks](#ticks)
### Angle Lines
The grid lines for an axis are drawn on the chart area. They stretch out from the center towards the edge of the canvas. In the example below, they are red.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'radar',
data,
options: {
scales: {
r: {
angleLines: {
color: 'red'
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Grid Lines
The grid lines for an axis are drawn on the chart area. In the example below, they are red.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'radar',
data,
options: {
scales: {
r: {
grid: {
color: 'red'
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Point Labels
The point labels indicate the value for each angle line. In the example below, they are red.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'radar',
data,
options: {
scales: {
r: {
pointLabels: {
color: 'red'
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Ticks
The ticks are used to label values based on how far they are from the center of the axis. In the example below, they are red.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: [10, 20, 30, 40, 50, 0, 5],
}]
};
//
//
const config = {
type: 'radar',
data,
options: {
scales: {
r: {
ticks: {
color: 'red'
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
================================================
FILE: docs/axes/radial/linear.md
================================================
# Linear Radial Axis
The linear radial scale is used to chart numerical data. As the name suggests, linear interpolation is used to determine where a value lies in relation to the center of the axis.
The following additional configuration options are provided by the radial linear scale.
## Configuration Options
### Linear Radial Axis specific options
Namespace: `options.scales[scaleId]`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `animate` | `boolean` | `true` | Whether to animate scaling the chart from the centre
| `angleLines` | `object` | | Angle line configuration. [more...](#angle-line-options)
| `beginAtZero` | `boolean` | `false` | If true, scale will include 0 if it is not already included.
| `pointLabels` | `object` | | Point label configuration. [more...](#point-label-options)
| `startAngle` | `number` | `0` | Starting angle of the scale. In degrees, 0 is at top.
### Common options for all axes
Namespace: `options.scales[scaleId]`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `type` | `string` | | Type of scale being employed. Custom scales can be created and registered with a string key. This allows changing the type of an axis for a chart.
| `alignToPixels` | `boolean` | `false` | Align pixel values to device pixels.
| `backgroundColor` | [`Color`](/general/colors.md) | | Background color of the scale area.
| `display` | `boolean`\|`string` | `true` | Controls the axis global visibility (visible when `true`, hidden when `false`). When `display: 'auto'`, the axis is visible only if at least one associated dataset is visible.
| `grid` | `object` | | Grid line configuration. [more...](#grid-line-configuration)
| `min` | `number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](/axes/index.md#axis-range-settings)
| `max` | `number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](/axes/index.md#axis-range-settings)
| `reverse` | `boolean` | `false` | Reverse the scale.
| `stacked` | `boolean`\|`string` | `false` | Should the data be stacked. [more...](/axes/index.md#stacking)
| `suggestedMax` | `number` | | Adjustment used when calculating the maximum data value. [more...](/axes/index.md#axis-range-settings)
| `suggestedMin` | `number` | | Adjustment used when calculating the minimum data value. [more...](/axes/index.md#axis-range-settings)
| `ticks` | `object` | | Tick configuration. [more...](/axes/index.md#tick-configuration)
| `weight` | `number` | `0` | The weight used to sort the axis. Higher weights are further away from the chart area.
## Tick Configuration
### Linear Radial Axis specific tick options
Namespace: `options.scales[scaleId].ticks`
| Name | Type | Scriptable | Default | Description
| ---- | ---- | ------- | ------- | -----------
| `count` | `number` | Yes | `undefined` | The number of ticks to generate. If specified, this overrides the automatic generation.
| `format` | `object` | Yes | | The [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) options used by the default label formatter
| `maxTicksLimit` | `number` | Yes | `11` | Maximum number of ticks and gridlines to show.
| `precision` | `number` | Yes | | If defined and `stepSize` is not specified, the step size will be rounded to this many decimal places.
| `stepSize` | `number` | Yes | | User defined fixed step size for the scale. [more...](#step-size)
!!!include(axes/_common_ticks.md)!!!
The scriptable context is described in [Options](../../general/options.md#tick) section.
## Grid Line Configuration
Namespace: `options.scales[scaleId].grid`, it defines options for the grid lines of the axis.
| Name | Type | Scriptable | Indexable | Default | Description
| ---- | ---- | :-------------------------------: | :-----------------------------: | ------- | -----------
| `borderDash` | `number[]` | | | `[]` | Length and spacing of dashes on grid lines. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | `number` | Yes | | `0.0` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `circular` | `boolean` | | | `false` | If true, gridlines are circular (on radar and polar area charts only).
| `color` | [`Color`](../general/colors.md) | Yes | Yes | `Chart.defaults.borderColor` | The color of the grid lines. If specified as an array, the first color applies to the first grid line, the second to the second grid line, and so on.
| `display` | `boolean` | | | `true` | If false, do not display grid lines for this axis.
| `lineWidth` | `number` | Yes | Yes | `1` | Stroke width of grid lines.
The scriptable context is described in [Options](../general/options.md#tick) section.
## Axis Range Settings
Given the number of axis range settings, it is important to understand how they all interact with each other.
The `suggestedMax` and `suggestedMin` settings only change the data values that are used to scale the axis. These are useful for extending the range of the axis while maintaining the auto-fit behaviour.
```javascript
let minDataValue = Math.min(mostNegativeValue, options.ticks.suggestedMin);
let maxDataValue = Math.max(mostPositiveValue, options.ticks.suggestedMax);
```
In this example, the largest positive value is 50, but the data maximum is expanded out to 100. However, because the lowest data value is below the `suggestedMin` setting, it is ignored.
```javascript
let chart = new Chart(ctx, {
type: 'radar',
data: {
datasets: [{
label: 'First dataset',
data: [0, 20, 40, 50]
}],
labels: ['January', 'February', 'March', 'April']
},
options: {
scales: {
r: {
suggestedMin: 50,
suggestedMax: 100
}
}
}
});
```
In contrast to the `suggested*` settings, the `min` and `max` settings set explicit ends to the axes. When these are set, some data points may not be visible.
## Step Size
If set, the scale ticks will be enumerated by multiple of `stepSize`, having one tick per increment. If not set, the ticks are labeled automatically using the nice numbers algorithm.
This example sets up a chart with a y axis that creates ticks at `0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5`.
```javascript
let options = {
scales: {
r: {
max: 5,
min: 0,
ticks: {
stepSize: 0.5
}
}
}
};
```
## Angle Line Options
The following options are used to configure angled lines that radiate from the center of the chart to the point labels.
Namespace: `options.scales[scaleId].angleLines`
| Name | Type | Scriptable | Default | Description
| ---- | ---- | ------- | ------- | -----------
| `display` | `boolean` | | `true` | If true, angle lines are shown.
| `color` | [`Color`](../../general/colors.md) | Yes | `Chart.defaults.borderColor` | Color of angled lines.
| `lineWidth` | `number` | Yes | `1` | Width of angled lines.
| `borderDash` | `number[]` | Yes1 | `[]` | Length and spacing of dashes on angled lines. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | `number` | Yes | `0.0` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
1. the `borderDash` setting only accepts a static value or a function. Passing an array of arrays is not supported.
The scriptable context is described in [Options](../../general/options.md#pointLabel) section.
## Point Label Options
The following options are used to configure the point labels that are shown on the perimeter of the scale.
Namespace: `options.scales[scaleId].pointLabels`
| Name | Type | Scriptable | Default | Description
| ---- | ---- | ------- | ------- | -----------
| `backdropColor` | [`Color`](../../general/colors.md) | `true` | `undefined` | Background color of the point label.
| `backdropPadding` | [`Padding`](../../general/padding.md) | | `2` | Padding of label backdrop.
| `borderRadius` | `number`\|`object` | `true` | `0` | Border radius of the point label
| `display` | `boolean`\|`string` | | `true` | If true, point labels are shown. When `display: 'auto'`, the label is hidden if it overlaps with another label.
| `callback` | `function` | | | Callback function to transform data labels to point labels. The default implementation simply returns the current string.
| `color` | [`Color`](../../general/colors.md) | Yes | `Chart.defaults.color` | Color of label.
| `font` | `Font` | Yes | `Chart.defaults.font` | See [Fonts](../../general/fonts.md)
| `padding` | `number` | Yes | 5 | Padding between chart and point labels.
| [`centerPointLabels`](../../samples/other-charts/polar-area-center-labels.md) | `boolean` | | `false` | If true, point labels are centered.
The scriptable context is described in [Options](../../general/options.md#pointLabel) section.
## Internal data format
Internally, the linear radial scale uses numeric data
================================================
FILE: docs/axes/styling.md
================================================
# Styling
There are a number of options to allow styling an axis. There are settings to control [grid lines](#grid-line-configuration) and [ticks](#tick-configuration).
## Grid Line Configuration
Namespace: `options.scales[scaleId].grid`, it defines options for the grid lines that run perpendicular to the axis.
| Name | Type | Scriptable | Indexable | Default | Description
| ---- | ---- | :-------------------------------: | :-----------------------------: | ------- | -----------
| `circular` | `boolean` | | | `false` | If true, gridlines are circular (on radar and polar area charts only).
| `color` | [`Color`](../general/colors.md) | Yes | Yes | `Chart.defaults.borderColor` | The color of the grid lines. If specified as an array, the first color applies to the first grid line, the second to the second grid line, and so on.
| `display` | `boolean` | | | `true` | If false, do not display grid lines for this axis.
| `drawOnChartArea` | `boolean` | | | `true` | If true, draw lines on the chart area inside the axis lines. This is useful when there are multiple axes and you need to control which grid lines are drawn.
| `drawTicks` | `boolean` | | | `true` | If true, draw lines beside the ticks in the axis area beside the chart.
| `lineWidth` | `number` | Yes | Yes | `1` | Stroke width of grid lines.
| `offset` | `boolean` | | | `false` | If true, grid lines will be shifted to be between labels. This is set to `true` for a bar chart by default.
| `tickBorderDash` | `number[]` | Yes | Yes | `[]` | Length and spacing of the tick mark line. If not set, defaults to the grid line `borderDash` value.
| `tickBorderDashOffset` | `number` | Yes | Yes | | Offset for the line dash of the tick mark. If unset, defaults to the grid line `borderDashOffset` value
| `tickColor` | [`Color`](../general/colors.md) | Yes | Yes | | Color of the tick line. If unset, defaults to the grid line color.
| `tickLength` | `number` | | | `8` | Length in pixels that the grid lines will draw into the axis area.
| `tickWidth` | `number` | Yes | Yes | | Width of the tick mark in pixels. If unset, defaults to the grid line width.
| `z` | `number` | | | `-1` | z-index of the gridline layer. Values <= 0 are drawn under datasets, > 0 on top.
The scriptable context is described in [Options](../general/options.md#tick) section.
## Tick Configuration
!!!include(axes/_common_ticks.md)!!!
The scriptable context is described in [Options](../general/options.md#tick) section.
## Major Tick Configuration
Namespace: `options.scales[scaleId].ticks.major`, it defines options for the major tick marks that are generated by the axis.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `enabled` | `boolean` | `false` | If true, major ticks are generated. A major tick will affect autoskipping and `major` will be defined on ticks in the scriptable options context.
## Border Configuration
Namespace: `options.scales[scaleId].border`, it defines options for the border that run perpendicular to the axis.
| Name | Type | Scriptable | Indexable | Default | Description
| ---- | ---- | :-------------------------------: | :-----------------------------: | ------- | -----------
| `display` | `boolean` | | | `true` | If true, draw a border at the edge between the axis and the chart area.
| `color` | [`Color`](../general/colors.md) | | | `Chart.defaults.borderColor` | The color of the border line.
| `width` | `number` | | | `1` | The width of the border line.
| `dash` | `number[]` | Yes | | `[]` | Length and spacing of dashes on grid lines. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `dashOffset` | `number` | Yes | | `0.0` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `z` | `number` | | | `0` | z-index of the border layer. Values <= 0 are drawn under datasets, > 0 on top.
================================================
FILE: docs/charts/area.md
================================================
# Area Chart
Both [line](./line.md) and [radar](./radar.md) charts support a `fill` option on the dataset object which can be used to create space between two datasets or a dataset and a boundary, i.e. the scale `origin`, `start,` or `end` (see [filling modes](#filling-modes)).
:::tip Note
This feature is implemented by the [`filler` plugin](https://github.com/chartjs/Chart.js/blob/master/src/plugins/plugin.filler/index.js).
:::
## Filling modes
| Mode | Type | Values |
| :--- | :--- | :--- |
| Absolute dataset index | `number` | `1`, `2`, `3`, ... |
| Relative dataset index | `string` | `'-1'`, `'-2'`, `'+1'`, ... |
| Boundary | `string` | `'start'`, `'end'`, `'origin'` |
| Disabled 1 | `boolean` | `false` |
| Stacked value below | `string` | `'stack'` |
| Axis value | `object` | `{ value: number; }` |
| Shape (fill inside line) | `string` | `'shape'` |
> 1 for backward compatibility, `fill: true` is equivalent to `fill: 'origin'`
### Example
```javascript
new Chart(ctx, {
data: {
datasets: [
{fill: 'origin'}, // 0: fill to 'origin'
{fill: '+2'}, // 1: fill to dataset 3
{fill: 1}, // 2: fill to dataset 1
{fill: false}, // 3: no fill
{fill: '-2'}, // 4: fill to dataset 2
{fill: {value: 25}} // 5: fill to axis value 25
]
}
});
```
If you need to support multiple colors when filling from one dataset to another, you may specify an object with the following option :
| Param | Type | Description |
| :--- | :--- | :--- |
| `target` | `number`, `string`, `boolean`, `object` | The accepted values are the same as the filling mode values, so you may use absolute and relative dataset indexes and/or boundaries. |
| `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 with multiple colors
```javascript
new Chart(ctx, {
data: {
datasets: [
{
fill: {
target: 'origin',
above: 'rgb(255, 0, 0)', // Area will be red above the origin
below: 'rgb(0, 0, 255)' // And blue below the origin
}
}
]
}
});
```
## Configuration
Namespace: `options.plugins.filler`
| Option | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `drawTime` | `string` | `beforeDatasetDraw` | Filler draw time. Supported values: `'beforeDraw'`, `'beforeDatasetDraw'`, `'beforeDatasetsDraw'`
| [`propagate`](#propagate) | `boolean` | `true` | Fill propagation when target is hidden.
### propagate
`propagate` takes a `boolean` value (default: `true`).
If `true`, the fill area will be recursively extended to the visible target defined by the `fill` value of hidden dataset targets:
#### Example using propagate
```javascript
new Chart(ctx, {
data: {
datasets: [
{fill: 'origin'}, // 0: fill to 'origin'
{fill: '-1'}, // 1: fill to dataset 0
{fill: 1}, // 2: fill to dataset 1
{fill: false}, // 3: no fill
{fill: '-2'} // 4: fill to dataset 2
]
},
options: {
plugins: {
filler: {
propagate: true
}
}
}
});
```
`propagate: true`:
-if dataset 2 is hidden, dataset 4 will fill to dataset 1
-if dataset 2 and 1 are hidden, dataset 4 will fill to `'origin'`
`propagate: false`:
-if dataset 2 and/or 4 are hidden, dataset 4 will not be filled
================================================
FILE: docs/charts/bar.md
================================================
# Bar Chart
A bar chart provides a way of showing data values represented as vertical bars. It is sometimes used to show trend data, and the comparison of multiple data sets side by side.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 159, 64, 0.2)',
'rgba(255, 205, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(201, 203, 207, 0.2)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(255, 159, 64)',
'rgb(255, 205, 86)',
'rgb(75, 192, 192)',
'rgb(54, 162, 235)',
'rgb(153, 102, 255)',
'rgb(201, 203, 207)'
],
borderWidth: 1
}]
};
//
//
const config = {
type: 'bar',
data: data,
options: {
scales: {
y: {
beginAtZero: true
}
}
},
};
//
module.exports = {
actions: [],
config: config,
};
```
## Dataset Properties
Namespaces:
* `data.datasets[index]` - options for this dataset only
* `options.datasets.bar` - options for all bar datasets
* `options.elements.bar` - options for all [bar elements](../configuration/elements.md#bar-configuration)
* `options` - options for the whole chart
The bar chart allows a number of properties to be specified for each dataset.
These are used to set display properties for a specific dataset. For example,
the color of the bars is generally set this way.
Only the `data` option needs to be specified in the dataset namespace.
| Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
| ---- | ---- | :----: | :----: | ----
| [`backgroundColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`base`](#general) | `number` | Yes | Yes |
| [`barPercentage`](#barpercentage) | `number` | - | - | `0.9` |
| [`barThickness`](#barthickness) | `number`\|`string` | - | - | |
| [`borderColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`borderSkipped`](#borderskipped) | `string`\|`boolean` | Yes | Yes | `'start'`
| [`borderWidth`](#borderwidth) | `number`\|`object` | Yes | Yes | `0`
| [`borderRadius`](#borderradius) | `number`\|`object` | Yes | Yes | `0`
| [`categoryPercentage`](#categorypercentage) | `number` | - | - | `0.8` |
| [`clip`](#general) | `number`\|`object`\|`false` | - | - |
| [`data`](#data-structure) | `object`\|`object[]`\| `number[]`\|`string[]` | - | - | **required**
| [`grouped`](#general) | `boolean` | - | - | `true` |
| [`hoverBackgroundColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes |
| [`hoverBorderColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes |
| [`hoverBorderWidth`](#interactions) | `number` | Yes | Yes | `1`
| [`hoverBorderRadius`](#interactions) | `number` | Yes | Yes | `0`
| [`indexAxis`](#general) | `string` | - | - | `'x'`
| [`inflateAmount`](#inflateamount) | `number`\|`'auto'` | Yes | Yes | `'auto'`
| [`maxBarThickness`](#maxbarthickness) | `number` | - | - | |
| [`minBarLength`](#styling) | `number` | - | - | |
| [`label`](#general) | `string` | - | - | `''`
| [`order`](#general) | `number` | - | - | `0`
| [`pointStyle`](../configuration/elements.md#point-styles) | [`pointStyle`](../configuration/elements.md#types) | Yes | - | `'circle'`
| [`skipNull`](#general) | `boolean` | - | - | |
| [`stack`](#general) | `string` | - | - | `'bar'` |
| [`xAxisID`](#general) | `string` | - | - | first x axis
| [`yAxisID`](#general) | `string` | - | - | first y axis
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
### Example dataset configuration
```javascript
data: {
datasets: [{
barPercentage: 0.5,
barThickness: 6,
maxBarThickness: 8,
minBarLength: 2,
data: [10, 20, 30, 40, 50, 60, 70]
}]
};
```
### General
| Name | Description
| ---- | ----
| `base` | Base value for the bar in data units along the value axis. If not set, defaults to the value axis base value.
| `clip` | How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. `0` = clip at chartArea. Clipping can also be configured per side: `clip: {left: 5, top: false, right: -2, bottom: 0}`
| `grouped` | Should the bars be grouped on index axis. When `true`, all the datasets at same index value will be placed next to each other centering on that index value. When `false`, each bar is placed on its actual index-axis value.
| `indexAxis` | The base axis of the dataset. `'x'` for vertical bars and `'y'` for horizontal bars.
| `label` | The label for the dataset which appears in the legend and tooltips.
| `order` | The drawing order of dataset. Also affects order for stacking, tooltip and legend. [more](mixed.md#drawing-order)
| `skipNull` | If `true`, null or undefined values will not be used for spacing calculations when determining bar size.
| `stack` | The ID of the group to which this dataset belongs to (when stacked, each group will be a separate stack). [more](#stacked-bar-chart)
| `xAxisID` | The ID of the x-axis to plot this dataset on.
| `yAxisID` | The ID of the y-axis to plot this dataset on.
### Styling
The style of each bar can be controlled with the following properties:
| Name | Description
| ---- | ----
| `backgroundColor` | The bar background color.
| `borderColor` | The bar border color.
| [`borderSkipped`](#borderskipped) | The edge to skip when drawing bar.
| [`borderWidth`](#borderwidth) | The bar border width (in pixels).
| [`borderRadius`](#borderradius) | The bar border radius (in pixels).
| `minBarLength` | Set this to ensure that bars have a minimum length in pixels.
| `pointStyle` | Style of the point for legend. [more...](../configuration/elements.md#point-styles)
All these values, if `undefined`, fallback to the associated [`elements.bar.*`](../configuration/elements.md#bar-configuration) options.
#### borderSkipped
This setting is used to avoid drawing the bar stroke at the base of the fill, or disable the border radius.
In general, this does not need to be changed except when creating chart types
that derive from a bar chart.
:::tip Note
For negative bars in a vertical chart, `top` and `bottom` are flipped. Same goes for `left` and `right` in a horizontal chart.
:::
Options are:
* `'start'`
* `'end'`
* `'middle'` (only valid on stacked bars: the borders between bars are skipped)
* `'bottom'`
* `'left'`
* `'top'`
* `'right'`
* `false` (don't skip any borders)
* `true` (skip all borders)
#### borderWidth
If this value is a number, it is applied to all sides of the rectangle (left, top, right, bottom), except [`borderSkipped`](#borderskipped). If this value is an object, the `left` property defines the left border width. Similarly, the `right`, `top`, and `bottom` properties can also be specified. Omitted borders and [`borderSkipped`](#borderskipped) are skipped.
#### borderRadius
If this value is a number, it is applied to all corners of the rectangle (topLeft, topRight, bottomLeft, bottomRight), except corners touching the [`borderSkipped`](#borderskipped). If this value is an object, the `topLeft` property defines the top-left corners border radius. Similarly, the `topRight`, `bottomLeft`, and `bottomRight` properties can also be specified. Omitted corners and those touching the [`borderSkipped`](#borderskipped) are skipped. For example if the `top` border is skipped, the border radius for the corners `topLeft` and `topRight` will be skipped as well.
:::tip Stacked Charts
When the border radius is supplied as a number and the chart is stacked, the radius will only be applied to the bars that are at the edges of the stack or where the bar is floating. The object syntax can be used to override this behavior.
:::
#### inflateAmount
This option can be used to inflate the rects that are used to draw the bars. This can be used to hide artifacts between bars when [`barPercentage`](#barpercentage) * [`categoryPercentage`](#categorypercentage) is 1. The default value `'auto'` should work in most cases.
### Interactions
The interaction with each bar can be controlled with the following properties:
| Name | Description
| ---- | -----------
| `hoverBackgroundColor` | The bar background color when hovered.
| `hoverBorderColor` | The bar border color when hovered.
| `hoverBorderWidth` | The bar border width when hovered (in pixels).
| `hoverBorderRadius` | The bar border radius when hovered (in pixels).
All these values, if `undefined`, fallback to the associated [`elements.bar.*`](../configuration/elements.md#bar-configuration) options.
### barPercentage
Percent (0-1) of the available width each bar should be within the category width. 1.0 will take the whole category width and put the bars right next to each other. [more...](#barpercentage-vs-categorypercentage)
### categoryPercentage
Percent (0-1) of the available width each category should be within the sample width. [more...](#barpercentage-vs-categorypercentage)
### barThickness
If this value is a number, it is applied to the width of each bar, in pixels. When this is enforced, `barPercentage` and `categoryPercentage` are ignored.
If set to `'flex'`, the base sample widths are calculated automatically based on the previous and following samples so that they take the full available widths without overlap. Then, bars are sized using `barPercentage` and `categoryPercentage`. There is no gap when the percentage options are 1. This mode generates bars with different widths when data are not evenly spaced.
If not set (default), the base sample widths are calculated using the smallest interval that prevents bar overlapping, and bars are sized using `barPercentage` and `categoryPercentage`. This mode always generates bars equally sized.
### maxBarThickness
Set this to ensure that bars are not sized thicker than this.
## Scale Configuration
The bar chart sets unique default values for the following configuration from the associated `scale` options:
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `offset` | `boolean` | `true` | If true, extra space is added to both edges and the axis is scaled to fit into the chart area.
| `grid.offset` | `boolean` | `true` | If true, the bars for a particular data point fall between the grid lines. The grid line will move to the left by one half of the tick interval. If false, the grid line will go right down the middle of the bars. [more...](#offsetgridlines)
### Example scale configuration
```javascript
options = {
scales: {
x: {
grid: {
offset: true
}
}
}
};
```
### Offset Grid Lines
If true, the bars for a particular data point fall between the grid lines. The grid line will move to the left by one half of the tick interval, which is the space between the grid lines. If false, the grid line will go right down the middle of the bars. This is set to true for a category scale in a bar chart while false for other scales or chart types by default.
## Default Options
It is common to want to apply a configuration setting to all created bar charts. The global bar chart settings are stored in `Chart.overrides.bar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
## barPercentage vs categoryPercentage
The following shows the relationship between the bar percentage option and the category percentage option.
```
// categoryPercentage: 1.0
// barPercentage: 1.0
Bar: | 1.0 | 1.0 |
Category: | 1.0 |
Sample: |===========|
// categoryPercentage: 1.0
// barPercentage: 0.5
Bar: |.5| |.5|
Category: | 1.0 |
Sample: |==============|
// categoryPercentage: 0.5
// barPercentage: 1.0
Bar: |1.0||1.0|
Category: | .5 |
Sample: |==================|
```
## Data Structure
All the supported [data structures](../general/data-structures.md) can be used with bar charts.
## Stacked Bar Chart
Bar charts can be configured into stacked bar charts by changing the settings on the X and Y axes to enable stacking. Stacked bar charts can be used to show how one data series is made up of a number of smaller pieces.
```javascript
const stackedBar = new Chart(ctx, {
type: 'bar',
data: data,
options: {
scales: {
x: {
stacked: true
},
y: {
stacked: true
}
}
}
});
```
## Horizontal Bar Chart
A horizontal bar chart is a variation on a vertical bar chart. It is sometimes used to show trend data, and the comparison of multiple data sets side by side.
To achieve this, you will have to set the `indexAxis` property in the options object to `'y'`.
The default for this property is `'x'` and thus will show vertical bars.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
axis: 'y',
label: 'My First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
fill: false,
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 159, 64, 0.2)',
'rgba(255, 205, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(201, 203, 207, 0.2)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(255, 159, 64)',
'rgb(255, 205, 86)',
'rgb(75, 192, 192)',
'rgb(54, 162, 235)',
'rgb(153, 102, 255)',
'rgb(201, 203, 207)'
],
borderWidth: 1
}]
};
//
//
const config = {
type: 'bar',
data,
options: {
indexAxis: 'y',
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Horizontal Bar Chart config Options
The configuration options for the horizontal bar chart are the same as for the [bar chart](#scale-configuration). However, any options specified on the x-axis in a bar chart, are applied to the y-axis in a horizontal bar chart.
## Internal data format
`{x, y, _custom}` where `_custom` is an optional object defining stacked bar properties: `{start, end, barStart, barEnd, min, max}`. `start` and `end` are the input values. Those two are repeated in `barStart` (closer to origin), `barEnd` (further from origin), `min` and `max`.
================================================
FILE: docs/charts/bubble.md
================================================
# Bubble Chart
A bubble chart is used to display three dimensions of data at the same time. The location of the bubble is determined by the first two dimensions and the corresponding horizontal and vertical axes. The third dimension is represented by the size of the individual bubbles.
```js chart-editor
//
const data = {
datasets: [{
label: 'First Dataset',
data: [{
x: 20,
y: 30,
r: 15
}, {
x: 40,
y: 10,
r: 10
}],
backgroundColor: 'rgb(255, 99, 132)'
}]
};
//
//
const config = {
type: 'bubble',
data: data,
options: {}
};
//
module.exports = {
actions: [],
config: config,
};
```
## Dataset Properties
Namespaces:
* `data.datasets[index]` - options for this dataset only
* `options.datasets.bubble` - options for all bubble datasets
* `options.elements.point` - options for all [point elements](../configuration/elements.md#point-configuration)
* `options` - options for the whole chart
The bubble chart allows a number of properties to be specified for each dataset. These are used to set display properties for a specific dataset. For example, the colour of the bubbles is generally set this way.
| Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
| ---- | ---- | :----: | :----: | ----
| [`backgroundColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`borderColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`borderWidth`](#styling) | `number` | Yes | Yes | `3`
| [`clip`](#general) | `number`\|`object`\|`false` | - | - | `undefined`
| [`data`](#data-structure) | `object[]` | - | - | **required**
| [`drawActiveElementsOnTop`](#general) | `boolean` | Yes | Yes | `true`
| [`hoverBackgroundColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined`
| [`hoverBorderColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined`
| [`hoverBorderWidth`](#interactions) | `number` | Yes | Yes | `1`
| [`hoverRadius`](#interactions) | `number` | Yes | Yes | `4`
| [`hitRadius`](#interactions) | `number` | Yes | Yes | `1`
| [`label`](#general) | `string` | - | - | `undefined`
| [`order`](#general) | `number` | - | - | `0`
| [`pointStyle`](#styling) | [`pointStyle`](../configuration/elements.md#types) | Yes | Yes | `'circle'`
| [`rotation`](#styling) | `number` | Yes | Yes | `0`
| [`radius`](#styling) | `number` | Yes | Yes | `3`
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
### General
| Name | Description
| ---- | ----
| `clip` | How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. `0` = clip at chartArea. Clipping can also be configured per side: `clip: {left: 5, top: false, right: -2, bottom: 0}`
| `drawActiveElementsOnTop` | Draw the active bubbles of a dataset over the other bubbles of the dataset
| `label` | The label for the dataset which appears in the legend and tooltips.
| `order` | The drawing order of dataset. Also affects order for tooltip and legend. [more](mixed.md#drawing-order)
### Styling
The style of each bubble can be controlled with the following properties:
| Name | Description
| ---- | ----
| `backgroundColor` | bubble background color.
| `borderColor` | bubble border color.
| `borderWidth` | bubble border width (in pixels).
| `pointStyle` | bubble [shape style](../configuration/elements.md#point-styles).
| `rotation` | bubble rotation (in degrees).
| `radius` | bubble radius (in pixels).
All these values, if `undefined`, fallback to the associated [`elements.point.*`](../configuration/elements.md#point-configuration) options.
### Interactions
The interaction with each bubble can be controlled with the following properties:
| Name | Description
| ---- | -----------
| `hitRadius` | bubble **additional** radius for hit detection (in pixels).
| `hoverBackgroundColor` | bubble background color when hovered.
| `hoverBorderColor` | bubble border color when hovered.
| `hoverBorderWidth` | bubble border width when hovered (in pixels).
| `hoverRadius` | bubble **additional** radius when hovered (in pixels).
All these values, if `undefined`, fallback to the associated [`elements.point.*`](../configuration/elements.md#point-configuration) options.
## Default Options
We can also change the default values for the Bubble chart type. Doing so will give all bubble charts created after this point the new defaults. The default configuration for the bubble chart can be accessed at `Chart.overrides.bubble`.
## Data Structure
Bubble chart datasets need to contain a `data` array of points, each point represented by an object containing the following properties:
```javascript
{
// X Value
x: number,
// Y Value
y: number,
// Bubble radius in pixels (not scaled).
r: number
}
```
**Important:** the radius property, `r` is **not** scaled by the chart, it is the raw radius in pixels of the bubble that is drawn on the canvas.
## Internal data format
`{x, y, _custom}` where `_custom` is the radius.
================================================
FILE: docs/charts/doughnut.md
================================================
# Doughnut and Pie Charts
Pie and doughnut charts are probably the most commonly used charts. They are divided into segments, the arc of each segment shows the proportional value of each piece of data.
They are excellent at showing the relational proportions between data.
Pie and doughnut charts are effectively the same class in Chart.js, but have one different default value - their `cutout`. This equates to what portion of the inner should be cut out. This defaults to `0` for pie charts, and `'50%'` for doughnuts.
They are also registered under two aliases in the `Chart` core. Other than their different default value, and different alias, they are exactly the same.
:::: tabs
::: tab Doughnut
```js chart-editor
//
const data = {
labels: [
'Red',
'Blue',
'Yellow'
],
datasets: [{
label: 'My First Dataset',
data: [300, 50, 100],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
],
hoverOffset: 4
}]
};
//
//
const config = {
type: 'doughnut',
data: data,
};
//
module.exports = {
actions: [],
config: config,
};
```
:::
:::tab Pie
```js chart-editor
//
const data = {
labels: [
'Red',
'Blue',
'Yellow'
],
datasets: [{
label: 'My First Dataset',
data: [300, 50, 100],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
],
hoverOffset: 4
}]
};
//
//
const config = {
type: 'pie',
data: data,
};
//
module.exports = {
actions: [],
config: config,
};
```
:::
::::
## Dataset Properties
Namespaces:
* `data.datasets[index]` - options for this dataset only
* `options.datasets.doughnut` - options for all doughnut datasets
* `options.datasets.pie` - options for all pie datasets
* `options.elements.arc` - options for all [arc elements](../configuration/elements.md#arc-configuration)
* `options` - options for the whole chart
The doughnut/pie chart allows a number of properties to be specified for each dataset. These are used to set display properties for a specific dataset. For example, the colours of the dataset's arcs are generally set this way.
| Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
| ---- | ---- | :----: | :----: | ----
| [`backgroundColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`borderAlign`](#border-alignment) | `'center'`\|`'inner'` | Yes | Yes | `'center'`
| [`borderColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'#fff'`
| [`borderDash`](#styling) | `number[]` | Yes | - | `[]`
| [`borderDashOffset`](#styling) | `number` | Yes | - | `0.0`
| [`borderJoinStyle`](#styling) | `'round'`\|`'bevel'`\|`'miter'` | Yes | Yes | `undefined`
| [`borderRadius`](#border-radius) | `number`\|`object` | Yes | Yes | `0`
| [`borderWidth`](#styling) | `number` | Yes | Yes | `2`
| [`circumference`](#general) | `number` | - | - | `undefined`
| [`clip`](#general) | `number`\|`object`\|`false` | - | - | `undefined`
| [`data`](#data-structure) | `number[]` | - | - | **required**
| [`hoverBackgroundColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined`
| [`hoverBorderColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined`
| [`hoverBorderDash`](#interactions) | `number[]` | Yes | - | `undefined`
| [`hoverBorderDashOffset`](#interactions) | `number` | Yes | - | `undefined`
| [`hoverBorderJoinStyle`](#interactions) | `'round'`\|`'bevel'`\|`'miter'` | Yes | Yes | `undefined`
| [`hoverBorderWidth`](#interactions) | `number` | Yes | Yes | `undefined`
| [`hoverOffset`](#interactions) | `number` | Yes | Yes | `0`
| [`offset`](#styling) | `number`\|`number[]` | Yes | Yes | `0`
| [`rotation`](#general) | `number` | - | - | `undefined`
| [`spacing`](#styling) | `number` | - | - | `0`
| [`weight`](#styling) | `number` | - | - | `1`
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
### General
| Name | Description
| ---- | ----
| `circumference` | Per-dataset override for the sweep that the arcs cover
| `clip` | How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. `0` = clip at chartArea. Clipping can also be configured per side: `clip: {left: 5, top: false, right: -2, bottom: 0}`
| `rotation` | Per-dataset override for the starting angle to draw arcs from
### Styling
The style of each arc can be controlled with the following properties:
| Name | Description
| ---- | ----
| `backgroundColor` | arc background color.
| `borderColor` | arc border color.
| `borderDash` | arc border length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | arc border offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `borderJoinStyle` | arc border join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `borderWidth` | arc border width (in pixels).
| `offset` | arc offset (in pixels).
| `spacing` | Fixed arc offset (in pixels). Similar to `offset` but applies to all arcs.
| `weight` | The relative thickness of the dataset. Providing a value for weight will cause the pie or doughnut dataset to be drawn with a thickness relative to the sum of all the dataset weight values.
All these values, if `undefined`, fallback to the associated [`elements.arc.*`](../configuration/elements.md#arc-configuration) options.
### Border Alignment
The following values are supported for `borderAlign`.
* `'center'` (default)
* `'inner'`
When `'center'` is set, the borders of arcs next to each other will overlap. When `'inner'` is set, it is guaranteed that all borders will not overlap.
### Border Radius
If this value is a number, it is applied to all corners of the arc (outerStart, outerEnd, innerStart, innerRight). If this value is an object, the `outerStart` property defines the outer-start corner's border radius. Similarly, the `outerEnd`, `innerStart`, and `innerEnd` properties can also be specified.
### Interactions
The interaction with each arc can be controlled with the following properties:
| Name | Description
| ---- | -----------
| `hoverBackgroundColor` | arc background color when hovered.
| `hoverBorderColor` | arc border color when hovered.
| `hoverBorderDash` | arc border length and spacing of dashes when hovered. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `hoverBorderDashOffset` | arc border offset for line dashes when hovered. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `hoverBorderJoinStyle` | arc border join style when hovered. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `hoverBorderWidth` | arc border width when hovered (in pixels).
| `hoverOffset` | arc offset when hovered (in pixels).
All these values, if `undefined`, fallback to the associated [`elements.arc.*`](../configuration/elements.md#arc-configuration) options.
## Config Options
These are the customisation options specific to Pie & Doughnut charts. These options are looked up on access, and form together with the global chart configuration the options of the chart.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `cutout` | `number`\|`string` | `50%` - for doughnut, `0` - for pie | The portion of the chart that is cut out of the middle. If `string` and ending with '%', percentage of the chart radius. `number` is considered to be pixels.
| `radius` | `number`\|`string` | `100%` | The outer radius of the chart. If `string` and ending with '%', percentage of the maximum radius. `number` is considered to be pixels.
| `rotation` | `number` | 0 | Starting angle to draw arcs from.
| `circumference` | `number` | 360 | Sweep to allow arcs to cover.
| `animation.animateRotate` | `boolean` | `true` | If true, the chart will animate in with a rotation animation. This property is in the `options.animation` object.
| `animation.animateScale` | `boolean` | `false` | If true, will animate scaling the chart from the center outwards.
## Default Options
We can also change these default values for each Doughnut type that is created, this object is available at `Chart.overrides.doughnut`. Pie charts also have a clone of these defaults available to change at `Chart.overrides.pie`, with the only difference being `cutout` being set to 0.
## Data Structure
For a pie chart, datasets need to contain an array of data points. The data points should be a number, Chart.js will total all the numbers and calculate the relative proportion of each.
You also need to specify an array of labels so that tooltips appear correctly.
```javascript
data = {
datasets: [{
data: [10, 20, 30]
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: [
'Red',
'Yellow',
'Blue'
]
};
```
================================================
FILE: docs/charts/line.md
================================================
# Line Chart
A line chart is a way of plotting data points on a line. Often, it is used to show trend data, or the comparison of two data sets.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
fill: false,
borderColor: 'rgb(75, 192, 192)',
tension: 0.1
}]
};
//
//
const config = {
type: 'line',
data: data,
};
//
module.exports = {
actions: [],
config: config,
};
```
## Dataset Properties
Namespaces:
* `data.datasets[index]` - options for this dataset only
* `options.datasets.line` - options for all line datasets
* `options.elements.line` - options for all [line elements](../configuration/elements.md#line-configuration)
* `options.elements.point` - options for all [point elements](../configuration/elements.md#point-configuration)
* `options` - options for the whole chart
The line chart allows a number of properties to be specified for each dataset. These are used to set display properties for a specific dataset. For example, the colour of a line is generally set this way.
| Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
| ---- | ---- | :----: | :----: | ----
| [`backgroundColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `'rgba(0, 0, 0, 0.1)'`
| [`borderCapStyle`](#line-styling) | `string` | Yes | - | `'butt'`
| [`borderColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `'rgba(0, 0, 0, 0.1)'`
| [`borderDash`](#line-styling) | `number[]` | Yes | - | `[]`
| [`borderDashOffset`](#line-styling) | `number` | Yes | - | `0.0`
| [`borderJoinStyle`](#line-styling) | `'round'`\|`'bevel'`\|`'miter'` | Yes | - | `'miter'`
| [`borderWidth`](#line-styling) | `number` | Yes | - | `3`
| [`clip`](#general) | `number`\|`object`\|`false` | - | - | `undefined`
| [`cubicInterpolationMode`](#cubicinterpolationmode) | `string` | Yes | - | `'default'`
| [`data`](#data-structure) | `object`\|`object[]`\| `number[]`\|`string[]` | - | - | **required**
| [`drawActiveElementsOnTop`](#general) | `boolean` | Yes | Yes | `true`
| [`fill`](#line-styling) | `boolean`\|`string` | Yes | - | `false`
| [`hoverBackgroundColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `undefined`
| [`hoverBorderCapStyle`](#line-styling) | `string` | Yes | - | `undefined`
| [`hoverBorderColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `undefined`
| [`hoverBorderDash`](#line-styling) | `number[]` | Yes | - | `undefined`
| [`hoverBorderDashOffset`](#line-styling) | `number` | Yes | - | `undefined`
| [`hoverBorderJoinStyle`](#line-styling) | `'round'`\|`'bevel'`\|`'miter'` | Yes | - | `undefined`
| [`hoverBorderWidth`](#line-styling) | `number` | Yes | - | `undefined`
| [`indexAxis`](#general) | `string` | - | - | `'x'`
| [`label`](#general) | `string` | - | - | `''`
| [`order`](#general) | `number` | - | - | `0`
| [`pointBackgroundColor`](#point-styling) | `Color` | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`pointBorderColor`](#point-styling) | `Color` | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`pointBorderWidth`](#point-styling) | `number` | Yes | Yes | `1`
| [`pointHitRadius`](#point-styling) | `number` | Yes | Yes | `1`
| [`pointHoverBackgroundColor`](#interactions) | `Color` | Yes | Yes | `undefined`
| [`pointHoverBorderColor`](#interactions) | `Color` | Yes | Yes | `undefined`
| [`pointHoverBorderWidth`](#interactions) | `number` | Yes | Yes | `1`
| [`pointHoverRadius`](#interactions) | `number` | Yes | Yes | `4`
| [`pointRadius`](#point-styling) | `number` | Yes | Yes | `3`
| [`pointRotation`](#point-styling) | `number` | Yes | Yes | `0`
| [`pointStyle`](#point-styling) | [`pointStyle`](../configuration/elements.md#types) | Yes | Yes | `'circle'`
| [`segment`](#segment) | `object` | - | - | `undefined`
| [`showLine`](#line-styling) | `boolean` | - | - | `true`
| [`spanGaps`](#line-styling) | `boolean`\|`number` | - | - | `undefined`
| [`stack`](#general) | `string` | - | - | `'line'` |
| [`stepped`](#stepped) | `boolean`\|`string` | - | - | `false`
| [`tension`](#line-styling) | `number` | - | - | `0`
| [`xAxisID`](#general) | `string` | - | - | first x axis
| [`yAxisID`](#general) | `string` | - | - | first y axis
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
### General
| Name | Description
| ---- | ----
| `clip` | How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. `0` = clip at chartArea. Clipping can also be configured per side: `clip: {left: 5, top: false, right: -2, bottom: 0}`
| `drawActiveElementsOnTop` | Draw the active points of a dataset over the other points of the dataset
| `indexAxis` | The base axis of the dataset. `'x'` for horizontal lines and `'y'` for vertical lines.
| `label` | The label for the dataset which appears in the legend and tooltips.
| `order` | The drawing order of dataset. Also affects order for stacking, tooltip and legend. [more](mixed.md#drawing-order)
| `stack` | The ID of the group to which this dataset belongs to (when stacked, each group will be a separate stack). [more](#stacked-area-chart)
| `xAxisID` | The ID of the x-axis to plot this dataset on.
| `yAxisID` | The ID of the y-axis to plot this dataset on.
### Point Styling
The style of each point can be controlled with the following properties:
| Name | Description
| ---- | ----
| `pointBackgroundColor` | The fill color for points.
| `pointBorderColor` | The border color for points.
| `pointBorderWidth` | The width of the point border in pixels.
| `pointHitRadius` | The pixel size of the non-displayed point that reacts to mouse events.
| `pointRadius` | The radius of the point shape. If set to 0, the point is not rendered.
| `pointRotation` | The rotation of the point in degrees.
| `pointStyle` | Style of the point. [more...](../configuration/elements.md#point-styles)
All these values, if `undefined`, fallback first to the dataset options then to the associated [`elements.point.*`](../configuration/elements.md#point-configuration) options.
### Line Styling
The style of the line can be controlled with the following properties:
| Name | Description
| ---- | ----
| `backgroundColor` | The line fill color.
| `borderCapStyle` | Cap style of the line. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap).
| `borderColor` | The line color.
| `borderDash` | Length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `borderJoinStyle` | Line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `borderWidth` | The line width (in pixels).
| `fill` | How to fill the area under the line. See [area charts](area.md).
| `tension` | Bezier curve tension of the line. Set to 0 to draw straightlines. This option is ignored if monotone cubic interpolation is used.
| `showLine` | If false, the line is not drawn for this dataset.
| `spanGaps` | If true, lines will be drawn between points with no or null data. If false, points with `null` data will create a break in the line. Can also be a number specifying the maximum gap length to span. The unit of the value depends on the scale used.
If the value is `undefined`, the values fallback to the associated [`elements.line.*`](../configuration/elements.md#line-configuration) options.
### Interactions
The interaction with each point can be controlled with the following properties:
| Name | Description
| ---- | -----------
| `pointHoverBackgroundColor` | Point background color when hovered.
| `pointHoverBorderColor` | Point border color when hovered.
| `pointHoverBorderWidth` | Border width of point when hovered.
| `pointHoverRadius` | The radius of the point when hovered.
### cubicInterpolationMode
The following interpolation modes are supported.
* `'default'`
* `'monotone'`
The `'default'` algorithm uses a custom weighted cubic interpolation, which produces pleasant curves for all types of datasets.
The `'monotone'` algorithm is more suited to `y = f(x)` datasets: it preserves monotonicity (or piecewise monotonicity) of the dataset being interpolated, and ensures local extremums (if any) stay at input data points.
If left untouched (`undefined`), the global `options.elements.line.cubicInterpolationMode` property is used.
### Segment
Line segment styles can be overridden by scriptable options in the `segment` object. Currently, all of the `border*` and `backgroundColor` options are supported. The segment styles are resolved for each section of the line between each point. `undefined` fallbacks to main line styles.
:::tip
To be able to style gaps, you need the [`spanGaps`](#line-styling) option enabled.
:::
Context for the scriptable segment contains the following properties:
* `type`: `'segment'`
* `p0`: first point element
* `p1`: second point element
* `p0DataIndex`: index of first point in the data array
* `p1DataIndex`: index of second point in the data array
* `datasetIndex`: dataset index
[Example usage](../samples/line/segments.md)
### Stepped
The following values are supported for `stepped`.
* `false`: No Step Interpolation (default)
* `true`: Step-before Interpolation (eq. `'before'`)
* `'before'`: Step-before Interpolation
* `'after'`: Step-after Interpolation
* `'middle'`: Step-middle Interpolation
If the `stepped` value is set to anything other than false, `tension` will be ignored.
## Default Options
It is common to want to apply a configuration setting to all created line charts. The global line chart settings are stored in `Chart.overrides.line`. Changing the global options only affects charts created after the change. Existing charts are not changed.
For example, to configure all line charts with `spanGaps = true` you would do:
```javascript
Chart.overrides.line.spanGaps = true;
```
## Data Structure
All the supported [data structures](../general/data-structures.md) can be used with line charts.
## Stacked Area Chart
Line charts can be configured into stacked area charts by changing the settings on the y-axis to enable stacking. Stacked area charts can be used to show how one data trend is made up of a number of smaller pieces.
```javascript
const stackedLine = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
y: {
stacked: true
}
}
}
});
```
## Vertical Line Chart
A vertical line chart is a variation on the horizontal line chart.
To achieve this, you will have to set the `indexAxis` property in the options object to `'y'`.
The default for this property is `'x'` and thus will show horizontal lines.
```js chart-editor
//
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
axis: 'y',
label: 'My First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
fill: false,
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 159, 64, 0.2)',
'rgba(255, 205, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(201, 203, 207, 0.2)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(255, 159, 64)',
'rgb(255, 205, 86)',
'rgb(75, 192, 192)',
'rgb(54, 162, 235)',
'rgb(153, 102, 255)',
'rgb(201, 203, 207)'
],
borderWidth: 1
}]
};
//
//
const config = {
type: 'line',
data: data,
options: {
indexAxis: 'y',
scales: {
x: {
beginAtZero: true
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
### Config Options
The configuration options for the vertical line chart are the same as for the [line chart](#configuration-options). However, any options specified on the x-axis in a line chart, are applied to the y-axis in a vertical line chart.
## Internal data format
`{x, y}`
================================================
FILE: docs/charts/mixed.md
================================================
# Mixed Chart Types
With Chart.js, it is possible to create mixed charts that are a combination of two or more different chart types. A common example is a bar chart that also includes a line dataset.
When creating a mixed chart, we specify the chart type on each dataset.
```javascript
const mixedChart = new Chart(ctx, {
data: {
datasets: [{
type: 'bar',
label: 'Bar Dataset',
data: [10, 20, 30, 40]
}, {
type: 'line',
label: 'Line Dataset',
data: [50, 50, 50, 50],
}],
labels: ['January', 'February', 'March', 'April']
},
options: options
});
```
At this point, we have a chart rendering how we'd like. It's important to note that the default options for the charts are only considered at the dataset level and are not merged at the chart level in this case.
```js chart-editor
//
const data = {
labels: [
'January',
'February',
'March',
'April'
],
datasets: [{
type: 'bar',
label: 'Bar Dataset',
data: [10, 20, 30, 40],
borderColor: 'rgb(255, 99, 132)',
backgroundColor: 'rgba(255, 99, 132, 0.2)'
}, {
type: 'line',
label: 'Line Dataset',
data: [50, 50, 50, 50],
fill: false,
borderColor: 'rgb(54, 162, 235)'
}]
};
//
//
const config = {
type: 'scatter',
data: data,
options: {
scales: {
y: {
beginAtZero: true
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
## Drawing order
By default, datasets are drawn such that the first one is top-most. This can be altered by specifying `order` option to datasets. `order` defaults to `0`. Note that this also affects stacking, legend, and tooltip. So it's essentially the same as reordering the datasets.
The `order` property behaves like a weight instead of a specific order, so the higher the number, the sooner that dataset is drawn on the canvas and thus other datasets with a lower order number will get drawn over it.
```javascript
const mixedChart = new Chart(ctx, {
type: 'bar',
data: {
datasets: [{
label: 'Bar Dataset',
data: [10, 20, 30, 40],
// this dataset is drawn below
order: 2
}, {
label: 'Line Dataset',
data: [10, 10, 10, 10],
type: 'line',
// this dataset is drawn on top
order: 1
}],
labels: ['January', 'February', 'March', 'April']
},
options: options
});
```
================================================
FILE: docs/charts/polar.md
================================================
# Polar Area Chart
Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value.
This type of chart is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context.
```js chart-editor
//
const data = {
labels: [
'Red',
'Green',
'Yellow',
'Grey',
'Blue'
],
datasets: [{
label: 'My First Dataset',
data: [11, 16, 7, 3, 14],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(75, 192, 192)',
'rgb(255, 205, 86)',
'rgb(201, 203, 207)',
'rgb(54, 162, 235)'
]
}]
};
//
//
const config = {
type: 'polarArea',
data: data,
options: {}
};
//
module.exports = {
actions: [],
config: config,
};
```
## Dataset Properties
Namespaces:
* `data.datasets[index]` - options for this dataset only
* `options.datasets.polarArea` - options for all polarArea datasets
* `options.elements.arc` - options for all [arc elements](../configuration/elements.md#arc-configuration)
* `options` - options for the whole chart
The following options can be included in a polar area chart dataset to configure options for that specific dataset.
| Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
| ---- | ---- | :----: | :----: | ----
| [`backgroundColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`borderAlign`](#border-alignment) | `'center'`\|`'inner'` | Yes | Yes | `'center'`
| [`borderColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'#fff'`
| [`borderDash`](#styling) | `number[]` | Yes | - | `[]`
| [`borderDashOffset`](#styling) | `number` | Yes | - | `0.0`
| [`borderJoinStyle`](#styling) | `'round'`\|`'bevel'`\|`'miter'` | Yes | Yes | `undefined`
| [`borderWidth`](#styling) | `number` | Yes | Yes | `2`
| [`clip`](#general) | `number`\|`object`\|`false` | - | - | `undefined`
| [`data`](#data-structure) | `number[]` | - | - | **required**
| [`hoverBackgroundColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined`
| [`hoverBorderColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined`
| [`hoverBorderDash`](#interactions) | `number[]` | Yes | - | `undefined`
| [`hoverBorderDashOffset`](#interactions) | `number` | Yes | - | `undefined`
| [`hoverBorderJoinStyle`](#interactions) | `'round'`\|`'bevel'`\|`'miter'` | Yes | Yes | `undefined`
| [`hoverBorderWidth`](#interactions) | `number` | Yes | Yes | `undefined`
| [`circular`](#styling) | `boolean` | Yes | Yes | `true`
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
### General
| Name | Description
| ---- | ----
| `clip` | How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. `0` = clip at chartArea. Clipping can also be configured per side: `clip: {left: 5, top: false, right: -2, bottom: 0}`
### Styling
The style of each arc can be controlled with the following properties:
| Name | Description
| ---- | ----
| `backgroundColor` | arc background color.
| `borderColor` | arc border color.
| `borderDash` | arc border length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | arc border offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `borderJoinStyle` | arc border join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `borderWidth` | arc border width (in pixels).
| `circular` | By default the Arc is curved. If `circular: false` the Arc will be flat.
All these values, if `undefined`, fallback to the associated [`elements.arc.*`](../configuration/elements.md#arc-configuration) options.
### Border Alignment
The following values are supported for `borderAlign`.
* `'center'` (default)
* `'inner'`
When `'center'` is set, the borders of arcs next to each other will overlap. When `'inner'` is set, it is guaranteed that all the borders do not overlap.
### Interactions
The interaction with each arc can be controlled with the following properties:
| Name | Description
| ---- | -----------
| `hoverBackgroundColor` | arc background color when hovered.
| `hoverBorderColor` | arc border color when hovered.
| `hoverBorderDash` | arc border length and spacing of dashes when hovered. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `hoverBorderDashOffset` | arc border offset for line dashes when hovered. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `hoverBorderJoinStyle` | arc border join style when hovered. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `hoverBorderWidth` | arc border width when hovered (in pixels).
All these values, if `undefined`, fallback to the associated [`elements.arc.*`](../configuration/elements.md#arc-configuration) options.
## Config Options
These are the customisation options specific to Polar Area charts. These options are looked up on access, and form together with the [global chart default options](#default-options) the options of the chart.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `animation.animateRotate` | `boolean` | `true` | If true, the chart will animate in with a rotation animation. This property is in the `options.animation` object.
| `animation.animateScale` | `boolean` | `true` | If true, will animate scaling the chart from the center outwards.
The polar area chart uses the [radialLinear](../axes/radial/linear.md) scale. Additional configuration is provided via the scale.
## Default Options
We can also change these default values for each PolarArea type that is created, this object is available at `Chart.overrides.polarArea`. Changing the global options only affects charts created after the change. Existing charts are not changed.
For example, to configure all new polar area charts with `animateScale = false` you would do:
```javascript
Chart.overrides.polarArea.animation.animateScale = false;
```
## Data Structure
For a polar area chart, datasets need to contain an array of data points. The data points should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each.
You also need to specify an array of labels so that tooltips appear correctly for each slice.
```javascript
data = {
datasets: [{
data: [10, 20, 30]
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: [
'Red',
'Yellow',
'Blue'
]
};
```
================================================
FILE: docs/charts/radar.md
================================================
# Radar Chart
A radar chart is a way of showing multiple data points and the variation between them.
They are often useful for comparing the points of two or more different data sets.
```js chart-editor
//
const data = {
labels: [
'Eating',
'Drinking',
'Sleeping',
'Designing',
'Coding',
'Cycling',
'Running'
],
datasets: [{
label: 'My First Dataset',
data: [65, 59, 90, 81, 56, 55, 40],
fill: true,
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(255, 99, 132)'
}, {
label: 'My Second Dataset',
data: [28, 48, 40, 19, 96, 27, 100],
fill: true,
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgb(54, 162, 235)',
pointBackgroundColor: 'rgb(54, 162, 235)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(54, 162, 235)'
}]
};
//
//
const config = {
type: 'radar',
data: data,
options: {
elements: {
line: {
borderWidth: 3
}
}
},
};
//
module.exports = {
actions: [],
config: config,
};
```
## Dataset Properties
Namespaces:
* `data.datasets[index]` - options for this dataset only
* `options.datasets.line` - options for all line datasets
* `options.elements.line` - options for all [line elements](../configuration/elements.md#line-configuration)
* `options.elements.point` - options for all [point elements](../configuration/elements.md#point-configuration)
* `options` - options for the whole chart
The radar chart allows a number of properties to be specified for each dataset. These are used to set display properties for a specific dataset. For example, the colour of a line is generally set this way.
| Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
| ---- | ---- | :----: | :----: | ----
| [`backgroundColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `'rgba(0, 0, 0, 0.1)'`
| [`borderCapStyle`](#line-styling) | `string` | Yes | - | `'butt'`
| [`borderColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `'rgba(0, 0, 0, 0.1)'`
| [`borderDash`](#line-styling) | `number[]` | Yes | - | `[]`
| [`borderDashOffset`](#line-styling) | `number` | Yes | - | `0.0`
| [`borderJoinStyle`](#line-styling) | `'round'`\|`'bevel'`\|`'miter'` | Yes | - | `'miter'`
| [`borderWidth`](#line-styling) | `number` | Yes | - | `3`
| [`hoverBackgroundColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `undefined`
| [`hoverBorderCapStyle`](#line-styling) | `string` | Yes | - | `undefined`
| [`hoverBorderColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `undefined`
| [`hoverBorderDash`](#line-styling) | `number[]` | Yes | - | `undefined`
| [`hoverBorderDashOffset`](#line-styling) | `number` | Yes | - | `undefined`
| [`hoverBorderJoinStyle`](#line-styling) | `'round'`\|`'bevel'`\|`'miter'` | Yes | - | `undefined`
| [`hoverBorderWidth`](#line-styling) | `number` | Yes | - | `undefined`
| [`clip`](#general) | `number`\|`object`\|`false` | - | - | `undefined`
| [`data`](#data-structure) | `number[]` | - | - | **required**
| [`fill`](#line-styling) | `boolean`\|`string` | Yes | - | `false`
| [`label`](#general) | `string` | - | - | `''`
| [`order`](#general) | `number` | - | - | `0`
| [`tension`](#line-styling) | `number` | - | - | `0`
| [`pointBackgroundColor`](#point-styling) | `Color` | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`pointBorderColor`](#point-styling) | `Color` | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`pointBorderWidth`](#point-styling) | `number` | Yes | Yes | `1`
| [`pointHitRadius`](#point-styling) | `number` | Yes | Yes | `1`
| [`pointHoverBackgroundColor`](#interactions) | `Color` | Yes | Yes | `undefined`
| [`pointHoverBorderColor`](#interactions) | `Color` | Yes | Yes | `undefined`
| [`pointHoverBorderWidth`](#interactions) | `number` | Yes | Yes | `1`
| [`pointHoverRadius`](#interactions) | `number` | Yes | Yes | `4`
| [`pointRadius`](#point-styling) | `number` | Yes | Yes | `3`
| [`pointRotation`](#point-styling) | `number` | Yes | Yes | `0`
| [`pointStyle`](#point-styling) | [`pointStyle`](../configuration/elements.md#types) | Yes | Yes | `'circle'`
| [`spanGaps`](#line-styling) | `boolean` | - | - | `undefined`
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
### General
| Name | Description
| ---- | ----
| `clip` | How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. `0` = clip at chartArea. Clipping can also be configured per side: `clip: {left: 5, top: false, right: -2, bottom: 0}`
| `label` | The label for the dataset which appears in the legend and tooltips.
| `order` | The drawing order of dataset. Also affects order for tooltip and legend. [more](mixed.md#drawing-order)
### Point Styling
The style of each point can be controlled with the following properties:
| Name | Description
| ---- | ----
| `pointBackgroundColor` | The fill color for points.
| `pointBorderColor` | The border color for points.
| `pointBorderWidth` | The width of the point border in pixels.
| `pointHitRadius` | The pixel size of the non-displayed point that reacts to mouse events.
| `pointRadius` | The radius of the point shape. If set to 0, the point is not rendered.
| `pointRotation` | The rotation of the point in degrees.
| `pointStyle` | Style of the point. [more...](../configuration/elements#point-styles)
All these values, if `undefined`, fallback first to the dataset options then to the associated [`elements.point.*`](../configuration/elements.md#point-configuration) options.
### Line Styling
The style of the line can be controlled with the following properties:
| Name | Description
| ---- | ----
| `backgroundColor` | The line fill color.
| `borderCapStyle` | Cap style of the line. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap).
| `borderColor` | The line color.
| `borderDash` | Length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `borderJoinStyle` | Line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `borderWidth` | The line width (in pixels).
| `fill` | How to fill the area under the line. See [area charts](area.md).
| `tension` | Bezier curve tension of the line. Set to 0 to draw straight lines.
| `spanGaps` | If true, lines will be drawn between points with no or null data. If false, points with `null` data will create a break in the line.
If the value is `undefined`, the values fallback to the associated [`elements.line.*`](../configuration/elements.md#line-configuration) options.
### Interactions
The interaction with each point can be controlled with the following properties:
| Name | Description
| ---- | -----------
| `pointHoverBackgroundColor` | Point background color when hovered.
| `pointHoverBorderColor` | Point border color when hovered.
| `pointHoverBorderWidth` | Border width of point when hovered.
| `pointHoverRadius` | The radius of the point when hovered.
## Scale Options
The radar chart supports only a single scale. The options for this scale are defined in the `scales.r` property, which can be referenced from the [Linear Radial Axis page](../axes/radial/linear).
```javascript
options = {
scales: {
r: {
angleLines: {
display: false
},
suggestedMin: 50,
suggestedMax: 100
}
}
};
```
## Default Options
It is common to want to apply a configuration setting to all created radar charts. The global radar chart settings are stored in `Chart.overrides.radar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
## Data Structure
The `data` property of a dataset for a radar chart is specified as an array of numbers. Each point in the data array corresponds to the label at the same index.
```javascript
data: [20, 10]
```
For a radar chart, to provide context of what each point means, we include an array of strings that show around each point in the chart.
```javascript
data: {
labels: ['Running', 'Swimming', 'Eating', 'Cycling'],
datasets: [{
data: [20, 10, 4, 2]
}]
}
```
## Internal data format
`{x, y}`
================================================
FILE: docs/charts/scatter.md
================================================
# Scatter Chart
Scatter charts are based on basic line charts with the x-axis changed to a linear axis. To use a scatter chart, data must be passed as objects containing X and Y properties. The example below creates a scatter chart with 4 points.
```js chart-editor
//
const data = {
datasets: [{
label: 'Scatter Dataset',
data: [{
x: -10,
y: 0
}, {
x: 0,
y: 10
}, {
x: 10,
y: 5
}, {
x: 0.5,
y: 5.5
}],
backgroundColor: 'rgb(255, 99, 132)'
}],
};
//
//
const config = {
type: 'scatter',
data: data,
options: {
scales: {
x: {
type: 'linear',
position: 'bottom'
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
## Dataset Properties
Namespaces:
* `data.datasets[index]` - options for this dataset only
* `options.datasets.scatter` - options for all scatter datasets
* `options.elements.line` - options for all [line elements](../configuration/elements.md#line-configuration)
* `options.elements.point` - options for all [point elements](../configuration/elements.md#point-configuration)
* `options` - options for the whole chart
The scatter chart supports all the same properties as the [line chart](./line.md#dataset-properties).
By default, the scatter chart will override the showLine property of the line chart to `false`.
The index scale is of the type `linear`. This means, if you are using the labels array, the values have to be numbers or parsable to numbers, the same applies to the object format for the keys.
## Data Structure
Unlike the line chart where data can be supplied in two different formats, the scatter chart only accepts data in a point format.
```javascript
data: [{
x: 10,
y: 20
}, {
x: 15,
y: 10
}]
```
## Internal data format
`{x, y}`
================================================
FILE: docs/configuration/animations.md
================================================
# Animations
Chart.js animates charts out of the box. A number of options are provided to configure how the animation looks and how long it takes.
:::: tabs
::: tab "Looping tension [property]"
```js chart-editor
//
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'Looping tension',
data: [65, 59, 80, 81, 26, 55, 40],
fill: false,
borderColor: 'rgb(75, 192, 192)',
}]
};
//
//
const config = {
type: 'line',
data: data,
options: {
animations: {
tension: {
duration: 1000,
easing: 'linear',
from: 1,
to: 0,
loop: true
}
},
scales: {
y: { // defining min and max so hiding the dataset does not change scale range
min: 0,
max: 100
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
:::
::: tab "Hide and show [mode]"
```js chart-editor
//
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'Try hiding me',
data: [65, 59, 80, 81, 26, 55, 40],
fill: false,
borderColor: 'rgb(75, 192, 192)',
}]
};
//
//
const config = {
type: 'line',
data: data,
options: {
transitions: {
show: {
animations: {
x: {
from: 0
},
y: {
from: 0
}
}
},
hide: {
animations: {
x: {
to: 0
},
y: {
to: 0
}
}
}
}
}
};
//
module.exports = {
actions: [],
config: config,
};
```
:::
::::
## Animation configuration
Animation configuration consists of 3 keys.
| Name | Type | Details
| ---- | ---- | -------
| animation | `object` | [animation](#animation)
| animations | `object` | [animations](#animations)
| transitions | `object` | [transitions](#transitions)
These keys can be configured in following paths:
* `` - chart options
* `datasets[type]` - dataset type options
* `overrides[type]` - chart type options
These paths are valid under `defaults` for global configuration and `options` for instance configuration.
## animation
The default configuration is defined here: core.animations.defaults.js
Namespace: `options.animation`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `duration` | `number` | `1000` | The number of milliseconds an animation takes.
| `easing` | `string` | `'easeOutQuart'` | Easing function to use. [more...](#easing)
| `delay` | `number` | `undefined` | Delay before starting the animations.
| `loop` | `boolean` | `undefined` | If set to `true`, the animations loop endlessly.
These defaults can be overridden in `options.animation` or `dataset.animation` and `tooltip.animation`. These keys are also [Scriptable](../general/options.md#scriptable-options).
## animations
Animations options configures which element properties are animated and how.
In addition to the main [animation configuration](#animation-configuration), the following options are available:
Namespace: `options.animations[animation]`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `properties` | `string[]` | `key` | The property names this configuration applies to. Defaults to the key name of this object.
| `type` | `string` | `typeof property` | Type of property, determines the interpolator used. Possible values: `'number'`, `'color'` and `'boolean'`. Only really needed for `'color'`, because `typeof` does not get that right.
| `from` | `number`\|`Color`\|`boolean` | `undefined` | Start value for the animation. Current value is used when `undefined`
| `to` | `number`\|`Color`\|`boolean` | `undefined` | End value for the animation. Updated value is used when `undefined`
| `fn` | <T>(from: T, to: T, factor: number) => T; | `undefined` | Optional custom interpolator, instead of using a predefined interpolator from `type` |
### Default animations
| Name | Option | Value
| ---- | ------ | -----
| `numbers` | `properties` | `['x', 'y', 'borderWidth', 'radius', 'tension']`
| `numbers` | `type` | `'number'`
| `colors` | `properties` | `['color', 'borderColor', 'backgroundColor']`
| `colors` | `type` | `'color'`
:::tip Note
These default animations are overridden by most of the dataset controllers.
:::
## transitions
The core transitions are `'active'`, `'hide'`, `'reset'`, `'resize'`, `'show'`.
A custom transition can be used by passing a custom `mode` to [update](../developers/api.md#updatemode).
Transition extends the main [animation configuration](#animation-configuration) and [animations configuration](#animations-configuration).
### Default transitions
Namespace: `options.transitions[mode]`
| Mode | Option | Value | Description
| -----| ------ | ----- | -----
| `'active'` | animation.duration | 400 | Override default duration to 400ms for hover animations
| `'resize'` | animation.duration | 0 | Override default duration to 0ms (= no animation) for resize
| `'show'` | animations.colors | `{ type: 'color', properties: ['borderColor', 'backgroundColor'], from: 'transparent' }` | Colors are faded in from transparent when dataset is shown using legend / [api](../developers/api.md#showdatasetIndex).
| `'show'` | animations.visible | `{ type: 'boolean', duration: 0 }` | Dataset visibility is immediately changed to true so the color transition from transparent is visible.
| `'hide'` | animations.colors | `{ type: 'color', properties: ['borderColor', 'backgroundColor'], to: 'transparent' }` | Colors are faded to transparent when dataset id hidden using legend / [api](../developers/api.md#hidedatasetIndex).
| `'hide'` | animations.visible | `{ type: 'boolean', easing: 'easeInExpo' }` | Visibility is changed to false at a very late phase of animation
## Disabling animation
To disable an animation configuration, the animation node must be set to `false`, with the exception for animation modes which can be disabled by setting the `duration` to `0`.
```javascript
chart.options.animation = false; // disables all animations
chart.options.animations.colors = false; // disables animation defined by the collection of 'colors' properties
chart.options.animations.x = false; // disables animation defined by the 'x' property
chart.options.transitions.active.animation.duration = 0; // disables the animation for 'active' mode
```
## Easing
Available options are:
* `'linear'`
* `'easeInQuad'`
* `'easeOutQuad'`
* `'easeInOutQuad'`
* `'easeInCubic'`
* `'easeOutCubic'`
* `'easeInOutCubic'`
* `'easeInQuart'`
* `'easeOutQuart'`
* `'easeInOutQuart'`
* `'easeInQuint'`
* `'easeOutQuint'`
* `'easeInOutQuint'`
* `'easeInSine'`
* `'easeOutSine'`
* `'easeInOutSine'`
* `'easeInExpo'`
* `'easeOutExpo'`
* `'easeInOutExpo'`
* `'easeInCirc'`
* `'easeOutCirc'`
* `'easeInOutCirc'`
* `'easeInElastic'`
* `'easeOutElastic'`
* `'easeInOutElastic'`
* `'easeInBack'`
* `'easeOutBack'`
* `'easeInOutBack'`
* `'easeInBounce'`
* `'easeOutBounce'`
* `'easeInOutBounce'`
See [Robert Penner's easing equations](http://robertpenner.com/easing/).
## Animation Callbacks
The animation configuration provides callbacks which are useful for synchronizing an external draw to the chart animation.
The callbacks can be set only at main [animation configuration](#animation-configuration).
Namespace: `options.animation`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `onProgress` | `function` | `null` | Callback called on each step of an animation.
| `onComplete` | `function` | `null` | Callback called when all animations are completed.
The callback is passed the following object:
```javascript
{
// Chart object
chart: Chart,
// Number of animations still in progress
currentStep: number,
// `true` for the initial animation of the chart
initial: boolean,
// Total number of animations at the start of current animation
numSteps: number,
}
```
The following example fills a progress bar during the chart animation.
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
animation: {
onProgress: function(animation) {
progress.value = animation.currentStep / animation.numSteps;
}
}
}
});
```
Another example usage of these callbacks can be found [in this progress bar sample,](../samples/advanced/progress-bar.md) which displays a progress bar showing how far along the animation is.
================================================
FILE: docs/configuration/canvas-background.md
================================================
# Canvas background
In some use cases you would want a background image or color over the whole canvas. There is no built-in support for this, the way you can achieve this is by writing a custom plugin.
In the two example plugins underneath here you can see how you can draw a color or image to the canvas as background. This way of giving the chart a background is only necessary if you want to export the chart with that specific background.
For normal use you can set the background more easily with [CSS](https://www.w3schools.com/cssref/css3_pr_background.asp).
:::: tabs
::: tab Color
```js chart-editor
//
const data = {
labels: [
'Red',
'Blue',
'Yellow'
],
datasets: [{
label: 'My First Dataset',
data: [300, 50, 100],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
],
hoverOffset: 4
}]
};
//
//
// Note: changes to the plugin code is not reflected to the chart, because the plugin is loaded at chart construction time and editor changes only trigger an chart.update().
const plugin = {
id: 'customCanvasBackgroundColor',
beforeDraw: (chart, args, options) => {
const {ctx} = chart;
ctx.save();
ctx.globalCompositeOperation = 'destination-over';
ctx.fillStyle = options.color || '#99ffff';
ctx.fillRect(0, 0, chart.width, chart.height);
ctx.restore();
}
};
//
//
const config = {
type: 'doughnut',
data: data,
options: {
plugins: {
customCanvasBackgroundColor: {
color: 'lightGreen',
}
}
},
plugins: [plugin],
};
//
module.exports = {
actions: [],
config: config,
};
```
:::
::: tab Image
```js chart-editor
//
const data = {
labels: [
'Red',
'Blue',
'Yellow'
],
datasets: [{
label: 'My First Dataset',
data: [300, 50, 100],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
],
hoverOffset: 4
}]
};
//
//
// Note: changes to the plugin code is not reflected to the chart, because the plugin is loaded at chart construction time and editor changes only trigger an chart.update().
const image = new Image();
image.src = 'https://www.chartjs.org/img/chartjs-logo.svg';
const plugin = {
id: 'customCanvasBackgroundImage',
beforeDraw: (chart) => {
if (image.complete) {
const ctx = chart.ctx;
const {top, left, width, height} = chart.chartArea;
const x = left + width / 2 - image.width / 2;
const y = top + height / 2 - image.height / 2;
ctx.drawImage(image, x, y);
} else {
image.onload = () => chart.draw();
}
}
};
//
//
const config = {
type: 'doughnut',
data: data,
plugins: [plugin],
};
//
module.exports = {
actions: [],
config: config,
};
```
:::
::::
================================================
FILE: docs/configuration/decimation.md
================================================
# Data Decimation
The decimation plugin can be used with line charts to automatically decimate data at the start of the chart lifecycle. Before enabling this plugin, review the [requirements](#requirements) to ensure that it will work with the chart you want to create.
## Configuration Options
Namespace: `options.plugins.decimation`, the global options for the plugin are defined in `Chart.defaults.plugins.decimation`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `enabled` | `boolean` | `false` | Is decimation enabled?
| `algorithm` | `string` | `'min-max'` | Decimation algorithm to use. See the [more...](#decimation-algorithms)
| `samples` | `number` | | If the `'lttb'` algorithm is used, this is the number of samples in the output dataset. Defaults to the canvas width to pick 1 sample per pixel.
| `threshold` | `number` | | If the number of samples in the current axis range is above this value, the decimation will be triggered. Defaults to 4 times the canvas width.
The number of point after decimation can be higher than the `threshold` value.
## Decimation Algorithms
Decimation algorithm to use for data. Options are:
* `'lttb'`
* `'min-max'`
### Largest Triangle Three Bucket (LTTB) Decimation
[LTTB](https://github.com/sveinn-steinarsson/flot-downsample) decimation reduces the number of data points significantly. This is most useful for showing trends in data using only a few data points.
### Min/Max Decimation
[Min/max](https://digital.ni.com/public.nsf/allkb/F694FFEEA0ACF282862576020075F784) decimation will preserve peaks in your data but could require up to 4 points for each pixel. This type of decimation would work well for a very noisy signal where you need to see data peaks.
## Requirements
To use the decimation plugin, the following requirements must be met:
1. The dataset must have an [`indexAxis`](../charts/line.md#general) of `'x'`
2. The dataset must be a line
3. The X axis for the dataset must be either a [`'linear'`](../axes/cartesian/linear.md) or [`'time'`](../axes/cartesian/time.md) type axis
4. Data must not need parsing, i.e. [`parsing`](../general/data-structures.md#dataset-configuration) must be `false`
5. The dataset object must be mutable. The plugin stores the original data as `dataset._data` and then defines a new `data` property on the dataset.
6. There must be more points on the chart than the threshold value. Take a look at the Configuration Options for more information.
## Related Samples
* [Data Decimation Sample](../samples/advanced/data-decimation)
================================================
FILE: docs/configuration/device-pixel-ratio.md
================================================
# Device Pixel Ratio
By default, the chart's canvas will use a 1:1 pixel ratio, unless the physical display has a higher pixel ratio (e.g. Retina displays).
For applications where a chart will be converted to a bitmap, or printed to a higher DPI medium, it can be desirable to render the chart at a higher resolution than the default.
Setting `devicePixelRatio` to a value other than 1 will force the canvas size to be scaled by that amount, relative to the container size. There should be no visible difference on screen; the difference will only be visible when the image is zoomed or printed.
## Configuration Options
Namespace: `options`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `devicePixelRatio` | `number` | `window.devicePixelRatio` | Override the window's default devicePixelRatio.
================================================
FILE: docs/configuration/elements.md
================================================
# Elements
While chart types provide settings to configure the styling of each dataset, you sometimes want to style **all datasets the same way**. A common example would be to stroke all the bars in a bar chart with the same colour but change the fill per dataset. Options can be configured for four different types of elements: **[arc](#arc-configuration)**, **[lines](#line-configuration)**, **[points](#point-configuration)**, and **[bars](#bar-configuration)**. When set, these options apply to all objects of that type unless specifically overridden by the configuration attached to a dataset.
## Global Configuration
The element options can be specified per chart or globally. The global options for elements are defined in `Chart.defaults.elements`. For example, to set the border width of all bar charts globally, you would do:
```javascript
Chart.defaults.elements.bar.borderWidth = 2;
```
## Point Configuration
Point elements are used to represent the points in a line, radar or bubble chart.
Namespace: `options.elements.point`, global point options: `Chart.defaults.elements.point`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `radius` | `number` | `3` | Point radius.
| [`pointStyle`](#point-styles) | [`pointStyle`](#types) | `'circle'` | Point style.
| `rotation` | `number` | `0` | Point rotation (in degrees).
| `backgroundColor` | [`Color`](../general/colors.md) | `Chart.defaults.backgroundColor` | Point fill color.
| `borderWidth` | `number` | `1` | Point stroke width.
| `borderColor` | [`Color`](../general/colors.md) | `'Chart.defaults.borderColor` | Point stroke color.
| `hitRadius` | `number` | `1` | Extra radius added to point radius for hit detection.
| `hoverRadius` | `number` | `4` | Point radius when hovered.
| `hoverBorderWidth` | `number` | `1` | Stroke width when hovered.
### Point Styles
#### Types
The `pointStyle` argument accepts the following type of inputs: `string`, `Image` and `HTMLCanvasElement`
#### Info
When a string is provided, the following values are supported:
- `'circle'`
- `'cross'`
- `'crossRot'`
- `'dash'`
- `'line'`
- `'rect'`
- `'rectRounded'`
- `'rectRot'`
- `'star'`
- `'triangle'`
- `false`
If the value is an image or a canvas element, that image or canvas element is drawn on the canvas using [drawImage](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/drawImage).
## Line Configuration
Line elements are used to represent the line in a line chart.
Namespace: `options.elements.line`, global line options: `Chart.defaults.elements.line`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `tension` | `number` | `0` | Bézier curve tension (`0` for no Bézier curves).
| `backgroundColor` | [`Color`](/general/colors.md) | `Chart.defaults.backgroundColor` | Line fill color.
| `borderWidth` | `number` | `3` | Line stroke width.
| `borderColor` | [`Color`](/general/colors.md) | `Chart.defaults.borderColor` | Line stroke color.
| `borderCapStyle` | `string` | `'butt'` | Line cap style. See [MDN](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap).
| `borderDash` | `number[]` | `[]` | Line dash. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | `number` | `0.0` | Line dash offset. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `borderJoinStyle` | `'round'`\|`'bevel'`\|`'miter'` | `'miter'` | Line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `capBezierPoints` | `boolean` | `true` | `true` to keep Bézier control inside the chart, `false` for no restriction.
| `cubicInterpolationMode` | `string` | `'default'` | Interpolation mode to apply. [See more...](/charts/line.md#cubicinterpolationmode)
| `fill` | `boolean`\|`string` | `false` | How to fill the area under the line. See [area charts](/charts/area.md#filling-modes).
| `stepped` | `boolean` | `false` | `true` to show the line as a stepped line (`tension` will be ignored).
## Bar Configuration
Bar elements are used to represent the bars in a bar chart.
Namespace: `options.elements.bar`, global bar options: `Chart.defaults.elements.bar`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `backgroundColor` | [`Color`](/general/colors.md) | `Chart.defaults.backgroundColor` | Bar fill color.
| `borderWidth` | `number` | `0` | Bar stroke width.
| `borderColor` | [`Color`](/general/colors.md) | `Chart.defaults.borderColor` | Bar stroke color.
| `borderSkipped` | `string` | `'start'` | Skipped (excluded) border: `'start'`, `'end'`, `'middle'`, `'bottom'`, `'left'`, `'top'`, `'right'` or `false`.
| `borderRadius` | `number`\|`object` | `0` | The bar border radius (in pixels).
| `inflateAmount` | `number`\|`'auto'` | `'auto'` | The amount of pixels to inflate the bar rectangle(s) when drawing.
| [`pointStyle`](#point-styles) | `string`\|`Image`\|`HTMLCanvasElement` | `'circle'` | Style of the point for legend.
## Arc Configuration
Arcs are used in the polar area, doughnut and pie charts.
Namespace: `options.elements.arc`, global arc options: `Chart.defaults.elements.arc`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `angle` - for polar only | `number` | `circumference / (arc count)` | Arc angle to cover.
| `backgroundColor` | [`Color`](/general/colors.md) | `Chart.defaults.backgroundColor` | Arc fill color.
| `borderAlign` | `'center'`\|`'inner'` | `'center'` | Arc stroke alignment.
| `borderColor` | [`Color`](/general/colors.md) | `'#fff'` | Arc stroke color.
| `borderDash` | `number[]` | `[]` | Arc line dash. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
| `borderDashOffset` | `number` | `0.0` | Arc line dash offset. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `borderJoinStyle` | `'round'`\|`'bevel'`\|`'miter'` | `'bevel'`\|`'round'` | Line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin). The default is `'round'` when `borderAlign` is `'inner'`
| `borderWidth`| `number` | `2` | Arc stroke width.
| `circular` | `boolean` | `true` | By default the Arc is curved. If `circular: false` the Arc will be flat
================================================
FILE: docs/configuration/index.md
================================================
# Configuration
The configuration is used to change how the chart behaves. There are properties to control styling, fonts, the legend, etc.
## Configuration object structure
The top level structure of Chart.js configuration:
```javascript
const config = {
type: 'line',
data: {},
options: {},
plugins: []
}
```
### type
Chart type determines the main type of the chart.
**note** A dataset can override the `type`, this is how mixed charts are constructed.
### data
See [Data Structures](../general/data-structures.md) for details.
### options
Majority of the documentation talks about these options.
### plugins
Inline plugins can be included in this array. It is an alternative way of adding plugins for single chart (vs registering the plugin globally).
More about plugins in the [developers section](../developers/plugins.md).
## Global Configuration
This concept was introduced in Chart.js 1.0 to keep configuration [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
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`. The defaults for each chart type are discussed in the documentation for that chart type.
The following example would set the interaction 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.interaction.mode = 'nearest';
// Interaction mode is set to nearest because it was not overridden here
const chartInteractionModeNearest = new Chart(ctx, {
type: 'line',
data: data
});
// This chart would have the interaction mode that was passed in
const chartDifferentInteractionMode = new Chart(ctx, {
type: 'line',
data: data,
options: {
interaction: {
// Overrides the global setting
mode: 'index'
}
}
});
```
## Dataset Configuration
Options may be configured directly on the dataset. The dataset options can be changed at multiple different levels. See [options](../general/options.md#dataset-level-options) for details on how the options are resolved.
The following example would set the `showLine` option to 'false' for all line datasets except for those overridden by options passed to the dataset on creation.
```javascript
// Do not show lines for all datasets by default
Chart.defaults.datasets.line.showLine = false;
// This chart would show a line only for the third dataset
const chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
data: [0, 0],
}, {
data: [0, 1]
}, {
data: [1, 0],
showLine: true // overrides the `line` dataset default
}, {
type: 'scatter', // 'line' dataset default does not affect this dataset since it's a 'scatter'
data: [1, 1]
}]
}
});
```
================================================
FILE: docs/configuration/interactions.md
================================================
# Interactions
Namespace: `options.interaction`, the global interaction configuration is at `Chart.defaults.interaction`. To configure which events trigger chart interactions, see [events](#events).
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `mode` | `string` | `'nearest'` | Sets which elements appear in the interaction. See [Interaction Modes](#modes) for details.
| `intersect` | `boolean` | `true` | if true, the interaction mode only applies when the mouse position intersects an item on the chart.
| `axis` | `string` | `'x'` | Can be set to `'x'`, `'y'`, `'xy'` or `'r'` to define which directions are used in calculating distances. Defaults to `'x'` for `'index'` mode and `'xy'` in `dataset` and `'nearest'` modes.
| `includeInvisible` | `boolean` | `false` | if true, the invisible points that are outside of the chart area will also be included when evaluating interactions.
By default, these options apply to both the hover and tooltip interactions. The same options can be set in the `options.hover` namespace, in which case they will only affect the hover interaction. Similarly, the options can be set in the `options.plugins.tooltip` namespace to independently configure the tooltip interactions.
## Events
The following properties define how the chart interacts with events.
Namespace: `options`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `events` | `string[]` | `['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove']` | The `events` option defines the browser events that the chart should listen to for. Each of these events trigger hover and are passed to plugins. [more...](#event-option)
| `onHover` | `function` | `null` | Called when any of the events fire over chartArea. Passed the event, an array of active elements (bars, points, etc), and the chart.
| `onClick` | `function` | `null` | Called if the event is of type `'mouseup'`, `'click'` or '`'contextmenu'` over chartArea. 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
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
// This chart will not respond to mousemove, etc
events: ['click']
}
});
```
Events for each plugin can be further limited by defining (allowed) events array in plugin options:
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
// All of these (default) events trigger a hover and are passed to all plugins,
// unless limited at plugin options
events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'],
plugins: {
tooltip: {
// Tooltip will only receive click events
events: ['click']
}
}
}
});
```
Events that do not fire over chartArea, like `mouseout`, can be captured using a simple plugin:
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
// these are the default events:
// events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'],
},
plugins: [{
id: 'myEventCatcher',
beforeEvent(chart, args, pluginOptions) {
const event = args.event;
if (event.type === 'mouseout') {
// process the event
}
}
}]
});
```
For more information about plugins, see [Plugins](../developers/plugins.md)
### Converting Events to Data Values
A common occurrence is taking an event, such as a click, and finding the data coordinates on the chart where the event occurred. Chart.js provides helpers that make this a straightforward process.
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
onClick: (e) => {
const canvasPosition = Chart.helpers.getRelativePosition(e, chart);
// Substitute the appropriate scale IDs
const dataX = chart.scales.x.getValueForPixel(canvasPosition.x);
const dataY = chart.scales.y.getValueForPixel(canvasPosition.y);
}
}
});
```
When using a bundler, the helper functions have to be imported separately, for a full explanation of this please head over to the [integration](../getting-started/integration.md#helper-functions) page
## Modes
When configuring the interaction with the graph via `interaction`, `hover` or `tooltips`, a number of different modes are available.
`options.hover` and `options.plugins.tooltip` extend from `options.interaction`. So if `mode`, `intersect` or any other common settings are configured only in `options.interaction`, both hover and tooltips obey that.
The modes are detailed below and how they behave in conjunction with the `intersect` setting.
See how different modes work with the tooltip in [tooltip interactions sample](../samples/tooltip/interactions.md )
### point
Finds all of the items that intersect the point.
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
interaction: {
mode: 'point'
}
}
});
```
### nearest
Gets the items that are at the nearest distance to the point. The nearest item is determined based on the distance to the center of the chart item (point, bar). You can use the `axis` setting to define which coordinates are considered in distance calculation. 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.
```javascript
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
interaction: {
mode: 'nearest'
}
}
});
```
### 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
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
interaction: {
mode: 'index'
}
}
});
```
To use index mode in a chart like the horizontal bar chart, where we search along the y direction, you can use the `axis` setting introduced in v2.7.0. By setting this value to `'y'` on the y direction is used.
```javascript
const chart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
interaction: {
mode: 'index',
axis: 'y'
}
}
});
```
### 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
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
interaction: {
mode: 'dataset'
}
}
});
```
### 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
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
interaction: {
mode: 'x'
}
}
});
```
### 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
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
interaction: {
mode: 'y'
}
}
});
```
## Custom Interaction Modes
New modes can be defined by adding functions to the `Chart.Interaction.modes` map. You can use the `Chart.Interaction.evaluateInteractionItems` function to help implement these.
Example:
```javascript
import { Interaction } from 'chart.js';
import { getRelativePosition } from 'chart.js/helpers';
/**
* Custom interaction mode
* @function Interaction.modes.myCustomMode
* @param {Chart} chart - the chart we are returning items from
* @param {Event} e - the event we are find things at
* @param {InteractionOptions} options - options to use
* @param {boolean} [useFinalPosition] - use final element position (animation target)
* @return {InteractionItem[]} - items that are found
*/
Interaction.modes.myCustomMode = function(chart, e, options, useFinalPosition) {
const position = getRelativePosition(e, chart);
const items = [];
Interaction.evaluateInteractionItems(chart, 'x', position, (element, datasetIndex, index) => {
if (element.inXRange(position.x, useFinalPosition) && myCustomLogic(element)) {
items.push({element, datasetIndex, index});
}
});
return items;
};
// Then, to use it...
new Chart.js(ctx, {
type: 'line',
data: data,
options: {
interaction: {
mode: 'myCustomMode'
}
}
})
```
If you're using TypeScript, you'll also need to register the new mode:
```typescript
declare module 'chart.js' {
interface InteractionModeMap {
myCustomMode: InteractionModeFunction;
}
}
```
================================================
FILE: docs/configuration/layout.md
================================================
# Layout
Namespace: `options.layout`, the global options for the chart layout is defined in `Chart.defaults.layout`.
| Name | Type | Default | [Scriptable](../general/options.md#scriptable-options) | Description
| ---- | ---- | ------- | :----: | -----------
| `autoPadding` | `boolean` | `true` | No | Apply automatic padding so visible elements are completely drawn.
| `padding` | [`Padding`](../general/padding.md) | `0` | Yes | The padding to add inside the chart.
================================================
FILE: docs/configuration/legend.md
================================================
# Legend
The chart legend displays data about the datasets that are appearing on the chart.
## Configuration options
Namespace: `options.plugins.legend`, the global options for the chart legend is defined in `Chart.defaults.plugins.legend`.
:::warning
The doughnut, pie, and polar area charts override the legend defaults. To change the overrides for those chart types, the options are defined in `Chart.overrides[type].plugins.legend`.
:::
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `display` | `boolean` | `true` | Is the legend shown?
| `position` | `string` | `'top'` | Position of the legend. [more...](#position)
| `align` | `string` | `'center'` | Alignment of the legend. [more...](#align)
| `maxHeight` | `number` | | Maximum height of the legend, in pixels
| `maxWidth` | `number` | | Maximum width of the legend, in pixels
| `fullSize` | `boolean` | `true` | Marks that this box should take the full width/height of the canvas (moving 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. Arguments: `[event, legendItem, legend]`.
| `onHover` | `function` | | A callback that is called when a 'mousemove' event is registered on top of a label item. Arguments: `[event, legendItem, legend]`.
| `onLeave` | `function` | | A callback that is called when a 'mousemove' event is registered outside of a previously hovered label item. Arguments: `[event, legendItem, legend]`.
| `reverse` | `boolean` | `false` | Legend will show datasets in reverse order.
| `labels` | `object` | | See the [Legend Label Configuration](#legend-label-configuration) section below.
| `rtl` | `boolean` | | `true` for rendering the legends from right to left.
| `textDirection` | `string` | canvas' default | This will force the text direction `'rtl'` or `'ltr'` on the canvas for rendering the legend, regardless of the css specified on the canvas
| `title` | `object` | | See the [Legend Title Configuration](#legend-title-configuration) section below.
:::tip Note
If you need more visual customizations, please use an [HTML legend](../samples/legend/html.md).
:::
## Position
Position of the legend. Options are:
* `'top'`
* `'left'`
* `'bottom'`
* `'right'`
* `'chartArea'`
When using the `'chartArea'` option the legend position is at the moment not configurable, it will always be on the left side of the chart in the middle.
## Align
Alignment of the legend. Options are:
* `'start'`
* `'center'`
* `'end'`
Defaults to `'center'` for unrecognized values.
## Legend Label Configuration
Namespace: `options.plugins.legend.labels`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `boxWidth` | `number` | `40` | Width of coloured box.
| `boxHeight` | `number` | `font.size` | Height of the coloured box.
| `color` | [`Color`](../general/colors.md) | `Chart.defaults.color` | Color of label and the strikethrough.
| `font` | `Font` | `Chart.defaults.font` | See [Fonts](../general/fonts.md)
| `padding` | `number` | `10` | Padding between rows of colored boxes.
| `generateLabels` | `function` | | Generates legend items for each thing in the legend. Default implementation returns the text + styling for the color box. See [Legend Item](#legend-item-interface) for details.
| `filter` | `function` | `null` | Filters legend items out of the legend. Receives 2 parameters, a [Legend Item](#legend-item-interface) and the chart data.
| `sort` | `function` | `null` | Sorts legend items. Type is : `sort(a: LegendItem, b: LegendItem, data: ChartData): number;`. Receives 3 parameters, two [Legend Items](#legend-item-interface) and the chart data. The return value of the function is a number that indicates the order of the two legend item parameters. The ordering matches the [return value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description) of `Array.prototype.sort()`
| [`pointStyle`](elements.md#point-styles) | [`pointStyle`](elements.md#types) | `'circle'` | If specified, this style of point is used for the legend. Only used if `usePointStyle` is true.
| `textAlign` | `string` | `'center'` | Horizontal alignment of the label text. Options are: `'left'`, `'right'` or `'center'`.
| `usePointStyle` | `boolean` | `false` | Label style will match corresponding point style (size is based on pointStyleWidth or the minimum value between boxWidth and font.size).
| `pointStyleWidth` | `number` | `null` | If `usePointStyle` is true, the width of the point style used for the legend.
| `useBorderRadius` | `boolean` | `false` | Label borderRadius will match corresponding borderRadius.
| `borderRadius` | `number` | `undefined` | Override the borderRadius to use.
## Legend Title Configuration
Namespace: `options.plugins.legend.title`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `color` | [`Color`](../general/colors.md) | `Chart.defaults.color` | Color of text.
| `display` | `boolean` | `false` | Is the legend title displayed.
| `font` | `Font` | `Chart.defaults.font` | See [Fonts](../general/fonts.md)
| `padding` | [`Padding`](../general/padding.md) | `0` | Padding around the title.
| `text` | `string` | | The string title.
## Legend Item Interface
Items passed to the legend `onClick` function are the ones returned from `labels.generateLabels`. These items must implement the following interface.
```javascript
{
// Label that will be displayed
text: string,
// Border radius of the legend item.
// Introduced in 3.1.0
borderRadius?: number | BorderRadius,
// Index of the associated dataset
datasetIndex: number,
// Fill style of the legend box
fillStyle: Color,
// Text color
fontColor: Color,
// If true, this item represents a hidden dataset. Label will be rendered with a strike-through effect
hidden: boolean,
// For box border. See https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap
lineCap: string,
// For box border. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash
lineDash: number[],
// For box border. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset
lineDashOffset: number,
// For box border. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin
lineJoin: string,
// Width of box border
lineWidth: number,
// Stroke style of the legend box
strokeStyle: Color,
// Point style of the legend box (only used if usePointStyle is true)
pointStyle: string | Image | HTMLCanvasElement,
// Rotation of the point in degrees (only used if usePointStyle is true)
rotation: number
}
```
## Example
The following example will create a chart with the legend enabled and turn all the text red in color.
```javascript
const chart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
plugins: {
legend: {
display: true,
labels: {
color: 'rgb(255, 99, 132)'
}
}
}
}
});
```
## Custom On Click Actions
It can be common to want to trigger different behaviour when clicking an item in the legend. This can be easily achieved using a callback in the config object.
The default legend click handler is:
```javascript
function(e, legendItem, legend) {
const index = legendItem.datasetIndex;
const ci = legend.chart;
if (ci.isDatasetVisible(index)) {
ci.hide(index);
legendItem.hidden = true;
} else {
ci.show(index);
legendItem.hidden = false;
}
}
```
Let's say we wanted instead to link the display of the first two datasets. We could change the click handler accordingly.
```javascript
const defaultLegendClickHandler = Chart.defaults.plugins.legend.onClick;
const pieDoughnutLegendClickHandler = Chart.controllers.doughnut.overrides.plugins.legend.onClick;
const newLegendClickHandler = function (e, legendItem, legend) {
const index = legendItem.datasetIndex;
const type = legend.chart.config.type;
if (index > 1) {
// Do the original logic
if (type === 'pie' || type === 'doughnut') {
pieDoughnutLegendClickHandler(e, legendItem, legend)
} else {
defaultLegendClickHandler(e, legendItem, legend);
}
} else {
let ci = legend.chart;
[
ci.getDatasetMeta(0),
ci.getDatasetMeta(1)
].forEach(function(meta) {
meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
});
ci.update();
}
};
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
legend: {
onClick: newLegendClickHandler
}
}
}
});
```
Now when you click the legend in this chart, the visibility of the first two datasets will be linked together.
================================================
FILE: docs/configuration/locale.md
================================================
# Locale
For applications where the numbers of ticks on scales must be formatted accordingly with a language sensitive number formatting, you can enable this kind of formatting by setting the `locale` option.
The locale is a string that is a [Unicode BCP 47 locale identifier](https://www.unicode.org/reports/tr35/tr35.html#BCP_47_Conformance).
A Unicode BCP 47 locale identifier consists of
1. a language code,
2. (optionally) a script code,
3. (optionally) a region (or country) code,
4. (optionally) one or more variant codes, and
5. (optionally) one or more extension sequences,
with all present components separated by hyphens.
By default, the chart is using the default locale of the platform which is running on.
## Configuration Options
Namespace: `options`
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `locale` | `string` | `undefined` | a string with a BCP 47 language tag, leveraging on [INTL NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat).
================================================
FILE: docs/configuration/responsive.md
================================================
# Responsive Charts
When it comes to changing the chart size based on the window size, a major limitation is that the canvas *render* size (`canvas.width` and `.height`) can **not** be expressed with relative values, contrary to the *display* size (`canvas.style.width` and `.height`). Furthermore, these sizes are independent of each other and thus the canvas *render* size does not adjust automatically based on the *display* size, making the rendering inaccurate.
The following examples **do not work**:
- `