{"id":22898212,"url":"https://github.com/albinodrought/chartjs-plugin-downsample","last_synced_at":"2026-03-17T13:13:13.811Z","repository":{"id":71107197,"uuid":"81496879","full_name":"AlbinoDrought/chartjs-plugin-downsample","owner":"AlbinoDrought","description":"Chart.js plugin to downsample chart data","archived":false,"fork":false,"pushed_at":"2020-09-19T01:31:22.000Z","size":140,"stargazers_count":43,"open_issues_count":6,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-21T01:06:40.873Z","etag":null,"topics":["chartjs","downsampling-data"],"latest_commit_sha":null,"homepage":"https://albinodrought.github.io/chartjs-plugin-downsample/","language":"JavaScript","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/AlbinoDrought.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":"2017-02-09T21:31:03.000Z","updated_at":"2025-02-26T01:03:57.000Z","dependencies_parsed_at":"2023-02-25T09:00:57.559Z","dependency_job_id":null,"html_url":"https://github.com/AlbinoDrought/chartjs-plugin-downsample","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbinoDrought%2Fchartjs-plugin-downsample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbinoDrought%2Fchartjs-plugin-downsample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbinoDrought%2Fchartjs-plugin-downsample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbinoDrought%2Fchartjs-plugin-downsample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlbinoDrought","download_url":"https://codeload.github.com/AlbinoDrought/chartjs-plugin-downsample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252967969,"owners_count":21833242,"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":["chartjs","downsampling-data"],"created_at":"2024-12-14T00:29:52.255Z","updated_at":"2026-03-17T13:13:13.725Z","avatar_url":"https://github.com/AlbinoDrought.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chartjs-plugin-downsample\n\nPlugin for downsampling data in Chart.js, based off of [sveinn-steinarsson/flot-downsample](https://github.com/sveinn-steinarsson/flot-downsample).\n\n[![NPM](https://nodei.co/npm/chartjs-plugin-downsample.png)](https://npmjs.org/package/chartjs-plugin-downsample)\n\n## Samples\n\n* [Basic usage](https://albinodrought.github.io/chartjs-plugin-downsample/samples/data.html)\n\n* [Dynamic datasets](https://albinodrought.github.io/chartjs-plugin-downsample/samples/many-datasets.html)\n\n* [Pan and zoom](https://albinodrought.github.io/chartjs-plugin-downsample/samples/panzoom.html)\n\n* [Selective downsampling](https://albinodrought.github.io/chartjs-plugin-downsample/samples/target-datasets.html)\n\n## Configuration\n\nThe configuration for this plugin lives in chartInstance.options.downsample. This looks like the following while setting up your chart:\n\n```js\n{\n    options: {\n        downsample: {\n            enabled: true,\n            threshold: 500 // max number of points to display per dataset\n        }\n    }\n}\n```\n\n### Additional Options\n\n| Option                | Default   | Description                                                                                                                                      |\n| --------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| auto                  | true      | If true, downsamples data automatically every update. Otherwise, chart will have to be manually downsampled with `.downsample()`                 |\n| onInit                | true      | If true, downsamples data when the chart is initialized.                                                                                         |\n| restoreOriginalData   | true      | If true, replaces the downsampled data with the original data after each update. This is, mainly, for compatibility with other plugins.          |\n| preferOriginalData    | false     | If true, downsamples original data instead of data. This option can clash with dynamically-added data. If false, data cannot be \"un-downscaled\". |\n| targetDatasets        | []        | An array of dataset IDs that you want to downsample. If empty or not set, downsamples all datasets.                                              |\n\n## Methods\n\n| Method                                           | Description                                                                                                                               |\n| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| chartInstance.downsample(*var threshold = null*) | Manually downsamples the data on the given chart. If a threshold is passed, updates the threshold in the chart config to the given value. |\n\n## Optimal Performance\n\nThis plugin was created because of performance issues while loading lots of data in a chart with [pan/zoom capabilites](https://github.com/chartjs/chartjs-plugin-zoom/).\n\nIf options are not changed from their defaults, data will be downsampled every time the user pans or zooms - this is probably not what you want. For a more performant configuration, try this:\n\n```js\n{\n    options: {\n        downsample: {\n            enabled: true,\n            threshold: \u003cYOUR THRESHOLD HERE\u003e, // change this\n\n            auto: false, // don't re-downsample the data every move\n            onInit: true, // but do resample it when we init the chart (this is default)\n\n            preferOriginalData: true, // use our original data when downscaling so we can downscale less, if we need to.\n            restoreOriginalData: false, // if auto is false and this is true, original data will be restored on pan/zoom - that isn't what we want.\n        }\n    }\n}\n```\n\n## Building\n\n`npm run build` will generate a browser-ready `chartjs-plugin-downsample.js` and `chartjs-plugin-downsample.min.js`\n\n## License\n\nchartjs-plugin-downsample is released under the terms of [the MIT License](http://www.opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinodrought%2Fchartjs-plugin-downsample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbinodrought%2Fchartjs-plugin-downsample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinodrought%2Fchartjs-plugin-downsample/lists"}