{"id":13701959,"url":"https://github.com/jkmnt/chartjs-scale-timestack","last_synced_at":"2025-04-07T21:40:52.272Z","repository":{"id":230396223,"uuid":"777886040","full_name":"jkmnt/chartjs-scale-timestack","owner":"jkmnt","description":"Alternative time axis for Chart.js. Formats time for humans","archived":false,"fork":false,"pushed_at":"2024-03-30T11:00:17.000Z","size":375,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T23:36:59.012Z","etag":null,"topics":["axis","chartjs","scale"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jkmnt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T17:27:02.000Z","updated_at":"2025-02-26T01:00:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"eab3b28f-3b98-4ab9-977a-2a2e73dd826f","html_url":"https://github.com/jkmnt/chartjs-scale-timestack","commit_stats":null,"previous_names":["jkmnt/chartjs-scale-timestack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fchartjs-scale-timestack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fchartjs-scale-timestack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fchartjs-scale-timestack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fchartjs-scale-timestack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkmnt","download_url":"https://codeload.github.com/jkmnt/chartjs-scale-timestack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247735000,"owners_count":20987375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axis","chartjs","scale"],"created_at":"2024-08-02T21:00:28.331Z","updated_at":"2025-04-07T21:40:52.243Z","avatar_url":"https://github.com/jkmnt.png","language":"TypeScript","readme":"# chartjs-scale-timestack\n\n## Overview\n\nThis custom scale adds the new timestack axis to [Chart.js](https://www.chartjs.org).\n\nTimestack formats time in two stacked rows. Top row shows the fine ticks while bottom row\nshows the context.\nTimestack tries hard to choose the ticks looking _nice for humans_, i.e. `14:00`, `14:30`, `15:00`, `15:30` in hourly view and `1`, `5`, `10`, `15`, `25` days of the month in daily view.\n\n![](https://raw.githubusercontent.com/jkmnt/chartjs-scale-timestack/main/cap.png)\n\n[Demo](https://jkmnt.github.io/chartjs-scale-timestack)\n\n## Installation\n\nTimestack internally uses [Luxon](https://moment.github.io/luxon/) for locale-aware time formatting.\n\n### npm\n\n```\nnpm install luxon chartjs-scale-timestack --save\n```\n\n```javascript\nimport { Chart } from 'chart.js';\nimport 'chartjs-scale-timestack';\n```\n\n### CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/chart.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/luxon@3.4.4/build/global/luxon.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/chartjs-scale-timestack/dist/chartjs-scale-timestack.min.js\"\u003e\u003c/script\u003e\n```\n\nTimestack functions are exposed via global `_timestack` object.\n\n## Usage\n\n```javascript\nnew Chart(ctx, {\n  options: {\n    scales: {\n      x: {\n        type: 'timestack',\n      },\n    },\n  },\n  ...\n});\n```\n\nNote:\n\n- The dataset points must be in `{x, y}` format with millisecond timestamps. X-values are not parsed.\n\n  ```javascript\n  const dataset = {\n    data: [\n        {x: 1711537965000, y: 1},\n        {x: 1711537973000, y: 2},\n        ...\n    ]\n  }\n  ```\n\n- X-values as labels are not supported. Use stock `time` scale for these.\n- Bar charts with offset gridlines are not supported. Use `time` scale for these too.\n- Custom tick formatting `callback` is ignored.\n- Using rotated ticks is not recommended. Timestack sets `maxTickRotation` = 0 by default.\n- Ticks `autoSkip` options are not respected. Timestack bypasses the autoSkip algorithm.\n- `ticks.maxTicksLimit` is respected. Timestack will skip the ticks sequences violating it.\n\n## Options\n\nNamespace: `options.scales[id].timescale`\n\n| Name                      | Default                         | Description                                                                                                                                                          |\n| ------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| datetime                  | {}                              | Luxon DateTime creation options (zone, locale, etc)                                                                                                                  |\n| density                   | 0.5                             | Desired labels density [0..1]. Defined as total labels width / scale width                                                                                           |\n| max_density               | 0.75                            | Maximum labels density [0..1]                                                                                                                                        |\n| tooltip_format            | something sane                  | Tooltip format options _(Intl.DateTimeFormatOptions)_                                                                                                                |\n| left_floating_tick_thres  | 0.33 (first 1/3 of scale width) | Add left bottom tick with ellipsis if there are no bottom ticks in first _[thres * axis_width]_ part of scale. Set `false` to disable the feature                    |\n| right_floating_tick_thres | false                           | Add right bottom tick with ellipsis if there are no bottom ticks in last _[thres * axis_width]_ part of scale. Set `false` to disable the feature                    |\n| make_tick_generators      |                                 | Factory function returning array of tick generators to replace the default ones. Would be called just once at chart creation                                         |\n| format_style              |                                 | Formatting options _(Intl.DateTimeFormatOptions)_ to customize the default tick generators format style. i.e. `{hour12: true, month: 'long', minute: '2-digit'}` etc |\n","funding_links":[],"categories":["Plugins"],"sub_categories":["Styling"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkmnt%2Fchartjs-scale-timestack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkmnt%2Fchartjs-scale-timestack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkmnt%2Fchartjs-scale-timestack/lists"}