bar.md 505 Bytes
Newer Older
nikogu's avatar
nikogu committed
1 2 3 4 5
---
order: 4
title: 柱状图
---

nikogu's avatar
nikogu committed
6 7
通过设置 `x``y` 属性,可以快速的构建出一个漂亮的柱状图,各种纬度的关系则是通过自定义的数据展现。

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

const salesData = [];
for (let i = 0; i < 12; i += 1) {
  salesData.push({
    x: `${i + 1}月`,
    y: Math.floor(Math.random() * 1000) + 200,
  });
}

ReactDOM.render(
  <Bar
    height={200}
    title="销售额趋势"
    data={salesData}
  />
, mountNode);
````