Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Luxon adapter for Chart.js

License

NotificationsYou must be signed in to change notification settings

chartjs/chartjs-adapter-luxon

Repository files navigation

releasetravisawesome

Overview

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

Installation

npm

npm install luxon chartjs-adapter-luxon --save
import{Chart}from'chart.js';import'chartjs-adapter-luxon';

CDN

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.

Configuration

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

NameTypeDefaultDescription
localestringundefinedSet 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.
numberingSystemstringundefinedSet the numbering system to set on the resultingDateTime instance. SeeLuxon andIntl numberingSystem documentation.
outputCalendarstringundefinedSet the output calendar to set on the resultingDateTime instance. SeeLuxon andIntl calendar documentation.
setZonebooleanundefinedOverride the zone with a zone specified in the string itself, if it specifies one. By default, Luxon usesoptions.setZone=false.
zonestring|ZoneundefinedSet 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.

Development

You first need to install node dependencies (requiresNode.js):

> npm install

The 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 linting

License

chartjs-adapter-luxon is available under theMIT license.

About

Luxon adapter for Chart.js

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp