{"_id":"@antv/g2-brush","_rev":"207820","name":"@antv/g2-brush","description":"Select a one-, two-dimensional or irregular region using the mouse.","dist-tags":{"latest":"0.0.2"},"maintainers":[{"name":"dxq613","email":"dxq613@gmail.com"},{"name":"simaq","email":"sima.zhang1990@gmail.com"},{"name":"dori","email":"418466938@qq.com"},{"name":"leungwensen","email":"leungwensen@gmail.com"}],"time":{"modified":"2023-03-24T08:18:45.000Z","created":"2017-12-15T01:49:47.326Z","0.0.2":"2017-12-15T02:44:02.459Z","0.0.1":"2017-12-15T01:49:47.326Z"},"users":{},"author":{"name":"sima.zhang1990@gmail.com"},"repository":{"type":"git","url":"git+ssh://git@github.com/antvis/g2-brush.git"},"versions":{"0.0.2":{"name":"@antv/g2-brush","version":"0.0.2","description":"Select a one-, two-dimensional or irregular region using the mouse.","main":"build/g2-brush.js","browser":"build/g2-brush.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/antvis/g2-brush.git"},"keywords":["antv","g2-brush","g2"],"author":{"name":"sima.zhang1990@gmail.com"},"license":"MIT","devDependencies":{"@lite-js/torch":"~0.2.6","babel-core":"~6.25.0","babel-eslint":"~7.2.3","babel-loader":"~7.1.1","babel-plugin-transform-remove-strict-mode":"~0.0.2","babel-preset-es2015":"~6.24.1","babel-preset-stage-0":"~6.24.1","chai":"~4.0.1","commander":"~2.9.0","connect":"~3.6.3","d3-queue":"~3.0.7","debug":"~3.1.0","electron":"~1.6.11","eslint":"^3.19.0","eslint-config-airbnb":"~15.0.1","eslint-config-egg":"~4.2.0","eslint-plugin-html":"~3.1.1","get-port":"~3.1.0","gh-pages":"~1.1.0","nightmare":"~2.10.0","nunjucks":"~3.0.1","open":"~0.0.5","parseurl":"~1.3.1","pre-commit":"~1.2.2","serve-static":"~1.12.4","shelljs":"~0.7.8","uglify-js":"~3.0.15","webpack":"~3.3.0"},"scripts":{"build":"webpack","ci":"npm run lint && npm run test","compress":"uglifyjs -c -m -o dist/g2-brush.min.js -- build/g2-brush.js","coverage":"npm run coverage-generator && npm run coverage-viewer","coverage-generator":"torch --compile --coverage --renderer --recursive test/unit","coverage-viewer":"torch-coverage","demos":"electron ./demos/app.js","demos-web":"node ./demos/app.js --web --port 2046","dev":"npm run watch & npm run demos-web","dist":"npm run mkdir-dist && npm run build && npm run compress","lint":"eslint --ext .html,.js ./","lint-fix":"eslint --ext .html,.js --fix ./","mkdir-dist":"node ./bin/mkdir-dist.js","prepublishOnly":"npm run dist","screenshot":"node ./bin/screenshot.js","test":"torch --compile --renderer --recursive ./test/unit","test-live":"torch --compile --interactive --watch --recursive ./test/unit","watch":"webpack --config webpack-dev.config.js","win-dev":"node ./bin/win-dev.js"},"pre-commit":{"run":["lint","build","test"],"silent":false},"gitHead":"3bb8f345c066b2d9f699df1eff83a9bdd9cec526","bugs":{"url":"https://github.com/antvis/g2-brush/issues"},"homepage":"https://github.com/antvis/g2-brush#readme","_id":"@antv/g2-brush@0.0.2","_npmVersion":"5.5.1","_nodeVersion":"8.2.1","_npmUser":{"name":"simaq","email":"sima.zhang1990@gmail.com"},"dist":{"shasum":"0b65f3ebbf82690202913d0b6759ab2900faa841","size":2175348,"noattachment":false,"key":"/@antv/g2-brush/-/@antv/g2-brush-0.0.2.tgz","tarball":"http://name.csiicloud.com:7001/@antv/g2-brush/download/@antv/g2-brush-0.0.2.tgz"},"maintainers":[{"name":"dxq613","email":"dxq613@gmail.com"},{"name":"simaq","email":"sima.zhang1990@gmail.com"},{"name":"dori","email":"418466938@qq.com"},{"name":"leungwensen","email":"leungwensen@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/g2-brush-0.0.2.tgz_1513305842327_0.803009208291769"},"directories":{},"_cnpmcore_publish_time":"2021-12-19T17:54:35.039Z","publish_time":1513305842459,"_cnpm_publish_time":1513305842459},"0.0.1":{"name":"@antv/g2-brush","version":"0.0.1","description":"Select a one-, two-dimensional or irregular region using the mouse.","main":"build/g2-brush.js","browser":"build/g2-brush.min.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/antvis/g2-brush.git"},"keywords":["antv","g2-brush","g2"],"author":{"name":"sima.zhang1990@gmail.com"},"license":"MIT","devDependencies":{"@lite-js/torch":"~0.2.6","babel-core":"~6.25.0","babel-eslint":"~7.2.3","babel-loader":"~7.1.1","babel-plugin-transform-remove-strict-mode":"~0.0.2","babel-preset-es2015":"~6.24.1","babel-preset-stage-0":"~6.24.1","chai":"~4.0.1","commander":"~2.9.0","connect":"~3.6.3","d3-queue":"~3.0.7","debug":"~3.1.0","electron":"~1.6.11","eslint":"^3.19.0","eslint-config-airbnb":"~15.0.1","eslint-config-egg":"~4.2.0","eslint-plugin-html":"~3.1.1","get-port":"~3.1.0","gh-pages":"~1.1.0","nightmare":"~2.10.0","nunjucks":"~3.0.1","open":"~0.0.5","parseurl":"~1.3.1","pre-commit":"~1.2.2","serve-static":"~1.12.4","shelljs":"~0.7.8","uglify-js":"~3.0.15","webpack":"~3.3.0"},"scripts":{"build":"webpack","ci":"npm run lint && npm run test","compress":"uglifyjs -c -m -o dist/g2-brush.min.js -- build/g2-brush.js","coverage":"npm run coverage-generator && npm run coverage-viewer","coverage-generator":"torch --compile --coverage --renderer --recursive test/unit","coverage-viewer":"torch-coverage","demos":"electron ./demos/app.js","demos-web":"node ./demos/app.js --web --port 2046","dev":"npm run watch & npm run demos-web","dist":"npm run mkdir-dist && npm run build && npm run compress","lint":"eslint --ext .html,.js ./","lint-fix":"eslint --ext .html,.js --fix ./","mkdir-dist":"node ./bin/mkdir-dist.js","prepublishOnly":"npm run dist","screenshot":"node ./bin/screenshot.js","test":"torch --compile --renderer --recursive ./test/unit","test-live":"torch --compile --interactive --watch --recursive ./test/unit","watch":"webpack --config webpack-dev.config.js","win-dev":"node ./bin/win-dev.js"},"pre-commit":{"run":["lint","build","test"],"silent":false},"gitHead":"d256aadd1a467c0c4931ff1636b632fe5b039ff5","bugs":{"url":"https://github.com/antvis/g2-brush/issues"},"homepage":"https://github.com/antvis/g2-brush#readme","_id":"@antv/g2-brush@0.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.2.1","_npmUser":{"name":"simaq","email":"sima.zhang1990@gmail.com"},"dist":{"shasum":"49d742c6c2b7a7e8bab0849189cd3a02b5c9edee","size":2175334,"noattachment":false,"key":"/@antv/g2-brush/-/@antv/g2-brush-0.0.1.tgz","tarball":"http://name.csiicloud.com:7001/@antv/g2-brush/download/@antv/g2-brush-0.0.1.tgz"},"maintainers":[{"name":"simaq","email":"sima.zhang1990@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/g2-brush-0.0.1.tgz_1513302587188_0.4717444512061775"},"directories":{},"_cnpmcore_publish_time":"2021-12-19T17:54:34.076Z","publish_time":1513302587326,"_cnpm_publish_time":1513302587326}},"readme":"# g2-brush\n\n![](https://img.shields.io/badge/language-javascript-red.svg)\n![](https://img.shields.io/badge/license-MIT-000000.svg)\n\n[![npm package](https://img.shields.io/npm/v/@antv/g2-brush.svg)](https://www.npmjs.com/package/@antv/g2-brush)\n[![NPM downloads](http://img.shields.io/npm/dm/@antv/g2-brush.svg)](https://npmjs.org/package/@antv/g2-brush)\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/antvis/g2-brush.svg)](http://isitmaintained.com/project/antvis/g2-brush \"Percentage of issues still open\")\n\n\n## Install\n\n```bash\n$ npm install @antv/g2-brush\n```\n\nor use cdn:\n\n```html\n<script src=\"https://gw.alipayobjects.com/os/antv/assets/g2-brush/0.0.1/g2-brush.js\"></script>\n```\n\n## Usage\n\nFirst of all, the brush instance must be created after the chart be rendered.\n\n```js\nimport Brush from '@antv/g2-brush';\n// ...\nchart.render();\n\nnew Brush({\n  canvas: chart.get('canvas'), // must be set\n  chart, // if you want to filter data by default, please set the chart\n  type: 'X', // set the brush type, default value is 'XY'\n});\n```\n\n### Example\n\nonline demos: [https://antvis.github.io/g2-brush/demos/#](https://antvis.github.io/g2-brush/demos/#)\n\n![](https://gw.alipayobjects.com/zos/rmsportal/HRkzmAbHDcJYweUxDAlC.gif)\n\n```js\n$.getJSON('./data/top2000.json', data => {\n  const ds = new DataSet();\n  const dv = ds.createView('test')\n    .source(data)\n    .transform({\n      as: [ 'count' ],\n      groupBy: [ 'release' ],\n      operations: [ 'count' ],\n      type: 'aggregate'\n    });\n\n  const chart = new G2.Chart({\n    container: 'canvas',\n    forceFit: true,\n    height: window.innerHeight\n  });\n  chart.source(dv);\n  chart.scale({\n    count: {\n      alias: 'top2000 唱片总量'\n    },\n    release: {\n      tickInterval: 5,\n      alias: '唱片发行年份'\n    }\n  });\n  chart.interval()\n    .position('release*count')\n    .color('#e50000');\n\n  chart.render();\n\n  new Brush({\n    canvas: chart.get('canvas'),\n    chart,\n    type: 'X',\n    onBrushstart() {\n      chart.hideTooltip();\n    },\n    onBrushmove() {\n      chart.hideTooltip();\n    }\n  });\n  chart.on('plotdblclick', () => {\n    chart.get('options').filters = {};\n    chart.repaint();\n  });\n});\n```\n\n## API\n\n[API DOCS](https://github.com/antvis/g2-brush/blob/master/docs/brush.md)\n\n## Development\n\n```bash\n$ npm install\n\n$ npm run dev\n```\n\n## How to Contribute\n\nPlease let us know how can we help. Do check out [issues](https://github.com/antvis/g2-brush/issues) for bug reports or suggestions first.\n\nTo become a contributor, please follow our [contributing guide](https://github.com/antvis/g2-brush/blob/master/CONTRIBUTING.md).\n","_attachments":{},"homepage":"https://github.com/antvis/g2-brush#readme","bugs":{"url":"https://github.com/antvis/g2-brush/issues"},"license":"MIT"}