- Notifications
You must be signed in to change notification settings - Fork23
chartjs/chartjs-adapter-luxon
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This adapter allows the use of Luxon with Chart.js. Luxon provides built-in support for time zones and internationalization.
RequiresChart.js2.8.0 or later andLuxon1.0.0 or later.
Note: once loaded, this adapter overrides the default date-adapter provided in Chart.js (as a side-effect).
npm install luxon chartjs-adapter-luxon --saveimport{Chart}from'chart.js';import'chartjs-adapter-luxon';
By default,https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon returns the latest (minified) version, however it'shighly recommended to always specify a version in order to avoid breaking changes. This can be achieved by appending@{version} to the URL:
<scriptsrc="https://cdn.jsdelivr.net/npm/chart.js@^3"></script><scriptsrc="https://cdn.jsdelivr.net/npm/luxon@^2"></script><scriptsrc="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@^1"></script>
Read more about jsDelivr versioning on theirwebsite.
Any date adapter options in the chart configuration will be passed through to Luxon's factory functions.
The following table describes the supported options that these functions accept.
Namespace:options.scales[scaleId].adapters.date
| Name | Type | Default | Description |
|---|---|---|---|
locale | string | undefined | Set a locale to use on the resultingDateTime instance. If not set, the adapter will use thelocale, defined at chart options level. By default, Luxon uses the system's locale. SeeIntl locale. |
numberingSystem | string | undefined | Set the numbering system to set on the resultingDateTime instance. SeeLuxon andIntl numberingSystem documentation. |
outputCalendar | string | undefined | Set the output calendar to set on the resultingDateTime instance. SeeLuxon andIntl calendar documentation. |
setZone | boolean | undefined | Override the zone with a zone specified in the string itself, if it specifies one. By default, Luxon usesoptions.setZone=false. |
zone | string|Zone | undefined | Set the zone to place theDateTime into. By default, Luxon usesoptions.zone='local'. SeeLuxon andIntl timeZone documentation. |
Read theChart.js documention for other possible date/time related options. For example, the time scaletime.* options can be overridden using theLuxon formats.
You first need to install node dependencies (requiresNode.js):
> npm installThe following commands will then be available from the repository root:
> npm run build // build dist files> npm test // perfom code testing> npm run lint // perform code lintingchartjs-adapter-luxon is available under theMIT license.
About
Luxon adapter for Chart.js
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.