mini-bar.md 614 Bytes
Newer Older
nikogu's avatar
nikogu committed
1 2
---
order: 2
nikogu's avatar
nikogu committed
3
col: 2
nikogu's avatar
nikogu committed
4 5 6
title: 迷你柱状图
---

nikogu's avatar
nikogu committed
7 8
迷你柱状图更适合展示简单的区间数据,简洁的表现方式可以很好的减少大数据量的视觉展现压力。

nikogu's avatar
nikogu committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
````jsx
import { MiniBar } from 'ant-design-pro/lib/Charts';
import moment from 'moment';

const visitData = [];
const beginDay = new Date().getTime();
for (let i = 0; i < 20; i += 1) {
  visitData.push({
    x: moment(new Date(beginDay + (1000 * 60 * 60 * 24 * i))).format('YYYY-MM-DD'),
    y: Math.floor(Math.random() * 100) + 10,
  });
}

ReactDOM.render(
  <MiniBar
    height={45}
    data={visitData}
  />
, mountNode);
````