stackedBar.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * @Author: your name
  3. * @Date: 2024-11-19 16:25:10
  4. * @LastEditTime: 2024-11-25 09:46:37
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/assets/js/constants/echarts-config/stackedBar.js
  8. */
  9. // 风机状态堆叠柱状图
  10. // 用途:显示风机在不同状态(运行、停机、故障)下的时间分布。
  11. // 适用场景:风机运行监控。
  12. // 实现建议:
  13. // 使用堆叠柱状图。
  14. import { colorPalette } from "../color";
  15. export const option = {
  16. color: colorPalette,
  17. title: {
  18. text: "风机状态",
  19. },
  20. xAxis: {
  21. type: "category",
  22. data: ["风机1", "风机2", "风机3", "风机4"], // 风机编号
  23. },
  24. legend: {
  25. top: "bottom",
  26. },
  27. toolbox: {
  28. feature: {
  29. dataView: { show: true, readOnly: false },
  30. magicType: { show: true, type: ["line", "bar"] },
  31. restore: { show: true },
  32. saveAsImage: { show: true },
  33. },
  34. },
  35. yAxis: {
  36. name: "时间 (小时)",
  37. type: "value",
  38. },
  39. series: [
  40. {
  41. name: "运行",
  42. type: "bar",
  43. stack: "总量",
  44. data: [10, 15, 20, 25],
  45. },
  46. {
  47. name: "停机",
  48. type: "bar",
  49. stack: "总量",
  50. data: [5, 5, 4, 6],
  51. },
  52. {
  53. name: "故障",
  54. type: "bar",
  55. stack: "总量",
  56. data: [1, 0, 2, 3],
  57. },
  58. ],
  59. tooltip: {
  60. trigger: "axis",
  61. },
  62. };