All Projects → chartjs → chartjs-adapter-date-fns

chartjs / chartjs-adapter-date-fns

Licence: MIT License
date-fns adapter for Chart.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to chartjs-adapter-date-fns

jdbc-adapter
JDBC adapter for Casbin
Stars: ✭ 26 (-45.83%)
Mutual labels:  adapter
date-php
这是一个Javascript模仿PHP日期时间格式化函数,使用方法和PHP非常类似,有丰富的模板字符,并在原来的基础上增加了一些模板字符。 This is a date function that implement PHP in Javascript. It is very similar to PHP, has rich template characters, and enhances some template characters on the basis of the original.
Stars: ✭ 24 (-50%)
Mutual labels:  datetime
screenAdaptation
Android screen UI adaptation
Stars: ✭ 24 (-50%)
Mutual labels:  adapter
AdapterLayout
ViewGroup backed by RecyclerView.Adapter = magic
Stars: ✭ 58 (+20.83%)
Mutual labels:  adapter
sequelize-adapter
Sequelize adapter for Casbin
Stars: ✭ 51 (+6.25%)
Mutual labels:  adapter
chartjs-chart-wordcloud
Chart.js Word Clouds
Stars: ✭ 34 (-29.17%)
Mutual labels:  chartjs
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (+158.33%)
Mutual labels:  adapter
jalali-pandas
A pandas extension that solves all problems of Jalai/Iraninan/Shamsi dates
Stars: ✭ 29 (-39.58%)
Mutual labels:  datetime
chartjs.github.io
www.chartjs.org
Stars: ✭ 20 (-58.33%)
Mutual labels:  chartjs
ph-commons
Java 1.8+ Library with tons of utility classes required in all projects
Stars: ✭ 23 (-52.08%)
Mutual labels:  datetime
sph-lib
more than 80 gpl3+ licensed guile scheme libraries
Stars: ✭ 15 (-68.75%)
Mutual labels:  datetime
dayjs
Extended fork of Day.js - 2KB immutable date library alternative to Moment.js
Stars: ✭ 36 (-25%)
Mutual labels:  datetime
GhostAdapter
No description or website provided.
Stars: ✭ 15 (-68.75%)
Mutual labels:  adapter
Atomic-Periodic-Table.Android
Atomic - Periodic Table
Stars: ✭ 33 (-31.25%)
Mutual labels:  adapter
adapster
Android library designed to enrich and make your RecyclerView adapters more SOLID
Stars: ✭ 17 (-64.58%)
Mutual labels:  adapter
inquirer-datepicker-prompt
Datepicker prompt for inquirer.js
Stars: ✭ 24 (-50%)
Mutual labels:  datetime
react-SAT
React + Redux + Firebase + FB Oauth + chart.js = Taiwan SAT score transtable helper 📚✍🏼
Stars: ✭ 13 (-72.92%)
Mutual labels:  chartjs
SNAdapter
iOS swift tableview and collectionView Adapter
Stars: ✭ 35 (-27.08%)
Mutual labels:  adapter
chart engine
Chart generator with interchangeable chart engines, like ChartJS and ApexCharts.
Stars: ✭ 16 (-66.67%)
Mutual labels:  chartjs
vuepress-theme-gungnir
A blog theme for VuePress 2.
Stars: ✭ 160 (+233.33%)
Mutual labels:  chartjs

chartjs-adapter-date-fns

release travis awesome

Overview

This adapter allows the use of date-fns with Chart.js.

Requires Chart.js 2.8.0 or later and date-fns 2.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 date-fns chartjs-adapter-date-fns --save
import { Chart } from 'chart.js';
import 'chartjs-adapter-date-fns';

CDN

By default, https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns returns the latest (minified) version, however it's highly recommended to always specify a version in order to avoid breaking changes. This can be achieved by appending @{version} to the url:

<script src="https://cdn.jsdelivr.net/npm/chart.js/dist/chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"></script>

Read more about jsDeliver versioning on their website.

Configuration

Locale support via scale options

date-fns requires a date-fns locale object to be tagged on to each format() call, which requires the locale to be explicitly set via the adapters.date option: Chart.js documentation on adapters.date

For example:

// import date-fns locale:
import {de} from 'date-fns/locale';


// scale options:
{
    adapters: {
        date: {
            locale: de
        }
    }
}

Further, read the Chart.js documentation for other possible date/time related options. For example, the time scale time.* options can be overridden using the date-fns tokens.

Development

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

> npm install

The following commands will then be available from the repository root:

> npm run build         // build dist files
> npm run lint          // perform code linting

License

chartjs-adapter-date-fns is available under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].