VarietyChart
基于 rechart 封装了包括 LineChart、AreaChart、BarChart、ComposedChart 的图表,y 轴值的长度会自适应。当前的 LineChart、AreaChart、BarChart、ComposedChart 组件都是基于 VarietyChart 组件。
详细的案例请看对应的图表。
| 参数 | 类型 | 默认值 |
|---|---|---|
| type? | 'line' | 'area' | 'bar' | 'composed' | 'pie' | - |
图表的类型,分别对应 | ||
| data? | ChartData | - |
数据源。 | ||
| useResponsiveContainer? | boolean | true |
是否使用响应式,开启的话浏览器窗口大小改变会响应式适应 | ||
| xAxisFormat? | string | - |
x轴 value 方式,内部做了处理,具体请看 getFormatValue。 | ||
| yAxisFormat? | string | - |
y轴 value 方式,内部做了处理,具体请看 getFormatValue。 | ||
| xAxisFormatter? | Formatter | - |
x轴 value 格式化函数。 | ||
| yAxisFormatter? | Formatter | - |
y轴 value 格式化函数。 | ||
| width? | number | - |
图表宽度,配合 recharts ResponsiveContainer 组件使用不需要设置。 | ||
| height? | number | 300 |
图表高度,配合 recharts ResponsiveContainer 组件使用不需要设置。 | ||
| layout? | 'horizontal' | 'vertical' | 'horizontal' |
图表布局方式,水平或者垂直。 | ||
| brush? | boolean | false |
图表是否可以横向缩放。 | ||
| stackOffset? | literal | - |