动态菜单和动态路由的 antd pro

index.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import React from 'react';
  2. import { Chart, Tooltip, Geom } from 'bizcharts';
  3. import autoHeight from '../autoHeight';
  4. import styles from '../index.less';
  5. @autoHeight()
  6. export default class MiniBar extends React.Component {
  7. render() {
  8. const { height, forceFit = true, color = '#1890FF', data = [] } = this.props;
  9. const scale = {
  10. x: {
  11. type: 'cat',
  12. },
  13. y: {
  14. min: 0,
  15. },
  16. };
  17. const padding = [36, 5, 30, 5];
  18. const tooltip = [
  19. 'x*y',
  20. (x, y) => ({
  21. name: x,
  22. value: y,
  23. }),
  24. ];
  25. // for tooltip not to be hide
  26. const chartHeight = height + 54;
  27. return (
  28. <div className={styles.miniChart} style={{ height }}>
  29. <div className={styles.chartContent}>
  30. <Chart
  31. scale={scale}
  32. height={chartHeight}
  33. forceFit={forceFit}
  34. data={data}
  35. padding={padding}
  36. >
  37. <Tooltip showTitle={false} crosshairs={false} />
  38. <Geom type="interval" position="x*y" color={color} tooltip={tooltip} />
  39. </Chart>
  40. </div>
  41. </div>
  42. );
  43. }
  44. }