├── bizCharts ├── en │ ├── index.md │ ├── quickStart.md │ └── overview.md └── zh │ ├── docs │ ├── data.md │ ├── interaction.md │ ├── theme.md │ ├── needload.md │ ├── start.md │ ├── animate.md │ ├── chart.md │ ├── dataflow.md │ ├── chartType.md │ ├── qa.md │ └── dataset.md │ └── api │ ├── view.md │ ├── connector.md │ ├── label.md │ ├── graphic.md │ ├── facet.md │ ├── bizcharts.md │ ├── coord.md │ ├── sliderPlugin.md │ ├── scale.md │ ├── shape.md │ ├── geom.md │ ├── axis.md │ ├── tooltip.md │ ├── chart.md │ ├── dataset.md │ ├── legend.md │ ├── theme.md │ └── guide.md ├── bizGoblin ├── en │ └── index.md └── zh │ ├── docs │ ├── qa.md │ ├── chart.md │ └── start.md │ └── api │ ├── coord.md │ ├── chart.md │ ├── tooltip.md │ ├── axis.md │ ├── geom.md │ ├── legend.md │ └── guide.md ├── README.md ├── .DS_Store └── LICENSE /bizCharts/en/index.md: -------------------------------------------------------------------------------- 1 | * 1 -------------------------------------------------------------------------------- /bizGoblin/en/index.md: -------------------------------------------------------------------------------- 1 | * 2 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bx-docs 2 | bx下各产品的文档管理仓库 3 | -------------------------------------------------------------------------------- /bizCharts/en/quickStart.md: -------------------------------------------------------------------------------- 1 | * en bizchartsquickStart -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tankpt/bx-docs/master/.DS_Store -------------------------------------------------------------------------------- /bizGoblin/zh/docs/qa.md: -------------------------------------------------------------------------------- 1 | # 常见问题 2 | 3 | ## 有问题怎么办 4 | 5 | - 建议将所有问题相关的教程、api文档及相关的 demo 都看一遍,如果还有问题,欢迎提 [issue](https://github.com/alibaba/BizGoblin/issues) 6 | - issue 中请务必提供可复现的链接,方便排查问题。链接可以在 Codepen 中 fork [Bizcharts codepen template](https://codepen.io/leslie2014/pen/xjJGER) 后生成。 7 | - 使用过程中如果遇到问题无法自行解决,可扫码加入钉钉群群求帮助 8 | 9 | -------------------------------------------------------------------------------- /bizCharts/zh/docs/data.md: -------------------------------------------------------------------------------- 1 | 2 | # 源数据的处理 3 | 4 | *文档转自G2* 5 | 6 | **BizCharts 支持两种格式的源数据** 7 | - JSON数组 8 | - DataView 对象 9 | 10 | ### JSON 数组 11 | Example: 12 | 13 | ```js 14 | var data = [ 15 | {"gender":"男","count":40}, 16 | {"gender":"女","count":30} 17 | ]; 18 | ``` 19 | 20 | ### DataView 对象 21 | * 单独使用 DataView 22 | * 如果仅仅是对数据进行加工,不需要图表联动 23 | 24 | * 通过状态量实现图表联动 25 | 在G2 3.0 中使用 DataSet 的状态量(State) 可以很容易的实现图表的联动,步骤如下: 26 | 1. 创建 DataSet 对象,指定状态量 27 | 2. 创建 DataView 对象,在 transform 中使用状态量 28 | 3. 创建图表,引用前面创建 DataView 29 | 4. 改变状态量,所有 DataView 更新 30 | 31 | 32 | 详见 [DataSet Package](./dataset)。 33 | -------------------------------------------------------------------------------- /bizGoblin/zh/docs/chart.md: -------------------------------------------------------------------------------- 1 | 2 | # 图表构成 3 | 4 | ## 组件构成 5 | 在 BizGoblin 中,图表是由各个组件组合而成的。 6 | 7 | 图表组件有: 8 | 9 | | 名称 | 说明 | 10 | | :--- | :-- | 11 | | [Chart](../api/chart.md) | 图表组件,所有的其他组件都必须由 `` 包裹。 | 12 | | [Coord](../api/coord.md) | 坐标系组件。用来描述 `` 组件的坐标系,比如笛卡尔坐标系、极坐标系等。 | 13 | | [Axis](../api/axis.md) | 坐标轴组件。通常包含两个坐标轴,在笛卡尔坐标系下,分别为 x 轴和 y 轴,在极坐标轴下,则分别由角度和半径 2 个维度构成。每个坐标轴由坐标轴线(line)、刻度线(tickLine)、刻度文本(label)以及网格线(grid)组成。| 14 | | [Geom](../api/geom.md) | 几何标记组件。即我们所说的点、线、面这些几何图形。| 15 | | [Legend](../api/legend.md) | 图例组件 | 16 | | [Tooltip](../api/tooltip.md) | 提示框组件。| 17 | | [Guide](../api/guide.md) | 辅助标记组件。| 18 | 19 | ## 控件构成 20 | 下图所示为常用图表的各组件的空间构成。 21 | 22 | ![](https://cdn.yuque.com/lark/0/2018/png/49761/1530017962762-1ef72d25-5f0e-4ed3-b96a-7db98175fec1.png) 23 | -------------------------------------------------------------------------------- /bizCharts/zh/docs/interaction.md: -------------------------------------------------------------------------------- 1 | 2 | # 图表交互 3 | 4 | ## 默认交互 5 | 包括: 6 | - active 激活,鼠标hover。 7 | - select 选中,鼠标点击选择、框选。 8 | 9 | ## 激活 10 | 开启以及关闭 shape 对于鼠标 hover 时的响应效果,默认为各个 `` 内置了 active 效果 。可以通过 *active* 属性关闭及开启。 11 | 例如: 12 | ```js 13 | 14 | 15 | ``` 16 | 17 | ## 选中 18 | 各个几何标记 geom 选中的模式包含如下三种: 19 | 1. 不可选中; 20 | 2. 单选; 21 | 3. 多选; 22 | 4. 选中是否可取消选中。 23 | 24 | 选中模式的设置方式如下: 25 | 26 | ```js 27 | ; // 关闭 28 | ; // 打开 29 | ; 35 | ``` 36 | 37 | 默认情况下,G2 中只有饼图支持选中交互,其他 geom 的选中模式默认情况下都是关闭的。 38 | 39 | **图表交互控制可以跟[图表事件](../api/chart#event)结合用来定制图表的自定义交互** 40 | 41 | -------------------------------------------------------------------------------- /bizCharts/zh/docs/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 | ```js 25 | BizCharts.setTheme('dark'); 26 | ``` 27 | 28 | ## 自定义主题 29 | 当调用 `BizCharts.setTheme()` API 传入的参数是一个对象时,这个时候代表使用你自定义的主题配置。 30 | 31 | Example: 32 | ```js 33 | const seaTheme = { 34 | animate:false, 35 | colors:{}, 36 | shapes:{}, 37 | }; 38 | BizCharts.setTheme(seaTheme); 39 | ``` 40 | 41 | 更多的自定义配置项, 请参考 [Theme API](../api/theme) 42 | -------------------------------------------------------------------------------- /bizCharts/en/overview.md: -------------------------------------------------------------------------------- 1 | ## bizChart 2 | * bizChart is a lightweight and robust JavaScript charting library with great API, documentation, and enterprise-grade support. 3 | 4 | * It's been developed since 2003 with one main idea - it should be easy for any developer to integrate beautiful charts into any mobile, desktop or web product. As a result, AnyChart today is a data visualization layer for thousands of great products. Our clients include both Fortune 500 companies and startups. 5 | 6 | * Our component works with any database and runs on any platform. The source code is open - you can download and edit it, it gives a great flexibility. Accessibility feature is a very important for us - we completely support Section 508 requirements. Thousands of out-of-the-box code samples in our playground, plugins and integrations, ready-to-use business solutions allow implementing industry-standard visualizations in minutes. -------------------------------------------------------------------------------- /bizGoblin/zh/api/coord.md: -------------------------------------------------------------------------------- 1 | 2 | # Coord 3 | 4 | 两种位置标度结合在一起组成的坐标轴配置,将Coord抽离为一个单独的组件,并且包含两种类型坐标系极坐标系和笛卡尔坐标系。 5 | 6 | ## 使用说明 7 | ### 父组件 8 | - [``](./chart.md) 9 | 10 | ### 子组件 11 | - none 12 | 13 | ### 注意事项 14 | 15 | - 默认采用笛卡尔坐标系,若要改变坐标系可以通过 `type` 属性改变。 16 | - 极坐标默认的起始角度和结束角度如下图所示: 17 | 18 | 19 | ## API 20 | 21 | #### `type` 22 | * 类型:String 23 | * 描述:坐标系类型,不同类型的坐标系所支持的配置属性也不一样。可设置的值为 `rect` , `polar‘` 。默认 `rect` 直角坐标系。 24 | 25 | #### `transposed` 26 | * 类型:Boolean 27 | * 描述:坐标系是否发生转置,`true` 表示发生了转置。默认 `false`。 28 | 29 | #### `radius` 30 | * 类型:Number 31 | * 描述:极坐标的前提下,设置圆的半径,相对值,0 至 1 范围。 32 | 33 | #### `innerRadius` 34 | * 类型:Number 35 | * 描述:极坐标的前提下, 绘制环图时,设置内部空心半径,相对值,0 至 1 范围。 36 | 37 | #### `startAngle` 38 | * 类型:Number 39 | * 描述:极坐标的起始角度,弧度制。 40 | 41 | #### `endAngle` 42 | * 类型:Number 43 | * 描述:极坐标的结束角度,弧度制。 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 alibaba-bizcharts 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. 22 | -------------------------------------------------------------------------------- /bizCharts/zh/api/view.md: -------------------------------------------------------------------------------- 1 | 2 | # View 3 | 4 | 视图,由 Chart 生成和管理,拥有自己独立的数据源、坐标系和图层,用于异构数据的可视化以及图表组合,一个 Chart 由一个或者多个视图 View 组成。因此 view 上的 api 同 chart 基本相同。 5 | 6 | ## 使用说明 7 | ### 父组件 8 | [``](chart) 9 | 10 | ### 子组件 11 | [``](coord) [``](axis) [``](geom) [``](legend) [``](tooltip) [``](guide) [``](facet) [``](view) 12 | 13 | **实际开发过程中,很多图表都可以采用View组件来实现,包含但不限于以下几个方面:** 14 | 15 | * 在同一个容器中出现两个或者更多不同坐标系的图表时,可以采用View组件来实现,如下图所示;[Demo](../demo/detail?id=pie-multi-level&selectedKey=饼图) 16 | ![image | center](https://img.alicdn.com/tfs/TB1GqOTa4rI8KJjy0FpXXb5hVXa-1600-856.png) 17 | 18 | * 同一个容器中的两个图表需要采用不同的数据源时,如下图所示:[Demo](../demo/detail?id=funnel-basic&selectedKey=漏斗图) 19 | ![image | center](https://img.alicdn.com/tfs/TB1w1flbhrI8KJjy0FpXXb5hVXa-1600-856.png) 20 | 21 | 22 | ```js 23 | // 这里只显示部分核心代码 24 | 25 | 26 | 31 | 32 | 33 | 38 | 39 | 40 | ``` 41 | **实际开发过程中,想要在一个图表中使用多个数据源可以用 view 实现。** 42 | [demo](https://bizcharts.net/products/bizCharts/demo/detail?id=g2-compare-donut&selectedKey=%E6%A6%82%E8%A7%88) 43 | 44 | ## API 45 | #### `start` 46 | * 类型:Object 47 | * 描述:绘制区域的起始坐标,x和y的取值范围均为0到1。 48 | 我们的起始点是从**左上角**开始的。 49 | 参见: 50 | 51 | ```js 52 | 53 | ``` 54 | 55 | #### `end` 56 | * 类型:Object 57 | * 描述:绘制区域的结束坐标,x和y的取值范围均为0到1。 58 | 59 | 参见: 60 | ```js 61 | 62 | ``` 63 | 64 | #### `data` 65 | * 类型:Array | DataSet 66 | * 描述:使用同 `Chart` 的 [data 属性](chart#data)。 67 | 68 | #### `animate` 69 | * 类型:boolean 70 | * 描述:视图是否执行动画。 71 | * 默认值:`true`。 72 | 73 | #### `scale` 74 | * 类型:Object 75 | * 描述:使用同 `Chart` 的 [scale 属性](chart#scale)。 76 | 77 | #### `filter` 78 | * 类型:Object 79 | * 描述:使用同 `Chart` 的 [filer 属性](chart#filter)。 80 | -------------------------------------------------------------------------------- /bizGoblin/zh/docs/start.md: -------------------------------------------------------------------------------- 1 | 2 | # BizGoblin 3 | 4 | BizGoblin 是一个基于F2封装的React图表库,具有F2、React的全部优点,可以让用户以组件的形式组合出无数种移动端图表。 5 | 6 | ## 特性 7 | - 基于 F2、React 8 | - 体积小巧 9 | - 高扩展能力 10 | - 绘制迅速 11 | 12 | ## 安装 13 | 14 | 需要使用版本 15 及以上的 React,来使用 BizGoblin 15 | 16 | ### 通过 npm 引入 17 | 18 | 我们提供了 BizGoblin npm 包,通过下面的命令即可完成安装 19 | 20 | ```bash 21 | npm install bizgoblin --save 22 | ``` 23 | 24 | 成功安装完成之后,即可使用 import 或 require 进行引用。 25 | 26 | ## 快速开始 27 | 28 | 在 BizGoblin 引入页面后,我们就已经做好了创建第一个图表的准备了。 29 | 30 | 下面是以一个基础的面积图为例开始我们的第一个图表创建。 31 | 32 | 1. 创建容器 33 | 34 | 在页面的 *body* 部分创建一个节点,指定一个 id 35 | 36 | ```html 37 |
38 | ``` 39 | 40 | 2. 使用组件生成图表 41 | 42 | - 引入图表需要的组件 43 | - 用组件组装成需要的图表 44 | - 把图表渲染到 mountNode 节点上 45 | 46 | ```jsx 47 | import React from 'react'; 48 | import ReactDOM from 'react-dom'; 49 | import { Chart, Axis, Geom, Tooltip } from 'bizgoblin'; 50 | 51 | // 数据源 52 | const data = [ 53 | { time: 'Jan.', tem: 1000}, 54 | { time: 'Feb.', tem: 2200}, 55 | { time: 'Mar.', tem: 2000}, 56 | { time: 'Apr.', tem: 2600}, 57 | { time: 'May.', tem: 2000}, 58 | { time: 'Jun.', tem: 2600}, 59 | { time: 'Jul.', tem: 2800}, 60 | { time: 'Aug.', tem: 2000} 61 | ]; 62 | 63 | // 度量配置 64 | const defs = [ 65 | { dataKey: 'time', range: [0, 1] }, 66 | { dataKey: 'tem', tickCount: 5, min: 0 } 67 | ]; 68 | 69 | // 渲染图表 70 | ReactDOM.render(( 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | ), document.getElementById('id')); 79 | 80 | ``` 81 | 82 | 一张柱状图就绘制成功了: 83 | 84 | ![](https://cdn.yuque.com/lark/0/2018/png/49761/1530019800146-e346143b-9fbb-415f-9eb8-be2718200281.png) 85 | 86 | ## 体验改进计划说明 87 | 为了更好服务用户,F2 会将打点监控,将 URL 等信息发送回 AntV 服务器,BizGoblin 没有关闭这个请求:```https://kcart.alipay.com/web/bi.do``` 88 | 89 | 除了 URL 与 F2 版本信息外,不会收集任何其他信息,一切为了能对 F2 的运行情况有更多了解,以更好服务于用户。如有担心,可以通过下面的代码关闭: 90 | 91 | ```js 92 | // 关闭 F2 的体验改进计划打点请求 93 | BizGoblin.track(false); 94 | ``` 95 | -------------------------------------------------------------------------------- /bizCharts/zh/docs/needload.md: -------------------------------------------------------------------------------- 1 | # 按需加载 2 | 3 | 自 bizcharts@3.1.8 版本起,开始支持按需加载资源文件的功能。 4 | 5 | ## 做法 6 | g2 中资源主要是分为 core 和 对应个 geom 资源,g2 用户需要声明使用了哪个 [geom](https://github.com/antvis/g2/issues/364)。 7 | - 在 bizcharts 中也类似,需要用户自己声明需要加载的资源模块,因此加入了各个类别的 geom 组件,具体有: 8 | 9 | | 组件 | 说明 | 10 | | :--| :--| 11 | | ```` | 相当于 ```` | 12 | | ```` | 相当于 ```` | 13 | | ```` | 相当于 ```` | 14 | | ```` | 相当于 ```` | 15 | | ```` | 相当于 ```` | 16 | | ```` | 相当于 ```` | 17 | | ```` | 相当于 ```` | 18 | | ```` | 相当于 ```` | 19 | | ```` | 相当于 ```` | 20 | | ```` | 相当于 ```` | 21 | 22 | 23 | ** 因此如果想要按需加载 bizcharts 资源,请使用命名后的 geom 组件,例如 `` `` 等,请勿使用之前的 组件,否则会全量加载 geom 资源。 ** 24 | 25 | - 需要使用原先 bizcharts 上的工具函数,请加载 ``import Chart from 'bizcharts/lib/core'`` 26 | 具体有: 27 | 28 | | 资源 | 说明 | 29 | | :--| :--| 30 | | G2 | G2 的命名空间,[详细请点击](//antv.alipay.com/zh-cn/g2/3.x/api/index.html). | 31 | | Animate | 动画 [详细请点击](../api/bizcharts#animate). | 32 | | Shape | 构成图表的图形,用户自定义图形,[详细请点击](../api/bizcharts#setTheme) | 33 | | setTheme | 用于设置图表的主题,[详细请点击](../api/bizcharts#setTheme). | 34 | | track | 使用打点,[详细请点击](../api/bizcharts#track) | 35 | | PathUtil | [详细请点击](../api/bizcharts#PathUtil) | 36 | | Util | [详细请点击](../api/bizcharts#Util) | 37 | 38 | 39 | ## 示例代码 40 | 直接加载需要的组件和模块使用即可。 41 | 42 | ```js 43 | import * as bizUtil from 'bizcharts/lib/core' 44 | import Chart from 'bizcharts/lib/components/Chart'; 45 | import Axis from 'bizcharts/lib/components/Axis'; 46 | import Line from 'bizcharts/lib/components/TypedGeom/Line'; 47 | 48 | bizUtil.setTheme('dark'); 49 | 50 | ReactDOM.render( 51 | 66 | 67 | 68 | 69 | , 70 | mountNode 71 | ); 72 | ``` 73 | -------------------------------------------------------------------------------- /bizCharts/zh/docs/start.md: -------------------------------------------------------------------------------- 1 | 2 | # BizCharts 3 | 4 | ## 特性 5 | - 是基于 G2 封装的 React 图表库,具有 G2、React 的全部优点,可以让用户以组件的形式组合出无数种图表 6 | - 集成了大量的统计工具,支持多种坐标系绘制,交互定制,动画定制以及图形定制等 7 | - 性能稳定且具有强大的扩展能力和高度自定义能力 8 | 9 | ## 如何获取 BizCharts 10 | 11 | 你可以通过以下几种方式获取 BizCharts: 12 | 1. 从官网下载界面选择你需要的版本下载,建议使用 3.1.10 版本 13 | 2. 在 BizCharts 的 GitHub 上下载最新的 release 版本 14 | 3. 通过 npm 获取 BizCharts,我们提供了 BizCharts npm 包,通过下面的命令即可完成安装 15 | 16 | ```bash 17 | npm install bizcharts --save 18 | ``` 19 | 20 | 成功安装完成之后,即可使用 import 或 require 进行引用。 21 | 22 | ## 绘制一个简单的图表 23 | 24 | 在 BizCharts 引入页面后,我们就已经做好了创建第一个图表的准备了。 25 | 26 | 下面是以一个基础的柱状图为例开始我们的第一个图表创建。 27 | 28 | 1. 创建容器 29 | 30 | 在页面的 *body* 部分创建一个节点,指定一个 id 31 | 32 | ```html 33 |
34 | ``` 35 | 36 | 2. 使用组件生成图表 37 | 38 | - 引入图表需要的组件 39 | - 用组件组装成需要的图表 40 | - 把图表渲染到 mountNode 节点上 41 | 42 | ```js 43 | import React from 'react'; 44 | import ReactDOM from 'react-dom'; 45 | import { Chart, Geom, Axis, Tooltip, Legend, Coord } from 'bizcharts'; 46 | 47 | // 数据源 48 | const data = [ 49 | { genre: 'Sports', sold: 275, income: 2300 }, 50 | { genre: 'Strategy', sold: 115, income: 667 }, 51 | { genre: 'Action', sold: 120, income: 982 }, 52 | { genre: 'Shooter', sold: 350, income: 5271 }, 53 | { genre: 'Other', sold: 150, income: 3710 } 54 | ]; 55 | 56 | // 定义度量 57 | const cols = { 58 | sold: { alias: '销售量' }, 59 | genre: { alias: '游戏种类' } 60 | }; 61 | 62 | // 渲染图表 63 | ReactDOM.render(( 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | ), document.getElementById('mountNode')); 72 | 73 | ``` 74 | 75 | 一张柱状图就绘制成功了: 76 | 77 | ![](https://img.alicdn.com/tps/TB1PVaoPFXXXXcSaXXXXXXXXXXX-519-401.png) 78 | 79 | ## Dependencies 80 | 81 | ```json 82 | { 83 | "peerDependencies": { 84 | "react": "^15.0.0 || ^16.0.0" 85 | }, 86 | "dependencies": { 87 | "@antv/g2": "3.2.2", 88 | "invariant": "^2.2.2", 89 | "warning": "^3.0.0", 90 | "prop-types": "^15.6.0", 91 | }, 92 | } 93 | ``` 94 | 95 | ## Browser Support Versions 96 | 支持Chrome,Safari,IE11+ 浏览器 97 | 98 | 99 | 100 | ## 体验改进计划说明 101 | G2 decided to terminate the "Experience Improvement Program". In verson @antv/g2@3.4.7(released at 2018.12.26) and above, all tracking code is removed, no unexpected remote request will be sent while you are using G2. And Bizcharts Upgrade the dependent version the first time at 2018.12.26 24:00. 102 | -------------------------------------------------------------------------------- /bizGoblin/zh/api/chart.md: -------------------------------------------------------------------------------- 1 | 2 | # Chart 3 | 4 | 图表组件,内部生产了一个F2 chart 实例,同时控制着其他子组件的加载和更新。 5 | 6 | ## 子组件 7 | 8 | - [``](coord.md) 坐标系组件 9 | - [``](axis.md) 坐标轴组件 10 | - [``](geom.md) 几何标记组件 11 | - [``](legend.md) 图例组件 12 | - [``](tooltip.md) 提示框组件 13 | - [``](guide.md) 辅助标记组件 14 | 15 | ```js 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ``` 24 | 25 | ## API 26 | 27 | #### `width` 28 | * 类型: Number | string(必填) 29 | * 描述:指定图表的宽度,传入参数为Number类型,单位为 `px` 。支持自适应单位百分比和rem,例如 `100%` 和 `10rem` 。 30 | 31 | #### `height` 32 | * 类型:Number | string 33 | * 描述:指定图表的高度,传入参数为Number类型,单位为 `px` 。支持自适应单位百分比和rem,例如 `100%` 和 `10rem` 。 34 | 35 | > 传入参数为string类型,为百分比字符串时,取父元素的相对值;为'rem'结束的字符串时,取HTML根元素的相对值 36 | 37 | #### `data` 38 | * 类型:Array 39 | * 描述:设置图表的数据源,`data` 是一个包含 JSON 对象的数组。 40 | 41 | #### `defs` 42 | * 类型: Object | Array 43 | * 描述:各个字段的度量配置,`defs` 是一个 JSON 对象或者包含 JSON 对象的数据。JSON 对象的 `dataKey` 代表对应列字段,必填。 44 | 45 | 图表数据的列定义用于对数据字段进行定义,如数据的类型,显示别名,数值的格式化等,不同的数字类型的配置项不同,支持的数据类型有: 46 | 47 | - `linear`: 数字类型 48 | - `cat`: 分类类型 49 | - `timeCat`: 时间类型 50 | 51 | ```js 52 | const defs = [ 53 | { 54 | dataKey: 'value', // 数据列字段,必填 55 | type: 'linear' | 'cat' | 'timeCat', // 指定数据类型, 默认linear 56 | formatter: () => {}, // 格式化文本内容 57 | range: array, // 输出数据的范围,默认[0, 1],格式为 [min, max],min 和 max 均为 0 至 1 范围的数据 58 | alias: string, // 数据字段的显示别名 59 | tickCount: number, // 设置坐标轴上刻度点的个数 60 | ticks: array // 用于指定坐标轴上刻度点的文本信息,当用户设置了 ticks 就会按照 ticks 的个数和文本来显示 61 | } 62 | ] 63 | ``` 64 | 65 | > 不同的type具有各自对应的可配置属性,详见[Scale度量](https://antv.alipay.com/zh-cn/f2/3.x/api/scale.html) 66 | 67 | #### `padding` 68 | * 类型:Object | Number | Array 69 | * 描述:图表内边距。 70 | 有如下配置格式。 71 | ```js 72 | //有时候坐标轴、图例等绘图区域外的组件显示不全时,可以通过调整图表各个方向的 padding 来调整最终效果 73 | 74 | 75 | 76 | 77 | 78 | 79 | ``` 80 | - padding 为数字以及数组类型时使用方法同 CSS 盒模型。 81 | - padding 中存在 'auto',时会自动计算边框,目前仅考虑 axis 和 legend 占用的边框。 82 | 83 | - 另外也支持设置百分比,如 padding: [ '20%', '30%' ],该百分比相对于整个图表的宽高。 84 | - padding 为数字以及数组类型时使用方法同 CSS 盒模型。 85 | - padding 中存在 'auto',时会自动计算边框,目前仅考虑 axis 和 legend 占用的边框。 86 | 87 | #### `pixelRatio` 88 | * 类型:Number 89 | * 描述:屏幕画布的像素比,默认值1, 一般情况下这个值可以设置成 `window.devicePixelRatio` 。 90 | -------------------------------------------------------------------------------- /bizCharts/zh/api/connector.md: -------------------------------------------------------------------------------- 1 | # Connector 数据接入 2 | 3 | 一个数据视图(DataSet.View)实例在接入数据时就会用到 Connector,其语法如下: 4 | 5 | ```js 6 | dv.source(data, { 7 | type: connectorName, 8 | ...otherOptions 9 | }); 10 | ``` 11 | 12 | 举个例子: 13 | 14 | ```js 15 | const testCSV = `Expt,Run,Speed 16 | 1,1,850 17 | 1,2,740 18 | 1,3,900 19 | 1,4,1070`; 20 | 21 | const dv = new DataSet.View().source(testCSV, { 22 | type: 'csv' 23 | }); 24 | 25 | console.log(dv.rows); 26 | /* 27 | * dv.rows: 28 | * [ 29 | * {Expt: " 1", Run: "1", Speed: "850"} 30 | * {Expt: " 1", Run: "2", Speed: "740"} 31 | * {Expt: " 1", Run: "3", Speed: "900"} 32 | * {Expt: " 1", Run: "4", Speed: "1070"} 33 | * ] 34 | */ 35 | ``` 36 | 37 | 上述代码中,数据视图实例 `dv` 使用 `csv` 类型的 Connector 载入了一段 CSV 文本。 38 | 39 | 目前 DataSet 支持以下几种常用的 Connector: 40 | 41 | ## default 默认 42 | 43 | 直接调用 `dv.source(data)`,不通过配置项指定使用的 Connector 时,则有以下两种默认的情形: 44 | 45 | 第一种,data 传入的是具体数组数据,那么 46 | 47 | ```js 48 | dv.rows = deepClone(data); 49 | ``` 50 | 51 | 第二种,data 传入的是另一个 DataView 的实例或者实例的名称,那么 52 | 53 | ```js 54 | dv.rows = deepClone(ds.getView(otherDv).rows); 55 | ``` 56 | 57 | ## dsv 58 | 59 | 具体用法见示例: 60 | 61 | ```js 62 | dv.source(dsvStr, { 63 | type: 'dsv', // 指定使用dsv connector 64 | delimiter: '|' // 指定分隔符 65 | }) 66 | ``` 67 | 68 | ## csv 69 | 70 | 具体用法见示例: 71 | 72 | ```js 73 | dv.source(csvStr, { 74 | type: 'csv', // 指定使用dsv connector 75 | delimiter: ',' // 指定分隔符 76 | }) 77 | ``` 78 | 79 | ## tsv 80 | 81 | 具体用法见示例: 82 | 83 | ```js 84 | dv.source(tsvStr, { 85 | type: 'tsv' // 指定使用tsv connector 86 | }) 87 | ``` 88 | 89 | ## GeoJSON 90 | 91 | 具体用法见示例: 92 | 93 | ```js 94 | dv.source(geojsonData, { 95 | type: 'GeoJSON', // 别名 geo / geojson 96 | }) 97 | ``` 98 | 99 | > dv.dataType 会被更改为 'geo',从而 dv 可以执行一些 Geo 相关的实例方法。 100 | 101 | ## TopoJSON 102 | 103 | 具体用法见示例: 104 | 105 | ```js 106 | dv.source(topojsonData, { 107 | type: 'TopoJSON', // 别名 topojson 108 | object: 'xxx' // TopoJSON 相当于多个 GeoJSON 合并起来做了压缩,其中每一个 object 都相当于一份 GeoJSON 数据,指定 object 就是从中提取一份 Geo 数据 109 | }) 110 | ``` 111 | 112 | > dv.dataType 会被更改为 'geo',从而 dv 可以执行一些 Geo 相关的实例方法。 113 | 114 | ## hierarchy 115 | 116 | 具体用法见示例: 117 | 118 | ```js 119 | dv.source(tree, { 120 | type: 'hierarchy', // 别名 tree 121 | children: d => d.children // 可选,函数,返回子树 122 | }) 123 | ``` 124 | 125 | > dv.dataType 会被变更为 'hierarchy' ,从而 dv 可以执行一些树形结构相关的实例方法和 Transform。 126 | 127 | > dv.root 为根节点 128 | 129 | ## graph 130 | 131 | 具体用法见示例: 132 | 133 | ```js 134 | dv.source(graph, { 135 | type: 'graph', 136 | nodes: d => d.nodes, // 节点集对应字段 137 | edges: d => d.edges // 边集对应字段 138 | }) 139 | ``` 140 | 141 | > dv.dataType 会被变更为 'graph',从而 dv 可以执行图相关的实例方法和 Transform。 142 | -------------------------------------------------------------------------------- /bizCharts/zh/api/label.md: -------------------------------------------------------------------------------- 1 | 2 | # Label 3 | 4 | [``](geom) 几何标记上的标注文本组件。 5 | 6 | ## 父组件 7 | [``](geom) 8 | 9 | ## 子组件 10 | 无 11 | 12 | ## API 13 | #### `content` 14 | * 类型:String | Array:[String, Function] 15 | * 描述:指定 label 上显示的文本内容,可以是数据纬度,也可以自定义。 16 | 17 | 使用示例: 18 | ```js 19 |