_Chart_SG.cshtml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. @using WeApp.Helpers
  2. <div class="area" id="chart-sg"></div>
  3. @using (Html.BeginScripts())
  4. {
  5. <script>
  6. //四功
  7. var siGongChart = echarts.init(document.getElementById('chart-sg'));
  8. function SiGongChart(data, category) {
  9. if (data && data.length > 0) {
  10. //console.log("SiGong", data);
  11. } else {
  12. console.log("SiGong-Null");
  13. return;
  14. }
  15. var series = [];
  16. for (var i = 0; i < data.length; i++) {
  17. var item = data[i];
  18. series.push({
  19. name: item.name,
  20. type: "bar",
  21. data: item.data,
  22. barMinWidth: 15,
  23. barMaxWidth: 30,
  24. barMinHeight: 20,
  25. itemStyle: {
  26. color: {
  27. type: 'linear',
  28. x: 0,
  29. y: 0,
  30. x2: 0,
  31. y2: 1,
  32. colorStops: [
  33. {
  34. offset: 0,
  35. color: roundColor[i % 3] // 0% 处的颜色
  36. }, {
  37. offset: 1,
  38. color: '#27303f' // 100% 处的颜色
  39. }
  40. ]
  41. },
  42. barBorderRadius: [0, 50, 50, 0]
  43. }
  44. });
  45. }
  46. window.titleOpt.text = "四功评析示意图";
  47. var option = {
  48. grid: {
  49. top: 30,
  50. bottom: 20,
  51. left: 80,
  52. right: 30
  53. },
  54. legend: {
  55. right: 20,
  56. textStyle: {
  57. color: textColor[1]
  58. },
  59. icon: 'circle'
  60. },
  61. title: window.titleOpt,
  62. yAxis: {
  63. type: 'category',
  64. data: category,
  65. axisLabel: {
  66. color: textColor[1]
  67. },
  68. axisLine: {
  69. show: true,
  70. lineStyle: {
  71. color: textColor[0]
  72. }
  73. }
  74. },
  75. xAxis: {
  76. type: 'value',
  77. splitNumber: 6,
  78. axisLabel: {
  79. color: textColor[1]
  80. },
  81. axisLine: {
  82. show: false,
  83. lineStyle: {
  84. color: textColor[0]
  85. }
  86. },
  87. splitLine: {
  88. lineStyle: {
  89. color: textColor[0]
  90. }
  91. }
  92. },
  93. series: series
  94. };
  95. //console.log(option);
  96. siGongChart.setOption(option);
  97. }
  98. </script>
  99. }