bizchart3.x气泡图

bizcharts气泡图参考 https://bizcharts.alibaba-inc.com/product/bizcharts/demo/174

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { Chart, Geom, Axis, Tooltip, Legend } from 'bizcharts';
  4. const scale = {
  5. name: {
  6. alias: '技术分布',
  7. type: 'cat',
  8. values: ['UI','PD', 'PR', 'SQL', 'API'],
  9. tickCount: 5,
  10. },
  11. label: {
  12. alias: '技术分布',
  13. },
  14. value: {
  15. alias: '技能等级',
  16. },
  17. };
  18. BubbleChart.propTypes = {
  19. dataSource: PropTypes.array.isRequired,
  20. height: PropTypes.number
  21. };
  22. function BubbleChart(props) {
  23. const {dataSource, height = 360} = props
  24. return (
  25. <Chart
  26. forceFit
  27. height={height}
  28. data={dataSource}
  29. scale={scale}
  30. >
  31. <Tooltip showTitle={false} />
  32. <Axis title name="name" />
  33. <Axis title name="label" />
  34. <Legend />
  35. <Geom
  36. type="point"
  37. position="label*name"
  38. color='label'
  39. tooltip="name*value*label"
  40. opacity={0.5}
  41. shape="circle"
  42. size={['value', [2, 16]]}
  43. style={[
  44. 'name',
  45. {
  46. lineWidth: 1,
  47. strokeOpacity: 1,
  48. fillOpacity: 0.3,
  49. opacity: 0.65,
  50. },
  51. ]}
  52. />
  53. </Chart>
  54. );
  55. }
  56. export default React.memo(BubbleChart);