├── ci.opts ├── src ├── themes │ └── index.js ├── shared │ ├── index.js │ ├── prop.js │ └── util.js ├── components │ ├── Axis │ │ └── index.jsx │ ├── Coord │ │ └── index.jsx │ ├── Tooltip │ │ └── index.jsx │ ├── Facet │ │ └── index.jsx │ ├── Geom │ │ └── index.jsx │ ├── TypedGeom │ │ ├── Area │ │ │ └── index.jsx │ │ ├── Edge │ │ │ └── index.jsx │ │ ├── Line │ │ │ └── index.jsx │ │ ├── Path │ │ │ └── index.jsx │ │ ├── Point │ │ │ └── index.jsx │ │ ├── Venn │ │ │ └── index.jsx │ │ ├── Schema │ │ │ └── index.jsx │ │ ├── Heatmap │ │ │ └── index.jsx │ │ ├── Interval │ │ │ └── index.jsx │ │ ├── Polygon │ │ │ └── index.jsx │ │ ├── index.jsx │ │ └── generateTypedGeom.jsx │ ├── index.js │ ├── ErrorBoundary │ │ └── index.jsx │ ├── Legend │ │ └── index.jsx │ ├── Guide │ │ └── index.jsx │ ├── Chart │ │ ├── empty.jsx │ │ ├── index.jsx │ │ └── purechart.jsx │ ├── View │ │ └── index.jsx │ ├── Label │ │ └── index.jsx │ └── Base │ │ └── index.jsx ├── processor │ ├── common.js │ └── g2Delete.js ├── core.jsx └── index.jsx ├── .eslintignore ├── test ├── readme.md ├── index.js └── specs │ └── component │ ├── View.js │ ├── Coord.js │ ├── Guide.js │ └── Chart.js ├── plugin └── slider │ ├── .npmignore │ ├── demo │ ├── index.html │ └── webpack.config.js │ ├── src │ ├── error-boundary.jsx │ └── index.jsx │ ├── CHANGELOG.md │ ├── .eslintrc │ └── webpack.config.js ├── .travis.yml ├── .npmignore ├── .gitignore ├── demo ├── index.html ├── .babelrc ├── component │ ├── empty │ │ ├── index.js │ │ └── empty.js │ ├── theme │ │ ├── index.js │ │ └── black.js │ ├── relation │ │ ├── index.js │ │ └── arc.js │ ├── slider │ │ └── index.js │ ├── facet │ │ ├── index.js │ │ ├── list.js │ │ └── listFunChild.js │ ├── point │ │ ├── index.js │ │ ├── jitter.js │ │ └── bubble.js │ ├── funnel │ │ ├── index.js │ │ ├── basic.js │ │ └── symmetric.js │ ├── map │ │ ├── index.js │ │ └── china.js │ ├── others │ │ ├── index.js │ │ ├── htmlTooltip.js │ │ └── customLegend.js │ ├── guage │ │ ├── index.js │ │ └── basic.js │ ├── line │ │ ├── index.js │ │ ├── basic.js │ │ ├── step.js │ │ └── series.js │ ├── heatmap │ │ ├── index.js │ │ ├── image.js │ │ ├── rectangle.js │ │ └── heatmap.js │ ├── guide │ │ ├── index.js │ │ ├── dataMarker_dataRegion.js │ │ └── regionFilter-guide2.js │ ├── pie │ │ ├── index.js │ │ ├── rose.js │ │ ├── pie.js │ │ ├── donutRose.js │ │ └── sunburst.js │ ├── area │ │ ├── index.js │ │ ├── basic.js │ │ ├── stacked.js │ │ └── percent.js │ ├── bar │ │ ├── index.js │ │ ├── basic-column.js │ │ ├── basic.js │ │ ├── histogramStack.js │ │ ├── grouped.js │ │ └── histogram.js │ ├── index.js │ └── cloud │ │ └── index.js ├── index.js ├── webpack.config.js └── container │ └── App.js ├── testDemo ├── index.html ├── .babelrc ├── component │ ├── bugs │ │ └── index.js │ ├── guide │ │ └── index.js │ ├── axis │ │ └── index.js │ ├── geom │ │ ├── index.js │ │ └── adddelete.js │ ├── legend │ │ ├── index.js │ │ └── adddelete.js │ ├── tooltip │ │ └── index.js │ ├── com16 │ │ ├── index.js │ │ ├── listFacet.js │ │ ├── basic.js │ │ └── view.js │ ├── viewUpdate │ │ └── index.js │ ├── coord │ │ ├── index.js │ │ ├── adddelete.js │ │ ├── updateRect.js │ │ ├── updateHelix.js │ │ ├── updatePolar.js │ │ └── updateTheta.js │ ├── index.js │ └── viewAD │ │ ├── index.js │ │ ├── coordAD.js │ │ ├── axisAD.js │ │ └── geomAD.js ├── index.js ├── webpack.config.js └── container │ └── App.js ├── .babelrc ├── .github └── issue_template.md ├── scripts ├── build.js └── release.sh ├── doc ├── tutorial │ ├── data.md │ ├── theme.md │ ├── interaction.md │ ├── chart.md │ ├── needload.md │ └── start.md ├── faq │ └── faq.md ├── README.md └── api │ ├── view.md │ ├── connector.md │ ├── bizcharts.md │ ├── label.md │ └── graphic.md ├── .editorconfig ├── doc_en ├── tutorial │ ├── data.md │ ├── theme.md │ ├── interaction.md │ ├── chart.md │ └── start.md ├── faq │ └── faq.md ├── README.md └── api │ ├── view.md │ ├── label.md │ └── bizcharts.md ├── typings ├── tslint.json └── tsconfig.json ├── .eslintrc ├── LICENSE └── webpack.config.js /ci.opts: -------------------------------------------------------------------------------- 1 | --require babel-core/register 2 | -------------------------------------------------------------------------------- /src/themes/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * themes 3 | */ 4 | export default { 5 | }; 6 | -------------------------------------------------------------------------------- /src/shared/index.js: -------------------------------------------------------------------------------- 1 | export Util from './util'; 2 | export Prop from './prop'; 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/ 2 | demo/ 3 | testDemo/ 4 | doc/ 5 | es6/ 6 | node_modules/ 7 | lib/ -------------------------------------------------------------------------------- /test/readme.md: -------------------------------------------------------------------------------- 1 | # 由于测试框架的兼容性,内部版本的测试用例正在火速移植中,敬请等待。 2 | # [站点](https://alibaba.github.io/BizCharts/demo.html)上一百多个 demo 都已经顺利正常运行。 -------------------------------------------------------------------------------- /src/components/Axis/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Axis Component 3 | */ 4 | import Base from '../Base'; 5 | 6 | export default Base.generateBaseTypedComponent('Axis'); 7 | -------------------------------------------------------------------------------- /src/components/Coord/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Coord Component 3 | */ 4 | import Base from '../Base'; 5 | 6 | export default Base.generateBaseTypedComponent('Coord'); 7 | -------------------------------------------------------------------------------- /plugin/slider/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | node_modules 4 | coverage 5 | npm-debug.log 6 | *.orig 7 | .vscode/* 8 | test/* 9 | doc/* 10 | pages/* 11 | demo/* -------------------------------------------------------------------------------- /src/components/Tooltip/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Tooltip Component 3 | */ 4 | import Base from '../Base'; 5 | 6 | export default Base.generateBaseTypedComponent('Tooltip'); 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - "8" 5 | 6 | install: 7 | - npm install 8 | 9 | script: 10 | - npm run lint 11 | - npm run test:pre 12 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | node_modules 4 | coverage 5 | npm-debug.log 6 | *.orig 7 | .vscode/* 8 | test/* 9 | doc/* 10 | pages/* 11 | demo/* 12 | testDemo/* 13 | plugin/* -------------------------------------------------------------------------------- /src/components/Facet/index.jsx: -------------------------------------------------------------------------------- 1 | import '@antv/g2/lib/facet/index'; 2 | import BaseComponent from '../Base'; 3 | 4 | export default BaseComponent.generateBaseTypedComponent('Facet'); 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | node_modules 4 | umd 5 | lib 6 | es6 7 | coverage 8 | npm-debug.log 9 | *.orig 10 | .vscode/* 11 | plugin/slider/node_modules 12 | **/**/coverage/ 13 | -------------------------------------------------------------------------------- /src/components/Geom/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Geom Component 3 | */ 4 | import '@antv/g2/lib/geom/index'; 5 | import Base from '../Base'; 6 | 7 | export default Base.generateBaseTypedComponent('Geom'); 8 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | BizCharts Demo 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /testDemo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | BizCharts Demo 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-0", "react"], 3 | "plugins": [ 4 | "transform-object-assign" 5 | ], 6 | "env": { 7 | "test": { 8 | "plugins": [ "istanbul" ] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | - bizcharts Version: 2 | - Platform or react version: 3 | - Mini Showcase(like screenshots): 4 | - CodePen Link: 5 | - you can fork CodePen template form this: https://codepen.io/leslie2014/pen/xjJGER 6 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Area/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/area'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'area'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Edge/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/edge'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'edge'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Line/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/line'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'line'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Path/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/path'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'path'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Point/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/point'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'point'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Venn/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/venn'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'venn'); 8 | -------------------------------------------------------------------------------- /plugin/slider/demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | BizCharts-plugin-slider Demo 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Schema/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/schema'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'schema'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Heatmap/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/heatmap'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'heatmap'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Interval/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/interval'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'interval'); 8 | -------------------------------------------------------------------------------- /src/components/TypedGeom/Polygon/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Line geometry Component 3 | */ 4 | import '@antv/g2/lib/geom/polygon'; 5 | import generateTypedGeom from '../generateTypedGeom'; 6 | 7 | export default generateTypedGeom('Geom', 'polygon'); 8 | -------------------------------------------------------------------------------- /src/processor/common.js: -------------------------------------------------------------------------------- 1 | export default { 2 | COORD_FUNC_PROPS: ['rotate', 'scale', 'reflect', 'transpose'], 3 | GEOM_FUNC_PROPS: ['position', 'color', 'size', 'shape', 4 | 'opacity', 'tooltip', 'style', 'animate', 'active', 'select'], 5 | }; 6 | -------------------------------------------------------------------------------- /demo/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | plugins: [ 3 | "transform-export-extensions", 4 | "transform-decorators-legacy", 5 | "transform-class-properties", 6 | "transform-object-rest-spread", 7 | "transform-function-bind", 8 | ], 9 | presets: ["es2015", "react"] 10 | } 11 | -------------------------------------------------------------------------------- /testDemo/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | plugins: [ 3 | "transform-export-extensions", 4 | "transform-decorators-legacy", 5 | "transform-class-properties", 6 | "transform-object-rest-spread", 7 | "transform-function-bind", 8 | ], 9 | presets: ["es2015", "react"] 10 | } 11 | -------------------------------------------------------------------------------- /scripts/build.js: -------------------------------------------------------------------------------- 1 | var execSync = require('child_process').execSync; 2 | var readFileSync = require('fs').readFileSync; 3 | 4 | function exec(command) { 5 | execSync(command, { stdio: [0, 1, 2] }); 6 | } 7 | 8 | exec('npm run build'); 9 | exec('npm run build-umd'); 10 | exec('npm run build-min'); 11 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | // general component 2 | require('./specs/component/Chart'); 3 | require('./specs/component/Coord'); 4 | require('./specs/component/View'); 5 | require('./specs/component/Guide'); 6 | require('./specs/component/Geom'); 7 | require('./specs/component/Label'); 8 | require('./specs/component/Tooltip'); 9 | -------------------------------------------------------------------------------- /demo/component/empty/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Empty from './empty'; 3 | 4 | 5 | export default class LineChart extends Component { 6 | render() { 7 | return ( 8 |
9 | 10 |
11 | ); 12 | } 13 | } -------------------------------------------------------------------------------- /doc/tutorial/data.md: -------------------------------------------------------------------------------- 1 | 2 | # 数据 3 | 4 | *文档转自G2* 5 | 6 | ## 数据格式 7 | 图表数据支持两种数据格式: 8 | - JSON数组 9 | - DataView 对象。 10 | 11 | ### JSON 数组 12 | Example: 13 | 14 | ```js 15 | var data = [ 16 | {"gender":"男","count":40}, 17 | {"gender":"女","count":30} 18 | ]; 19 | ``` 20 | 21 | ### DataView 22 | 详见 [DataSet 教程](./dataset.md)。 -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [makefile] 16 | indent_style = tab 17 | indent_size = 4 -------------------------------------------------------------------------------- /testDemo/component/bugs/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import DataChange from './datachange'; 3 | 4 | // data in render, padding change error 5 | export default class Guide extends Component { 6 | render() { 7 | return ( 8 |
9 | 10 |
11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /demo/component/empty/empty.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | 4 | 5 | 6 | export default class BasicLineChart extends Component { 7 | 8 | render() { 9 | return ( 10 | 11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/components/index.js: -------------------------------------------------------------------------------- 1 | 2 | export Chart from './Chart'; 3 | export Coord from './Coord'; 4 | export Axis from './Axis'; 5 | export Legend from './Legend'; 6 | export Tooltip from './Tooltip'; 7 | export Geom from './Geom'; 8 | export View from './View'; 9 | export Guide from './Guide'; 10 | export Label from './Label'; 11 | export Facet from './Facet'; 12 | -------------------------------------------------------------------------------- /testDemo/component/guide/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AddDelete from './adddelete'; 3 | import Update from './update'; 4 | 5 | 6 | export default class Guide extends Component { 7 | render() { 8 | return ( 9 |
10 | 11 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testDemo/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import { Router, Route, browserHistory } from 'react-router'; 4 | import App from './container/App'; 5 | 6 | ReactDOM.render(( 7 | 8 | 9 | 10 | ), document.getElementById('root')); 11 | -------------------------------------------------------------------------------- /src/components/TypedGeom/index.jsx: -------------------------------------------------------------------------------- 1 | export Area from './Area'; 2 | export Edge from './Edge'; 3 | export Heatmap from './Heatmap'; 4 | export Line from './Line'; 5 | export Interval from './Interval'; 6 | export Path from './Path'; 7 | export Point from './Point'; 8 | export Polygon from './Polygon'; 9 | export Schema from './Schema'; 10 | export Venn from './Venn'; 11 | -------------------------------------------------------------------------------- /testDemo/component/axis/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AddDelete from './adddelete'; 3 | import UpdateRect from './updateRect'; 4 | 5 | 6 | export default class Guide extends Component { 7 | render() { 8 | return ( 9 |
10 | 11 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testDemo/component/geom/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AddDelete from './adddelete'; 3 | import UpdateRect from './updateRect'; 4 | 5 | 6 | export default class Guide extends Component { 7 | render() { 8 | return ( 9 |
10 | 11 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testDemo/component/legend/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AddDelete from './adddelete'; 3 | import UpdateRect from './updateRect'; 4 | 5 | 6 | export default class Guide extends Component { 7 | render() { 8 | return ( 9 |
10 | 11 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testDemo/component/tooltip/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AddDelete from './adddelete'; 3 | import UpdateRect from './updateRect'; 4 | 5 | 6 | export default class Guide extends Component { 7 | render() { 8 | return ( 9 |
10 | 11 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo/component/theme/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Black from './black'; 3 | 4 | 5 | export default class ThemeChart extends Component { 6 | render() { 7 | return ( 8 |
9 |
10 | 11 |
12 |
13 | ); 14 | } 15 | } -------------------------------------------------------------------------------- /demo/component/relation/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Arc from './arc'; 3 | 4 | 5 | export default class RelationChart extends Component { 6 | render() { 7 | return ( 8 |
9 |
10 | 11 |
12 |
13 | ); 14 | } 15 | } -------------------------------------------------------------------------------- /demo/component/slider/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Basic from './basic'; 3 | 4 | 5 | export default class SliderChart extends Component { 6 | render() { 7 | return ( 8 |
9 |
10 | 11 |
12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo/index.js: -------------------------------------------------------------------------------- 1 | import 'core-js/es6/set'; 2 | import 'core-js/es6/map'; 3 | 4 | import React from 'react'; 5 | import ReactDOM from 'react-dom'; 6 | import { Router, Route, browserHistory } from 'react-router'; 7 | import App from './container/App'; 8 | 9 | ReactDOM.render(( 10 | 11 | 12 | 13 | ), document.getElementById('root')); 14 | -------------------------------------------------------------------------------- /demo/component/facet/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import List from './list'; 3 | import ListFuncChild from './listFunChild'; 4 | 5 | 6 | 7 | export default class FacetChart extends Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 |
14 |
15 | ); 16 | } 17 | } -------------------------------------------------------------------------------- /doc_en/tutorial/data.md: -------------------------------------------------------------------------------- 1 | 2 | # Source Data 3 | 4 | *Documents are forwarded from G2* 5 | 6 | ## Data Formats 7 | Chart data supports two data formats: 8 | - JSON 9 | - Instance of DataView 10 | 11 | ### JSON (Array) 12 | Example: 13 | 14 | ```js 15 | var data = [ 16 | {"gender":"male","count":40}, 17 | {"gender":"female","count":30} 18 | ]; 19 | ``` 20 | 21 | ### DataView 22 | See the detail at [DataSet](./dataset.md). 23 | -------------------------------------------------------------------------------- /demo/component/point/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Jitter from './jitter'; 3 | import Bubble from './bubble'; 4 | 5 | export default class PointChart extends Component { 6 | render() { 7 | return ( 8 |
9 |
10 | 11 | 12 |
13 |
14 | ); 15 | } 16 | } -------------------------------------------------------------------------------- /demo/component/funnel/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Basic from './basic'; 3 | import Symmetric from './symmetric'; 4 | 5 | 6 | export default class FunnelChart extends Component { 7 | render() { 8 | return ( 9 |
10 |
11 | 12 | 13 |
14 |
15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /demo/component/map/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import China from './china'; 3 | import Choropleth from './choropleth'; 4 | 5 | 6 | export default class MapChart extends Component { 7 | render() { 8 | return ( 9 |
10 |
11 | 12 | 13 |
14 |
15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /demo/component/others/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import HtmlTooltip from './htmlTooltip'; 3 | import CustomLegend from './customLegend'; 4 | 5 | 6 | export default class OtherChart extends Component { 7 | render() { 8 | return ( 9 |
10 |
11 | 12 | 13 |
14 |
15 | ); 16 | } 17 | } -------------------------------------------------------------------------------- /demo/component/guage/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Basic from './basic'; 3 | import Color from './color'; 4 | import Text from './text'; 5 | 6 | 7 | export default class GuageChart extends Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 | 14 | 15 |
16 |
17 | ); 18 | } 19 | } -------------------------------------------------------------------------------- /demo/component/line/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Basic from './basic'; 3 | import Series from './series'; 4 | import Step from './step'; 5 | 6 | 7 | export default class LineChart extends Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 | 14 | 15 |
16 |
17 | ); 18 | } 19 | } -------------------------------------------------------------------------------- /demo/component/heatmap/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Heatmap from './heatmap'; 3 | import Image from './image'; 4 | import Reactangle from './rectangle'; 5 | 6 | 7 | export default class HeatmapChart extends Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 | 14 | 15 |
16 |
17 | ); 18 | } 19 | } -------------------------------------------------------------------------------- /testDemo/component/com16/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Basic from './basic'; 3 | import ViewChart from './view'; 4 | import ListFacet from './listFacet'; 5 | 6 | 7 | export default class LineChart extends Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 | 14 | 15 |
16 |
17 | ); 18 | } 19 | } -------------------------------------------------------------------------------- /demo/component/guide/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import RegionFilterGuide2 from './regionFilter-guide2'; 3 | import DataMarkerDataRegion from './dataMarker_dataRegion'; 4 | import RegionFilterRealtime from './regionFilter-realtime'; 5 | 6 | export default class GuageChart extends Component { 7 | render() { 8 | return ( 9 |
10 | 11 | 12 | 13 |
14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /demo/component/pie/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Pie from './pie'; 3 | import Rose from './rose'; 4 | import DonutRose from './donutRose'; 5 | import Sunburst from './sunburst'; 6 | 7 | export default class PieChart extends Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 | 14 | 15 | 16 |
17 |
18 | ); 19 | } 20 | } -------------------------------------------------------------------------------- /testDemo/component/viewUpdate/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AxisUpdate from './axisUpdate'; 3 | import CoordUpdate from './coordUpdate'; 4 | import GeomUpdate from './geomUpdate'; 5 | import GuideUpdate from './guideUpdate'; 6 | 7 | 8 | export default class GuideUpdateChart extends Component { 9 | render() { 10 | return ( 11 |
12 | 13 | 14 | 15 | 16 |
17 | ); 18 | } 19 | } -------------------------------------------------------------------------------- /typings/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "dtslint/dt.json", 3 | "rules": { 4 | // TODOs 5 | "ban-types": false, 6 | "dt-header": false, 7 | "no-any-union": false, 8 | "no-declare-current-package": false, 9 | "no-duplicate-imports": false, 10 | "no-empty-interface": false, 11 | "no-mergeable-namespace": false, 12 | "no-unnecessary-qualifier": false, 13 | "no-unnecessary-type-assertion": false, 14 | "strict-export-declare-modifiers": false, 15 | "use-default-type-parameter": false 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/components/ErrorBoundary/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default class ErrorBoundary extends React.Component { 4 | constructor(props) { 5 | super(props); 6 | this.state = { hasError: false }; 7 | } 8 | 9 | componentDidCatch() { 10 | this.setState({ hasError: true }); 11 | } 12 | 13 | unstable_handleError() { 14 | this.setState({ hasError: true }); 15 | } 16 | 17 | render() { 18 | if (this.state.hasError) { 19 | return

bizcharts error.

; 20 | } 21 | return this.props.children; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /testDemo/component/coord/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AddDelete from './adddelete'; 3 | import UpdatePolar from './updatePolar'; 4 | import UpdateHelix from './updateHelix'; 5 | import UpdateRect from './updateRect'; 6 | import UpdateTheta from './updateTheta'; 7 | 8 | 9 | export default class Guide extends Component { 10 | render() { 11 | return ( 12 |
13 | 14 | 15 | 16 | 17 | 18 |
19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testDemo/component/index.js: -------------------------------------------------------------------------------- 1 | import Guide from './guide'; 2 | import Coord from './coord'; 3 | import Axis from './axis'; 4 | import Geom from './geom'; 5 | import Legend from './legend'; 6 | import Tooltip from './tooltip'; 7 | import ViewAD from './viewAD'; 8 | import ViewUpdate from './viewUpdate'; 9 | import Com16 from './com16'; 10 | import Bugs from './bugs'; 11 | 12 | 13 | export default { 14 | Demos: { 15 | Guide, 16 | Coord, 17 | Axis, 18 | Geom, 19 | Legend, 20 | Tooltip, 21 | ViewAD, 22 | ViewUpdate, 23 | Com16, 24 | Bugs 25 | }, 26 | }; 27 | -------------------------------------------------------------------------------- /plugin/slider/src/error-boundary.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | export default class ErrorBoundary extends React.Component { 4 | constructor(props) { 5 | super(props); 6 | this.state = { hasError: false }; 7 | } 8 | 9 | componentDidCatch(error, info) { 10 | this.setState({ hasError: true }); 11 | } 12 | 13 | unstable_handleError(error, info) { 14 | this.setState({ hasError: true }); 15 | } 16 | 17 | render() { 18 | if (this.state.hasError) { 19 | return

Slider error.

; 20 | } 21 | return this.props.children; 22 | } 23 | } -------------------------------------------------------------------------------- /src/core.jsx: -------------------------------------------------------------------------------- 1 | import G2, { Shape, PathUtil, Animate } from '@antv/g2/lib/core'; 2 | import Util from './shared/util'; 3 | import Themes from './themes'; 4 | 5 | const BizCharts = { 6 | G2, 7 | Util, 8 | Shape, 9 | Animate, 10 | PathUtil, 11 | track(enable = false) { 12 | // for srs 13 | G2.track(enable); 14 | }, 15 | setTheme(theme) { 16 | let themeObj = theme; 17 | if (typeof theme === 'string' && Themes[theme]) { 18 | themeObj = Themes[theme]; 19 | } 20 | 21 | G2.Global.setTheme(themeObj); 22 | }, 23 | }; 24 | 25 | exports.default = BizCharts; 26 | module.exports = BizCharts; 27 | -------------------------------------------------------------------------------- /demo/component/area/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Basic from './basic'; 3 | import Percent from './percent'; 4 | import Stacked from './stacked'; 5 | 6 | 7 | export default class AreaChart extends Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 | 19 |
20 |
21 | ); 22 | } 23 | } -------------------------------------------------------------------------------- /demo/component/bar/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Basic from './basic'; 3 | import BasicColumn from './basic-column'; 4 | import Grouped from './grouped'; 5 | import Historgram from './histogram'; 6 | import HistogramStack from './histogramStack'; 7 | 8 | export default class BarChart extends Component { 9 | render() { 10 | return ( 11 |
12 |
13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | ); 21 | } 22 | } -------------------------------------------------------------------------------- /typings/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "index.d.ts", 4 | "bizcharts-tests.tsx" 5 | ], 6 | "compilerOptions": { 7 | "module": "commonjs", 8 | "lib": [ 9 | "es6", 10 | "dom" 11 | ], 12 | "noImplicitAny": false, 13 | "noImplicitThis": true, 14 | "strictNullChecks": false, 15 | "strictFunctionTypes": false, 16 | "baseUrl": "../", 17 | "jsx": "react", 18 | "experimentalDecorators": true, 19 | "typeRoots": [ 20 | "../" 21 | ], 22 | "types": [], 23 | "noEmit": true, 24 | "forceConsistentCasingInFileNames": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/index.jsx: -------------------------------------------------------------------------------- 1 | import G2, { Shape, PathUtil, Animate } from '@antv/g2/lib/core'; 2 | import Util from './shared/util'; 3 | import Themes from './themes'; 4 | import * as components from './components'; 5 | 6 | G2.Global.animate = false; 7 | 8 | const BizCharts = Util.mix(components, { 9 | G2, 10 | Util, 11 | Shape, 12 | Animate, 13 | PathUtil, 14 | track() { 15 | }, 16 | setTheme(theme) { 17 | let themeObj = theme; 18 | if (typeof theme === 'string' && Themes[theme]) { 19 | themeObj = Themes[theme]; 20 | } 21 | 22 | G2.Global.setTheme(themeObj); 23 | }, 24 | }); 25 | 26 | exports.default = BizCharts; 27 | module.exports = BizCharts; 28 | -------------------------------------------------------------------------------- /plugin/slider/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 2.1.1 (09.25, 2018) 2 | - add slider error boundary. 3 | 4 | # 2.1.0 (09.17, 2018) 5 | - update g2 slider to 2.1.10 6 | - bizcharts version must bigger than bizcharts@3.2.3. 7 | 8 | # 2.0.7 (08.28, 2018) 9 | update g2 slider to 2.0.4 10 | fix #477 11 | 12 | //2.0.5, 2.0.6 npm do not have umd files. 13 | 14 | # 2.0.4 (07.31, 2018) 15 | update g2 slider to 2.0.3 16 | fix #386 17 | 18 | # 2.0.3 (04.10, 2018) 19 | fix issue-210 20 | 21 | # 2.0.1 (12.28, 2017) 22 | upgrade g2-plugin-slider version 2.0.1. 23 | 24 | # 2.0.0 (12.18, 2017) 25 | 修复包名,之前是 bizcharts-plugin-slier, 改为 bizcharts-plugin-slider 26 | 包入口之前有误,改为 bizcharts-plugin-slider.min.js 27 | 28 | # 1.0.0 (12.12, 2017) 29 | 1.0.0 版本发布。 30 | -------------------------------------------------------------------------------- /demo/component/index.js: -------------------------------------------------------------------------------- 1 | import Line from './line'; 2 | import Empty from './empty'; 3 | import Area from './area'; 4 | import Bar from './bar'; 5 | import Point from './point'; 6 | import Pie from './pie'; 7 | import Heatmap from './heatmap'; 8 | import Funnel from './funnel'; 9 | import Relation from './relation'; 10 | import Facet from './facet'; 11 | import Theme from './theme'; 12 | import Map from './map'; 13 | import Guage from './guage'; 14 | import Slider from './slider'; 15 | import Guide from './guide'; 16 | 17 | 18 | export default { 19 | lineChart: { 20 | Line, 21 | Bar, 22 | Area, 23 | Point, 24 | Pie, 25 | Heatmap, 26 | Funnel, 27 | Relation, 28 | Facet, 29 | Theme, 30 | Guage, 31 | Map, 32 | Slider, 33 | Guide 34 | }, 35 | }; 36 | -------------------------------------------------------------------------------- /testDemo/component/viewAD/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import ViewAD from './viewAD'; 3 | import GeomAD from './geomAD'; 4 | import GeomAD2 from './geomAD2'; 5 | import LabelAd from './labelAD'; 6 | import GuideAD from './guideAD'; 7 | import GuideAD2 from './guideAD2'; 8 | import AxisAd from './axisAD'; 9 | import CoordAd from './coordAD'; 10 | 11 | 12 | export default class ViewChart extends Component { 13 | render() { 14 | return ( 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | ); 28 | } 29 | } -------------------------------------------------------------------------------- /src/shared/prop.js: -------------------------------------------------------------------------------- 1 | /** 2 | * prop function 3 | */ 4 | 5 | import Util from './util'; 6 | 7 | export default { 8 | init(keys = {}, props, callback) { 9 | Util.each(keys, (key) => { 10 | let value = props[key]; 11 | if (value !== undefined) { 12 | if (!Util.isArray(value)) { 13 | value = [value]; 14 | } 15 | callback(value, key); 16 | } 17 | }); 18 | }, 19 | 20 | update(keys, props, nextProps, callback) { 21 | let value; 22 | let nextValue; 23 | Util.each(keys, (key) => { 24 | value = props[key]; 25 | nextValue = nextProps[key]; 26 | if (!Util.shallowEqual(nextValue, value)) { 27 | if (!Util.isArray(nextValue)) { 28 | nextValue = [nextValue]; 29 | } 30 | callback(nextValue, key); 31 | } 32 | }); 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint-config-ali/react", 3 | "parser": "babel-eslint", 4 | "root": true, 5 | "env": { 6 | "jest": true, 7 | "browser": true, 8 | "node": true, 9 | "es6": true 10 | }, 11 | "plugins": [ 12 | "react", 13 | "jsx-a11y" 14 | ], 15 | "parserOptions": { 16 | "ecmaVersion": 6, 17 | "sourceType": "module", 18 | "ecmaFeatures": { 19 | "jsx": true 20 | } 21 | }, 22 | "rules": { 23 | "strict": "off", 24 | "no-console": "off", 25 | "require-yield": "off", 26 | "import/no-dynamic-require": "off", 27 | "react/prefer-stateless-function": "off", 28 | "react/forbid-prop-types": "off", 29 | "class-methods-use-this": "off", 30 | "comma-dangle": "off", 31 | "react/require-default-props": "off", 32 | "import/no-extraneous-dependencies": "off" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /doc_en/tutorial/theme.md: -------------------------------------------------------------------------------- 1 | 2 | # Theme 3 | 4 | **Reference: [G2 Theme](https://antv.alipay.com/zh-cn/g2/3.x/tutorial/theme.html)** 5 | 6 | ## Chart Theme 7 | Bizcharts provides two built-in themes: `default` and `dark`. 8 | 9 | 10 | ## Change Theme 11 | 12 | You can change theme with the `BizCharts.setTheme(themeName)` API. 13 | 14 | Exmaple: 15 | 16 | ```jsx 17 | BizCharts.setTheme('dark'); 18 | ``` 19 | 20 | ## Customize Theme 21 | Also, by customizing the theme config and then call the `BizCharts.setTheme(themeConfig)` API. 22 | 23 | Example: 24 | ```jsx 25 | const seaTheme = { 26 | animate:false, 27 | colors:{}, 28 | shapes:{}, 29 | }; 30 | BizCharts.setTheme(seaTheme); 31 | ``` 32 | More detail about theme customization, reference [Theme API](/doc/api/theme.md) 33 | -------------------------------------------------------------------------------- /doc/tutorial/theme.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | # 主题 11 | 12 | **引用: [G2 Theme](https://antv.alipay.com/zh-cn/g2/3.x/tutorial/theme.html)** 13 | 14 | ## 图表主题 15 | Bizcharts 提供了两种内建的主题: `default` and `dark`. 16 | 17 | 18 | ## 如何改变主题 19 | 20 | 你可以通过 `BizCharts.setTheme(themeName)` API 来改变主题. 21 | 22 | Exmaple: 23 | 24 | ```jsx 25 | BizCharts.setTheme('dark'); 26 | ``` 27 | 28 | ## 自定义主题 29 | 当调用 `BizCharts.setTheme()` API 传入的参数是一个对象时,这个时候代表使用你自定义的主题配置。 30 | 31 | Example: 32 | ```jsx 33 | const seaTheme = { 34 | animate:false, 35 | colors:{}, 36 | shapes:{}, 37 | }; 38 | BizCharts.setTheme(seaTheme); 39 | ``` 40 | 41 | 更多的自定义配置项, 请参考 [Theme API](/doc/api/theme.md) 42 | -------------------------------------------------------------------------------- /src/components/Legend/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Legend Component 3 | */ 4 | import BaseComponent from '../Base'; 5 | import PropTypes from 'prop-types'; 6 | 7 | export default class Legend extends BaseComponent { 8 | static contextTypes = { 9 | addElement: PropTypes.func, 10 | updateElement: PropTypes.func, 11 | deleteElement: PropTypes.func, 12 | createId: PropTypes.func, 13 | getParentInfo: PropTypes.func, 14 | getViewId: PropTypes.func, 15 | } 16 | 17 | static childContextTypes = { 18 | addElement: PropTypes.func, 19 | updateElement: PropTypes.func, 20 | deleteElement: PropTypes.func, 21 | createId: PropTypes.func, 22 | getParentInfo: PropTypes.func, 23 | getViewId: PropTypes.func, 24 | } 25 | 26 | static defaultProps = { 27 | visible: true, 28 | } 29 | 30 | constructor(props) { 31 | super(props, 'Legend'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /demo/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var webpack = require('webpack'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | devtool: '#inline-source-map', 7 | entry: [ 8 | './index.js', 9 | ], 10 | output: { 11 | path: path.join(__dirname, 'build'), 12 | filename: 'bundle.js', 13 | }, 14 | plugins: [ 15 | new webpack.LoaderOptionsPlugin({ 16 | debug: true 17 | }) 18 | // new webpack.HotModuleReplacementPlugin(), 19 | // new webpack.NoErrorsPlugin() 20 | ], 21 | resolve: { 22 | extensions: ['.js', '.jsx'], 23 | alias: { 24 | 'bizcharts': path.join(__dirname, '..', 'src/index.jsx'), 25 | }, 26 | }, 27 | module: { 28 | loaders: [{ 29 | test: /\.(js|jsx)$/, 30 | loaders: ['babel-loader'], 31 | include: [ 32 | __dirname, 33 | path.join(__dirname, '..', 'src'), 34 | ], 35 | }], 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /plugin/slider/demo/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var webpack = require('webpack'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | devtool: '#inline-source-map', 7 | entry: [ 8 | './index.js', 9 | ], 10 | output: { 11 | path: path.join(__dirname, 'build'), 12 | filename: 'bundle.js', 13 | }, 14 | plugins: [ 15 | new webpack.LoaderOptionsPlugin({ 16 | debug: true 17 | }) 18 | // new webpack.HotModuleReplacementPlugin(), 19 | // new webpack.NoErrorsPlugin() 20 | ], 21 | resolve: { 22 | extensions: ['.js', '.jsx'], 23 | alias: { 24 | 'bizcharts-slider': path.join(__dirname, '..', 'src/index.jsx'), 25 | }, 26 | }, 27 | module: { 28 | loaders: [{ 29 | test: /\.(js|jsx)$/, 30 | loaders: ['babel-loader'], 31 | include: [ 32 | __dirname, 33 | path.join(__dirname, '..', 'src'), 34 | ], 35 | }], 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /doc/tutorial/interaction.md: -------------------------------------------------------------------------------- 1 | 2 | # 图表交互 3 | 4 | ## 默认交互 5 | 包括: 6 | - active 激活,鼠标hover。 7 | - select 选中,鼠标点击选择、框选。 8 | 9 | ## 激活 10 | 开启以及关闭 shape 对于鼠标 hover 时的响应效果,默认为各个 `` 内置了 active 效果 。可以通过 *active* 属性关闭及开启。 11 | 例如: 12 | ``` 13 | 14 | 15 | ``` 16 | 17 | ## 选中 18 | 各个几何标记 geom 选中的模式包含如下三种: 19 | 1. 不可选中; 20 | 2. 单选; 21 | 3. 多选; 22 | 4. 选中是否可取消选中。 23 | 24 | 选中模式的设置方式如下: 25 | 26 | ```jsx 27 | ; // 关闭 28 | ; // 打开 29 | ; 35 | ``` 36 | 37 | 默认情况下,G2 中只有饼图支持选中交互,其他 geom 的选中模式默认情况下都是关闭的。 38 | 39 | **图表交互控制可以跟[图表事件](../api/chart.md#event)结合用来定制图表的自定义交互,参见demo:[地图省市下钻](https://alibaba.github.io/BizCharts/demo-detail.html?code=demo/map/drill-down)** 40 | 41 | -------------------------------------------------------------------------------- /testDemo/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var webpack = require('webpack'); 3 | 4 | console.log(__dirname); 5 | 6 | module.exports = { 7 | context: __dirname, 8 | devtool: '#inline-source-map', 9 | entry: [ 10 | './index.js', 11 | ], 12 | output: { 13 | path: path.join(__dirname, 'build'), 14 | filename: 'bundle.js', 15 | }, 16 | plugins: [ 17 | new webpack.LoaderOptionsPlugin({ 18 | debug: true 19 | }) 20 | // new webpack.HotModuleReplacementPlugin(), 21 | // new webpack.NoErrorsPlugin() 22 | ], 23 | resolve: { 24 | extensions: ['.js', '.jsx'], 25 | alias: { 26 | 'bizcharts': path.join(__dirname, '..', 'src/index.jsx'), 27 | }, 28 | }, 29 | module: { 30 | loaders: [{ 31 | test: /\.(js|jsx)$/, 32 | loaders: ['babel-loader'], 33 | include: [ 34 | __dirname, 35 | path.join(__dirname, '..', 'src'), 36 | ], 37 | }], 38 | }, 39 | }; 40 | -------------------------------------------------------------------------------- /demo/component/heatmap/image.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | import data from '../../data/heatmap.json' 5 | 6 | 7 | const { DataView } = DataSet; 8 | const { Image } = Guide; 9 | 10 | export default class HeatmapC extends Component { 11 | 12 | render() { 13 | return ( 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/components/Guide/index.jsx: -------------------------------------------------------------------------------- 1 | /* 2 | Components: 3 | Guide 4 | Guide.Line 5 | Guide.Image 6 | Guide.Text 7 | Guide.Region 8 | Guide.Arc 9 | Guide.Html 10 | Guide.RegionFilter 11 | Guide.DataMarker 12 | Guide.DataRegion 13 | */ 14 | import Base from '../Base'; 15 | 16 | const Guide = Base.generateBaseTypedComponent('Guide'); 17 | 18 | 19 | Guide.Line = Base.generateBaseTypedComponent('GuideLine'); 20 | Guide.Image = Base.generateBaseTypedComponent('GuideImage'); 21 | Guide.Text = Base.generateBaseTypedComponent('GuideText'); 22 | Guide.Region = Base.generateBaseTypedComponent('GuideRegion'); 23 | Guide.Html = Base.generateBaseTypedComponent('GuideHtml'); 24 | Guide.Arc = Base.generateBaseTypedComponent('GuideArc'); 25 | Guide.RegionFilter = Base.generateBaseTypedComponent('GuideRegionFilter'); 26 | Guide.DataMarker = Base.generateBaseTypedComponent('GuideDataMarker'); 27 | Guide.DataRegion = Base.generateBaseTypedComponent('GuideDataRegion'); 28 | 29 | export default Guide; 30 | -------------------------------------------------------------------------------- /demo/component/bar/basic-column.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | 5 | 6 | const data = [ 7 | { year: '1951 年', sales: 38 }, 8 | { year: '1952 年', sales: 52 }, 9 | { year: '1956 年', sales: 61 }, 10 | { year: '1957 年', sales: 145 }, 11 | { year: '1958 年', sales: 48 }, 12 | { year: '1959 年', sales: 38 }, 13 | { year: '1960 年', sales: 38 }, 14 | { year: '1962 年', sales: 38 }, 15 | ]; 16 | const cols = { 17 | 'sales': {tickInterval: 20}, 18 | }; 19 | 20 | 21 | export default class IntervalC extends Component { 22 | render() { 23 | return ( 24 | 25 | 26 | 27 | 28 | 29 | 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /demo/component/area/basic.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Axis, Geom, Tooltip } from 'bizcharts'; 3 | 4 | 5 | const data = [ 6 | { year: "1991", value: 3 }, 7 | { year: "1992", value: 4 }, 8 | { year: "1993", value: 3.5 }, 9 | { year: "1994", value: 5 }, 10 | { year: "1995", value: 4.9 }, 11 | { year: "1996", value: 6 }, 12 | { year: "1997", value: 7 }, 13 | { year: "1998", value: 9 }, 14 | { year: "1999", value: 13 } 15 | ]; 16 | 17 | const scale = { 18 | 'value': { min: 0 }, 19 | 'year': {range: [ 0 , 1] } 20 | }; 21 | 22 | export default class Area extends Component { 23 | 24 | render() { 25 | return ( 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/components/Chart/empty.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Empty Component 3 | * 用 g2 创建 chart 一开始没有数据,有数据时对当前 chart 更新数据时,会有问题。 4 | * 因此用了 Empty 作为无数据 chart,PureChart 作为有数据的 chart。 5 | */ 6 | import React from 'react'; 7 | import PropTypes from 'prop-types'; 8 | import warning from 'warning'; 9 | 10 | warning(React.PureComponent, '`React.PureComponent` needs React >=15.3.0'); 11 | 12 | // react 15.3.0 以下不支持 PureComponent 就做一个兼容 13 | export default class Empty extends (React.PureComponent || React.Component) { 14 | static propTypes = { 15 | width: PropTypes.oneOfType([ 16 | PropTypes.string, 17 | PropTypes.number, 18 | ]), 19 | height: PropTypes.oneOfType([ 20 | PropTypes.string, 21 | PropTypes.number, 22 | ]), 23 | placeholder: PropTypes.node, 24 | } 25 | 26 | static defaultProps = { 27 | width: '100%', 28 | placeholder:
暂无数据
, 29 | } 30 | 31 | render() { 32 | const { width, height, placeholder } = this.props; 33 | 34 | return
{placeholder}
; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alibaba 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /demo/component/bar/basic.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | 5 | const data = [ 6 | { country: '中国', population: 131744 }, 7 | { country: '印度', population: 104970 }, 8 | { country: '美国', population: 29034 }, 9 | { country: '印尼', population: 23489 }, 10 | { country: '巴西', population: 18203 } 11 | ]; 12 | const ds = new DataSet(); 13 | const dv = ds.createView().source(data); 14 | dv.source(data) 15 | .transform({ 16 | type: 'sort', 17 | callback(a, b) { // 排序依据,和原生js的排序callback一致 18 | return a.population - b.population > 0; 19 | } 20 | }); 21 | 22 | 23 | export default class IntervalC extends Component { 24 | 25 | render() { 26 | return ( 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /demo/component/line/basic.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | 4 | 5 | const data = [ 6 | { year: "1991", value: 3 }, 7 | { year: "1992", value: 4 }, 8 | { year: "1993", value: 3.5 }, 9 | { year: "1994", value: 5 }, 10 | { year: "1995", value: 4.9 }, 11 | { year: "1996", value: 6 }, 12 | { year: "1997", value: 7 }, 13 | { year: "1998", value: 9 }, 14 | { year: "1999", value: 13 } 15 | ]; 16 | 17 | const scale = { 18 | 'value': { min: 0 }, 19 | 'year': {range: [ 0 , 1] } 20 | }; 21 | 22 | export default class BasicLineChart extends Component { 23 | 24 | render() { 25 | return ( 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demo/component/line/step.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | 5 | 6 | const data = [ 7 | { month: 'Jan', value: 51 }, 8 | { month: 'Feb', value: 91 }, 9 | { month: 'Mar', value: 34 }, 10 | { month: 'Apr', value: 47 }, 11 | { month: 'May', value: 63 }, 12 | { month: 'June', value: 58 }, 13 | { month: 'July', value: 56 }, 14 | { month: 'Aug', value: 77 }, 15 | { month: 'Sep', value: 99 }, 16 | { month: 'Oct', value: 106 }, 17 | { month: 'Nov', value: 88 }, 18 | { month: 'Dec', value: 56 } 19 | ]; 20 | const cols = { 21 | month: { 22 | range: [ 0, 1 ] 23 | } 24 | } 25 | 26 | export default class Step extends Component { 27 | render() { 28 | return ( 29 | 30 | 31 | 32 | 33 | 34 | 35 | ); 36 | } 37 | } -------------------------------------------------------------------------------- /demo/component/facet/list.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Facet, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | import data from '../../data/diamond.json'; 5 | 6 | const { DataView } = DataSet; 7 | const { Text } = Guide; 8 | 9 | const scale = { 10 | carat: { 11 | sync: true 12 | }, 13 | price: { 14 | sync: true, 15 | tickCount: 3 16 | }, 17 | cut: { 18 | sync: true 19 | } 20 | }; 21 | 22 | 23 | export default class List extends Component { 24 | 25 | render() { 26 | return ( 27 | 28 | 29 | 30 | { 31 | view.point() 32 | .position('carat*price') 33 | .color('cut') 34 | .shape('circle') 35 | .opacity(0.3) 36 | .size(3); 37 | }}> 38 | 39 | 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /demo/component/bar/histogramStack.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | import data from '../../data/diamond.json' 5 | 6 | const ds = new DataSet(); 7 | const dv = ds.createView().source(data); 8 | dv.transform({ 9 | type: 'bin.histogram', 10 | field: 'depth', 11 | binWidth: 1, 12 | // offset: -0.3, 13 | groupBy: [ 'cut' ], 14 | as: [ 'depth', 'count' ] 15 | }); 16 | 17 | export default class IntervalC extends Component { 18 | 19 | render() { 20 | return ( 21 | 22 | 29 | 30 | 31 | 32 | 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demo/component/pie/rose.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | 5 | 6 | const data = [ 7 | {year: '2001', population: 41.8 }, 8 | {year: '2002', population: 38 }, 9 | {year: '2003', population: 33.7 }, 10 | {year: '2004', population: 30.7 }, 11 | {year: '2005', population: 25.8 }, 12 | {year: '2006', population: 31.7 }, 13 | {year: '2007', population: 33 }, 14 | {year: '2008', population: 46 }, 15 | {year: '2009', population: 38.3 }, 16 | {year: '2010', population: 28 }, 17 | {year: '2011', population: 42.5 }, 18 | {year: '2012', population: 30.3 } 19 | ]; 20 | 21 | export default class PieC extends Component { 22 | 23 | render() { 24 | return ( 25 | 26 | 27 | 28 | 33 | 34 | 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /demo/component/point/jitter.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | import data from '../../data/dv-grades.json' 5 | 6 | 7 | export default class PointC extends Component { 8 | 9 | render() { 10 | return ( 11 | 12 | 13 | 14 | 28 | 29 | 30 | 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /demo/component/facet/listFunChild.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Chart, Geom, Facet, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; 3 | import DataSet from '@antv/data-set'; 4 | import data from '../../data/diamond.json'; 5 | 6 | const { DataView } = DataSet; 7 | const { Text } = Guide; 8 | 9 | const scale = { 10 | carat: { 11 | sync: true 12 | }, 13 | price: { 14 | sync: true, 15 | tickCount: 3 16 | }, 17 | cut: { 18 | sync: true 19 | } 20 | }; 21 | 22 | 23 | export default class List extends Component { 24 | 25 | render() { 26 | return ( 27 | 28 | 29 | 30 | 31 | 32 | 39 | 40 | 41 | 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /scripts/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | export RELEASE=1 3 | 4 | if ! [ -e scripts/release.sh ]; then 5 | echo >&2 "Please run scripts/release.sh from the repo root" 6 | exit 1 7 | fi 8 | 9 | update_version() { 10 | echo "$(node -p "p=require('./${1}');p.version='${2}';JSON.stringify(p,null,2)")" > $1 11 | echo "Updated ${1} version to ${2}" 12 | } 13 | 14 | validate_semver() { 15 | if ! [[ $1 =~ ^[0-9]\.[0-9]+\.[0-9](-.+)? ]]; then 16 | echo >&2 "Version $1 is not valid! It must be a valid semver string like 1.0.2 or 2.3.0-beta.1" 17 | exit 1 18 | fi 19 | } 20 | 21 | current_version=$(node -p "require('./package').version") 22 | 23 | printf "Next version (current is $current_version)? " 24 | read next_version 25 | 26 | validate_semver $next_version 27 | 28 | next_ref="v$next_version" 29 | 30 | npm test 31 | 32 | vim CHANGELOG.md 33 | 34 | update_version 'package.json' $next_version 35 | 36 | git commit -am "Version $next_version" 37 | 38 | # push first to make sure we're up-to-date 39 | git push origin master 40 | 41 | git tag $next_ref 42 | #git tag latest -f 43 | 44 | git push origin $next_ref 45 | #git push origin latest -f 46 | 47 | node scripts/build.js 48 | 49 | npm publish 50 | -------------------------------------------------------------------------------- /test/specs/component/View.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Enzyme, { mount } from 'enzyme'; 3 | import Adapter from 'enzyme-adapter-react-16'; 4 | import chai, { expect } from 'chai'; 5 | import chaiEnzyme from 'chai-enzyme'; 6 | // import sinon from 'sinon'; 7 | import { Chart, View } from 'bizcharts'; 8 | 9 | 10 | chai.use(chaiEnzyme()); // Note the invocation at the end 11 | Enzyme.configure({ adapter: new Adapter() }); 12 | let chartInstance = null; 13 | 14 | 15 | const Test = ({ viewProps }) => { 16 | return ( { chartInstance = chart; }}> 17 | 18 | 19 | 20 | ); 21 | }; 22 | 23 | describe('Context', () => { 24 | const wrapper2 = mount(); 25 | it('viewsHasCreate', () => { 26 | expect(chartInstance.get('views').length).is.eqls(3); 27 | }); 28 | it('updateData', () => { 29 | // console.log(chartInstance.get('views')[0]._attrs.data); 30 | wrapper2.setProps({ viewProps: { data: [{ a: 1 }] } }); 31 | wrapper2.update(); 32 | expect(chartInstance.get('views')[0]._attrs.data.length).is.eqls(1); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /src/components/View/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * View Component 3 | */ 4 | import BaseComponent from '../Base'; 5 | import PropTypes from 'prop-types'; 6 | 7 | export default class View extends BaseComponent { 8 | static contextTypes = { 9 | addElement: PropTypes.func, 10 | updateElement: PropTypes.func, 11 | deleteElement: PropTypes.func, 12 | createId: PropTypes.func, 13 | getParentInfo: PropTypes.func, 14 | getViewId: PropTypes.func, 15 | } 16 | 17 | static childContextTypes = { 18 | addElement: PropTypes.func, 19 | updateElement: PropTypes.func, 20 | deleteElement: PropTypes.func, 21 | createId: PropTypes.func, 22 | getParentInfo: PropTypes.func, 23 | getViewId: PropTypes.func, 24 | } 25 | 26 | constructor(props) { 27 | super(props, 'View'); 28 | } 29 | 30 | getChildContext() { 31 | return { 32 | addElement: this.context.addElement, 33 | updateElement: this.context.updateElement, 34 | deleteElement: this.context.deleteElement, 35 | createId: this.context.createId, 36 | getParentInfo: this.getParentInfo, 37 | getViewId: this.getViewId, 38 | }; 39 | } 40 | 41 | getViewId = () => { 42 | return this.id; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /plugin/slider/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint-config-airbnb", 3 | "parser": "babel-eslint", 4 | "globals": { 5 | "it": true, 6 | "describe": true, 7 | "require": true, 8 | "process": true, 9 | "before": true, 10 | "after" : true, 11 | "sinon": true, 12 | "expect" : true, 13 | "beforeEach": true, 14 | "afterEach": true 15 | }, 16 | "env":{ 17 | "es6": true, 18 | "node": true, 19 | "browser": true 20 | }, 21 | "parserOptions": { 22 | "sourceType": "module" 23 | }, 24 | "rules": { 25 | // 低版本 nodejs 需要在 strict 模式下支持 es6 语法 26 | "strict": "off", 27 | // 经常需要打印东西 28 | "no-console" : "off", 29 | // 不希望参数使用解构,低版本 nodejs 不支持 30 | "prefer-spread" : "off", 31 | // 会有很多地方需要直接使用 arguments 32 | "prefer-rest-params": "off", 33 | // 有动态引入的需求 34 | "import/no-dynamic-require": "off", 35 | // 有些函数对外需要暴露 generator 类型函数,但里面确实只有同步代码 36 | "require-yield": "off", 37 | // 一些正则表达式需要用到 38 | "no-useless-escape": "off", 39 | // 感觉这样写简洁一些 40 | "no-mixed-operators" : "warn", 41 | "no-lonely-if" : "off", 42 | "class-methods-use-this" : "off", 43 | "no-restricted-syntax" : "off", 44 | "no-param-reassign" : "off" 45 | } 46 | } -------------------------------------------------------------------------------- /src/components/Label/index.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Label Component 3 | */ 4 | import invariant from 'invariant'; 5 | import BaseComponent from '../Base'; 6 | import PropTypes from 'prop-types'; 7 | 8 | export default class Label extends BaseComponent { 9 | static contextTypes = { 10 | addElement: PropTypes.func, 11 | updateElement: PropTypes.func, 12 | deleteElement: PropTypes.func, 13 | createId: PropTypes.func, 14 | getParentInfo: PropTypes.func, 15 | getViewId: PropTypes.func, 16 | } 17 | 18 | static childContextTypes = { 19 | addElement: PropTypes.func, 20 | updateElement: PropTypes.func, 21 | deleteElement: PropTypes.func, 22 | createId: PropTypes.func, 23 | getParentInfo: PropTypes.func, 24 | getViewId: PropTypes.func, 25 | } 26 | 27 | constructor(props) { 28 | super(props, 'Label'); 29 | } 30 | 31 | componentWillMount() { 32 | const parentInfo = this.context.getParentInfo(); 33 | invariant(parentInfo.name === 'Geom', '`