diff --git a/src/components/e-charts/bar-chart.vue b/src/components/e-charts/bar-chart.vue index 2400096d8aaadfa6fe630482c2423a9f97088914..20e77dea7a47bece10445c5993c2ad16fd4db8fc 100644 --- a/src/components/e-charts/bar-chart.vue +++ b/src/components/e-charts/bar-chart.vue @@ -11,40 +11,45 @@ export default { default: () => { return { legendData: [], - seriesData: [] + seriesData: [], }; - } + }, }, bar_width: { type: Number, - default: 12 + default: 12, }, colors: { type: Array, default: () => { return ["#274fee", "#274fee"]; - } + }, }, bar_border_radius: { type: Array, default: () => { return [10, 10, 10, 10]; - } + }, }, show_split: { type: Boolean, - default: false + default: false, }, x_router: { type: Number, - default: 0 - } + default: 0, + }, + xAxis_text_length: { + type: Number, + default: 0, + }, }, data: () => ({}), mounted() {}, methods: { bar() { let self = this; + return { tooltip: { trigger: "axis", @@ -55,14 +60,14 @@ export default { htmlStr += params[i].value; } return htmlStr; - } + }, }, grid: { left: 10, right: 10, bottom: 25, top: 25, - containLabel: true + containLabel: true, }, xAxis: [ { @@ -72,65 +77,71 @@ export default { margin: 20, color: "#0d1847", textStyle: { - fontSize: 12 + fontSize: 12, }, interval: 0, rotate: self.x_router, - /* formatter: function(value) { - let valueTxt = ""; - if (value.length > 6) { - valueTxt = value.substring(0, 5) + "..."; + formatter: function(value) { + let maxLen = self.xAxis_text_length; + + if (maxLen > 1) { + let valueTxt = ""; + if (value.length > maxLen) { + valueTxt = value.substring(0, maxLen - 1) + "..."; + } else { + valueTxt = value; + } + return valueTxt; } else { - valueTxt = value; + return value; } - return valueTxt; - } */ + }, }, axisLine: { lineStyle: { - color: "#f2f2f2" - } + color: "#f2f2f2", + }, }, axisTick: { - show: false + show: false, }, splitArea: { show: true, areaStyle: { color: ["#fff", "#f8f9fd"], - opacity: 0.5 + opacity: 0.5, }, - interval: 0 + interval: 0, }, axisPointer: { type: "shadow", }, - } + }, ], yAxis: [ { axisLabel: { color: "#a9aec0", textStyle: { - fontSize: 12 - } + fontSize: 12, + }, }, minInterval: 1, axisLine: { lineStyle: { - color: "rgba(0, 0, 0, 0)" - } + color: "rgba(0, 0, 0, 0)", + }, }, axisTick: { - show: false + show: false, }, splitLine: { lineStyle: { color: "#f2f2f2", - type: "solid" - } - } - } + type: "solid", + }, + }, + }, ], series: [ { @@ -148,24 +159,24 @@ export default { [ { offset: 0, - color: self.colors[0] // 0% 处的颜色 + color: self.colors[0], // 0% 处的颜色 }, { offset: 1, - color: self.colors[1] // 100% 处的颜色 - } + color: self.colors[1], // 100% 处的颜色 + }, ], false ); }, - barBorderRadius: self.bar_border_radius - } - } - } - ] + barBorderRadius: self.bar_border_radius, + }, + }, + }, + ], }; - } - } + }, + }, }; \ No newline at end of file + diff --git a/src/components/e-charts/commentlist.vue b/src/components/e-charts/commentlist.vue index 47cff06adf21a7c2c18a281e41ce12bb44ea7051..cadc72f128d1cab1455abba9849d6d6751213c7d 100644 --- a/src/components/e-charts/commentlist.vue +++ b/src/components/e-charts/commentlist.vue @@ -1,13 +1,27 @@