WaterVolume.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. data: ["第一水厂", "第二水厂", "第三水厂", "第四水厂", "第五水厂"],
  41. inverse: true,
  42. axisLabel: {
  43. textStyle: {
  44. color: "#fff",
  45. fontSize: 14,
  46. },
  47. },
  48. axisLine: {
  49. lineStyle: {
  50. color: "#fff",
  51. },
  52. },
  53. },
  54. series: [
  55. {
  56. realtimeSort: true,
  57. name: "产水量",
  58. type: "bar",
  59. data: [100, 120, 30, 40, 50],
  60. label: {
  61. show: true,
  62. position: "right",
  63. valueAnimation: true,
  64. },
  65. },
  66. {
  67. realtimeSort: true,
  68. name: "供水量",
  69. type: "bar",
  70. data: [100, 120, 30, 40, 50],
  71. label: {
  72. show: true,
  73. position: "right",
  74. valueAnimation: true,
  75. },
  76. },
  77. ],
  78. legend: {
  79. show: true,
  80. textStyle: {
  81. color: "#fff",
  82. },
  83. },
  84. };
  85. }
  86. render() {
  87. return (
  88. <div
  89. style={{
  90. width: "5.375rem",
  91. height: "3rem",
  92. }}
  93. >
  94. <Chart option={this.getOptions()} />
  95. </div>
  96. );
  97. } //endrender
  98. }
  99. export default WaterVolume;