Needlessly Promiscuous, Modularize!

    @antv/s2-react
    TypeScript icon, indicating that this package has built-in type declarations

    1.32.0 • Public • Published

    @antv/s2-react

    数据驱动的多维分析表格 (React 版本)。

    npm Version Version ci test status

    📦 安装

    $ npm install @antv/s2-react
    # yarn add @antv/s2-react

    🔨 使用

    1. 数据准备

    s2DataConfig
    const s2DataConfig = {
      fields: {
        rows: ['province', 'city'],
        columns: ['type'],
        values: ['price'],
      },
      data: [
         {
          province: '浙江',
          city: '杭州',
          type: '笔',
          price: '1',
        },
        {
          province: '浙江',
          city: '杭州',
          type: '纸张',
          price: '2',
        },
        {
          province: '浙江',
          city: '舟山',
          type: '笔',
          price: '17',
        },
        {
          province: '浙江',
          city: '舟山',
          type: '纸张',
          price: '0.5',
        },
        {
          province: '吉林',
          city: '长春',
          type: '笔',
          price: '8',
        },
        {
          province: '吉林',
          city: '白山',
          type: '笔',
          price: '9',
        },
        {
          province: '吉林',
          city: '长春',
          type: ' 纸张',
          price: '3',
        },
        {
          province: '吉林',
          city: '白山',
          type: '纸张',
          price: '1',
        },
      ],
    };

    2. 配置项准备

    s2Options
    const s2Options = {
      width: 600,
      height: 480,
    }

    3. 渲染

    <div id="container"></div>
    import { SheetComponent } from '@antv/s2-react';
    import '@antv/s2-react/dist/style.min.css';
    
    const container = document.getElementById('container');
    
    ReactDOM.render(
      <SheetComponent
        dataCfg={s2DataConfig}
        options={s2Options}
      />,
      document.getElementById('container'),
    );

    4. 结果

    result

    Install

    npm i @antv/s2-react

    DownloadsWeekly Downloads

    658

    Version

    1.32.0

    License

    MIT

    Unpacked Size

    4.14 MB

    Total Files

    12

    Last publish

    Collaborators

    • biupiubiupiu
    • flash1
    • dreammy23
    • laixingui.lxg
    • zhangjunjie-loki
    • rainy25ghz
    • zeyuwang
    • yanxiong
    • susiwen8
    • freestyle21
    • soundquiet
    • elaine.q.10
    • sturuby
    • lviser
    • sakuya223
    • serializedowen
    • xdzhao
    • yangzhanmei
    • wjgogogo
    • leungwensen
    • dori
    • iaaron
    • yard
    • simaq
    • dxq613
    • intchous
    • susan_ann
    • jinke.li
    • lzxue
    • army8735
    • atool
    • baizn
    • dengfuping
    • neoddish
    • jeffy2012
    • zqlu
    • afc163
    • pomelo-nwu
    • kopiluwaky
    • ccnuzindex
    • panyuqi
    • bubkoo
    • zengyue
    • kasmine
    • boyu.zlj
    • l1ud0ngq1
    • newbyvector
    • winniexing
    • chenluli
    • kn9117
    • xdddst
    • semious2020
    • esora
    • nadia_liu
    • bbsqq
    • mxz96102
    • openwayne
    • pearmini
    • pddpd
    • yiqianyao
    • zhanba
    • cxxxxxn