Chart 图表

安装

@ams-team/block-chart 0.1.3

依赖开源 echarts

  1. npm i --save echarts
  2. npm i --save @ams-team/block-chart

CDN

  1. <script src="https://cdn.jsdelivr.net/npm/echarts@4.1.0/dist/echarts.min.js"></script>
  2. <script src="http://h5rsc.vipstatic.com/ams/block/block-chart@0.1.3.js"></script>

结构

  1. export interface Data { [field: string]: any }
  2. export interface ChartBlock {
  3. type: 'chart',
  4. resource: string,
  5. style?: Data,
  6. data?: Data,
  7. options: Data,
  8. events?: Data,
  9. actions?: { [field: string]: () => any },
  10. render?: boolean | string
  11. }

折线图表

  1. Not found: /Users/jun85.li/Documents/host/vipshop/ams/docs/doc/.vuepress/components/block/chart-line/block.js

柱状图表

  1. Not found: /Users/jun85.li/Documents/host/vipshop/ams/docs/doc/.vuepress/components/block/chart-bar/block.js

饼状图表

  1. Not found: /Users/jun85.li/Documents/host/vipshop/ams/docs/doc/.vuepress/components/block/chart-pie/block.js

漏斗图表

  1. Not found: /Users/jun85.li/Documents/host/vipshop/ams/docs/doc/.vuepress/components/block/chart-funnel/block.js

散点图表

  1. Not found: /Users/jun85.li/Documents/host/vipshop/ams/docs/doc/.vuepress/components/block/chart-scatter/block.js

雷达图表

  1. Not found: /Users/jun85.li/Documents/host/vipshop/ams/docs/doc/.vuepress/components/block/chart-radar/block.js

配置

options配置

参数类型是否必填说明
typestringblock类型,固定值为chart
optionsobject图表配置,详见 options
resourcestring指定resource
styleobjectblock添加样式
dataobjectblock数据,详见 data
eventsobject事件定义
actionsobject自定义actions,可被events中使用
renderbooleanstring指定渲染方式