{"id":18930314,"url":"https://github.com/tomhumphries/chartjs-plugin-boxselect","last_synced_at":"2025-07-25T23:33:33.888Z","repository":{"id":43056302,"uuid":"313982919","full_name":"TomHumphries/chartjs-plugin-boxselect","owner":"TomHumphries","description":"Chart.js plugin to select points on a chart with a click-and-drag box","archived":false,"fork":false,"pushed_at":"2021-08-05T02:53:08.000Z","size":248,"stargazers_count":15,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T22:51:13.356Z","etag":null,"topics":["box","chartjs","chartjs-plugin","line","plugin","scatter","select"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TomHumphries.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-18T15:52:26.000Z","updated_at":"2024-12-19T15:28:44.000Z","dependencies_parsed_at":"2022-09-10T03:42:21.048Z","dependency_job_id":null,"html_url":"https://github.com/TomHumphries/chartjs-plugin-boxselect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2Fchartjs-plugin-boxselect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2Fchartjs-plugin-boxselect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2Fchartjs-plugin-boxselect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2Fchartjs-plugin-boxselect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomHumphries","download_url":"https://codeload.github.com/TomHumphries/chartjs-plugin-boxselect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249097929,"owners_count":21212381,"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":["box","chartjs","chartjs-plugin","line","plugin","scatter","select"],"created_at":"2024-11-08T11:37:12.426Z","updated_at":"2025-04-15T15:31:20.305Z","avatar_url":"https://github.com/TomHumphries.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chartjs-plugin-boxselect\n\n![](./docs/demo.gif)\nA [Chart.js](https://www.chartjs.org) plugin to select points using click-and-drag boxes.  \nWorks with `scatter` and `line` chart types.\n\n## Installation\nTo install with npm\n```\nnpm install --save chartjs-plugin-boxselect\n```\nTo use with a `\u003cscript\u003e` tag\n```\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.bundle.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/chartjs-plugin-boxselect\"\u003e\u003c/script\u003e\n```\n\n## Configuration\nTo configure the box-select plugin, add a new config option to a chart config.\n```javascript\nplugins: {\n    boxselect: {\n        select: {\n            enabled: true,\n            direction: 'xy'\n        },\n        callbacks: {\n            beforeSelect: function(startX, endX, startY, endY) {\n                // return false to cancel selection\n                return true;\n            }\n            afterSelect: function(startX, endX, startY, endY, datasets) {\n\n            }\n        }\n    },\n}\n```\n### Options\nThe `direction` setting defines which box shapes can be drawn. The options are `x`, `xy`, or `y`. The default is `xy`.\n\nThe `datasets` parameter in the `afterSelect` callback is the same size as the array of datasets in the chart.   \nEach ```dataset``` has the parameters `data`, `labels`, and `indexes`.  \n`data` contains an array of points that fell inside the selection box.  \n`indexes` contains the corresponding index of each point that was selected from the original `dataset.data`\n`labels` contains the labels (if any) from the dataset that correspond to the selected points.  \n\n## Samples\nA sample chart that shows how the `afterSelect` callback can be used to highlight data is in the /samples directory.\n\n\n\n## Development\n[rollup](https://rollupjs.org/) is required to build.  \nThe built `boxselect.js` file is in the `/dist` directory.  \nThe build command is `npm run build`.\n\n## Credits\nCreated by [Thomas Humphries](https://github.com/TomHumphries).  \nCode inspired by [chartjs-plugin-crosshair](https://github.com/AbelHeinsbroek/chartjs-plugin-crosshair) and [chartjs-plugin-zoom](https://github.com/chartjs/chartjs-plugin-zoom).\n\n## Licence\nchartjs-plugin-boxselect.js is available under the [MIT licence](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhumphries%2Fchartjs-plugin-boxselect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomhumphries%2Fchartjs-plugin-boxselect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhumphries%2Fchartjs-plugin-boxselect/lists"}