浏览代码

图表优化

lilei 4 年之前
父节点
当前提交
60733b2d6a

+ 7 - 2
src/components/Echarts/bar.vue

@@ -20,7 +20,12 @@ export default {
     },
     text: String,
     subtext: String,
-    color: String,
+    color: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    },
     // 当有多列柱状图展示时的X轴坐标数据
     xAxisData: {
       type: Array,
@@ -120,7 +125,7 @@ export default {
         const seriesData = this.value.length ? values : this.seriesData
         const yMax = this.getYMax(this.seriesData) // 计算最大值
         const option = {
-          color: [this.color],
+          color: this.color,
           title: {
             text: this.text,
             subtext: this.subtext,

+ 7 - 2
src/components/Echarts/line.vue

@@ -17,7 +17,12 @@ export default {
     value: Object, // 单列折线图,key为x轴,value为y轴
     text: String,
     subtext: String,
-    color: String,
+    color: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    },
     // 当有多列折线图展示时的X轴坐标数据
     xAxisData: {
       type: Array,
@@ -106,7 +111,7 @@ export default {
         const seriesData = this.value ? Object.values(this.value) : this.seriesData
         const yMax = this.getYMax(this.seriesData) // 计算最大值
         const option = {
-          color: [this.color],
+          color: this.color,
           title: {
             text: this.text,
             subtext: this.subtext,

+ 5 - 7
src/views/cleanManage/statisticalReport.vue

@@ -42,12 +42,12 @@
         <!-- 清运量趋势图表展示 -->
         <chart-line
           style="height: 300px;"
-          color="#6C6FBE"
           ref="chartLine"
           yUnit="kg"
           :xAxisRotate="resize"
           :xAxisData="XdaysData"
           :seriesData="clearnChartData"
+          :color="washTypePieColor"
           text=""
         />
         <span v-if="isNoData" class="noData">暂无数据</span>
@@ -75,12 +75,11 @@
             <chart-bar
               ref="ChartBar"
               style="height: 300px;"
-              color="#6C6FBE"
               :xAxisRotate="resize"
               yUnit="kg"
               :xAxisData="XdaysData1"
               :seriesData="hswTypeBarData"
-              text=""
+              :color="washTypePieColor"
             />
             <span v-if="isNoData1" class="noData">暂无数据</span>
           </a-col>
@@ -89,12 +88,11 @@
             <chart-line
               ref="ChartLine"
               style="height: 300px;"
-              color="#6C6FBE"
               yUnit="kg"
               :xAxisRotate="resize"
               :xAxisData="XdaysData1"
               :seriesData="hswTypeLineData"
-              text=""
+              :color="washTypePieColor"
             />
             <span v-if="isNoData1" class="noData">暂无数据</span>
           </a-col>
@@ -265,8 +263,8 @@ export default {
       XdaysData: [], // 图表X轴时间集合
       XdaysData1: [],
       // 各类型占比
-      washTypePieColor: ['#ffaa00', '#ff5500', '#00aaff', '#ff55ff', '#1dc5d4', '#8465c7', '#00ffff'],
-      couponColor: ['#ffaa00', '#ff5500', '#00aaff', '#ff55ff', '#1dc5d4', '#8465c7', '#00ffff'],
+      washTypePieColor: ['#ffaa00', '#00aa00', '#00aaff', '#ff55ff', '#1dc5d4', '#8465c7', '#ff5500', '#527aff'],
+      couponColor: ['#ffaa00', '#ff5500', '#00aaff', '#ff55ff', '#1dc5d4', '#8465c7', '#55aa00', '#527aff'],
       // 清运量趋势
       clearnChartData: [
         {

+ 1 - 1
src/views/map/NodeMap.vue

@@ -148,7 +148,7 @@
             <chart-bar
               ref="ChartBar"
               class="chart-box"
-              color="#0000fe"
+              :color="['#0000fe']"
               :yMax="1000"
               yUnit="台"
               :value="equipmentBarData"