bar.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import ChartTypes from './ChartTypes'
  2. import {
  3. PIVOT_DEFAULT_AXIS_LINE_COLOR,
  4. PIVOT_CHART_FONT_FAMILIES,
  5. PIVOT_DEFAULT_FONT_COLOR,
  6. CHART_LABEL_POSITIONS
  7. } from 'app/globalConstants'
  8. import { IChartInfo } from 'containers/Widget/components/Widget'
  9. import { EmptyStack } from 'app/containers/Widget/components/Config/Stack/constants'
  10. const bar: IChartInfo = {
  11. id: ChartTypes.Bar,
  12. name: 'bar',
  13. title: '柱状图',
  14. icon: 'icon-chart-bar',
  15. coordinate: 'cartesian',
  16. rules: [{ dimension: [0, 1], metric: [1, 9999] }],
  17. dimetionAxis: 'col',
  18. data: {
  19. cols: {
  20. title: '列',
  21. type: 'category'
  22. },
  23. rows: {
  24. title: '行',
  25. type: 'category'
  26. },
  27. metrics: {
  28. title: '指标',
  29. type: 'value'
  30. },
  31. filters: {
  32. title: '筛选',
  33. type: 'all'
  34. },
  35. color: {
  36. title: '颜色',
  37. type: 'category'
  38. },
  39. tip: {
  40. title: '提示信息',
  41. type: 'value'
  42. }
  43. },
  44. style: {
  45. spec: {},
  46. bar: {
  47. barChart: false,
  48. border: {
  49. color: '#000',
  50. width: 0,
  51. type: 'solid',
  52. radius: 0
  53. },
  54. gap: 30,
  55. width: null,
  56. stack: EmptyStack
  57. },
  58. label: {
  59. showLabel: false,
  60. labelPosition: CHART_LABEL_POSITIONS[0].value,
  61. labelFontFamily: PIVOT_CHART_FONT_FAMILIES[0].value,
  62. labelFontSize: '12',
  63. labelColor: PIVOT_DEFAULT_FONT_COLOR
  64. },
  65. xAxis: {
  66. showLine: true,
  67. lineStyle: 'solid',
  68. lineSize: '1',
  69. lineColor: PIVOT_DEFAULT_AXIS_LINE_COLOR,
  70. showLabel: true,
  71. labelFontFamily: PIVOT_CHART_FONT_FAMILIES[0].value,
  72. labelFontSize: '12',
  73. labelColor: PIVOT_DEFAULT_FONT_COLOR,
  74. xAxisInterval: 0,
  75. xAxisRotate: 0
  76. },
  77. yAxis: {
  78. showLine: true,
  79. lineStyle: 'solid',
  80. lineSize: '1',
  81. lineColor: PIVOT_DEFAULT_AXIS_LINE_COLOR,
  82. showLabel: true,
  83. labelFontFamily: PIVOT_CHART_FONT_FAMILIES[0].value,
  84. labelFontSize: '12',
  85. labelColor: PIVOT_DEFAULT_FONT_COLOR,
  86. showTitleAndUnit: true,
  87. titleFontFamily: PIVOT_CHART_FONT_FAMILIES[0].value,
  88. titleFontSize: '12',
  89. titleColor: PIVOT_DEFAULT_FONT_COLOR,
  90. nameLocation: 'middle',
  91. nameRotate: 90,
  92. nameGap: 40,
  93. min: null,
  94. max: null
  95. },
  96. splitLine: {
  97. showHorizontalLine: true,
  98. horizontalLineStyle: 'dashed',
  99. horizontalLineSize: '1',
  100. horizontalLineColor: PIVOT_DEFAULT_AXIS_LINE_COLOR,
  101. showVerticalLine: false,
  102. verticalLineStyle: 'dashed',
  103. verticalLineSize: '1',
  104. verticalLineColor: PIVOT_DEFAULT_AXIS_LINE_COLOR
  105. },
  106. legend: {
  107. showLegend: true,
  108. legendPosition: 'right',
  109. selectAll: true,
  110. fontFamily: PIVOT_CHART_FONT_FAMILIES[0].value,
  111. fontSize: '12',
  112. color: PIVOT_DEFAULT_FONT_COLOR
  113. }
  114. }
  115. }
  116. export default bar