WaterVolume.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // 当年水量统计
  2. import React, { PureComponent } from "react";
  3. import Chart from "../../utils/chart";
  4. class WaterVolume extends PureComponent {
  5. constructor(props) {
  6. super(props);
  7. this.state = {
  8. renderer: "canvas",
  9. };
  10. }
  11. getOptions() {
  12. return {
  13. color: ["#3C4FD6", "#F6AC4B"],
  14. grid: {
  15. top: 30,
  16. left: 80,
  17. right: 30,
  18. bottom: 30,
  19. },
  20. xAxis: {
  21. max: "dataMax",
  22. axisLine: {
  23. show: false, // 取消横轴轴线
  24. lineStyle: {
  25. color: "#fff",
  26. },
  27. },
  28. splitLine: {
  29. show: false, // 取消横轴刻度线
  30. },
  31. axisLabel: {
  32. textStyle: {
  33. color: "#fff",
  34. fontSize: 14,
  35. },
  36. },
  37. },
  38. yAxis: {
  39. type: "category",
  40. name: "(万m3)",
  41. data: ["第一水厂", "第二水厂", "第三水厂", "第四水厂", "第五水厂"],
  42. inverse: true,
  43. axisLabel: {
  44. textStyle: {
  45. color: "#fff",
  46. fontSize: 14,
  47. },
  48. },
  49. axisLine: {
  50. lineStyle: {
  51. color: "#fff",
  52. },
  53. },
  54. },
  55. series: [
  56. {
  57. realtimeSort: true,
  58. name: "产水量",
  59. type: "bar",
  60. data: [100, 120, 30, 40, 50],
  61. label: {
  62. show: true,
  63. position: "right",
  64. valueAnimation: true,
  65. },
  66. },
  67. {
  68. realtimeSort: true,
  69. name: "销水量",
  70. type: "bar",
  71. data: [100, 120, 30, 40, 50],
  72. label: {
  73. show: true,
  74. position: "right",
  75. valueAnimation: true,
  76. },
  77. },
  78. ],
  79. legend: {
  80. show: true,
  81. textStyle: {
  82. color: "#fff",
  83. },
  84. },
  85. };
  86. }
  87. render() {
  88. return (
  89. <div
  90. style={{
  91. width: "5.375rem",
  92. height: "3rem",
  93. }}
  94. >
  95. <Chart option={this.getOptions()} />
  96. </div>
  97. );
  98. } //endrender
  99. }
  100. export default WaterVolume;