From ad7d3303ebc4cf12cfc2407887bfb4c636dd1d4a Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Tue, 14 Jul 2020 13:16:39 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20echarts=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eharts-statistics/eharts-statistics.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/ui/eharts-statistics/eharts-statistics.component.ts b/src/app/ui/eharts-statistics/eharts-statistics.component.ts index 49f14bb..dfaa404 100644 --- a/src/app/ui/eharts-statistics/eharts-statistics.component.ts +++ b/src/app/ui/eharts-statistics/eharts-statistics.component.ts @@ -135,7 +135,7 @@ export class EhartsStatisticsComponent implements OnInit { let catalogs = [] //学习目标 let counts = [] //统计次数 let newData = data.sort( function (a,b) { - return a.count - b.count + return b.count - a.count } ) newData.forEach(element => { postNames.push(element.postName) @@ -167,22 +167,27 @@ export class EhartsStatisticsComponent implements OnInit { boundaryGap: [0, 0.01] }, yAxis: { + inverse: true, "axisLine":{ //y轴 "show":false }, "axisTick":{ //y轴刻度线 - "show":false + "show":false, }, "splitLine": { //网格线 "show": false }, type: 'category', - data: postNames + data: postNames, + max: function (value) { + return 100/postNames.length; + }, }, series: [ { type: 'bar', data: counts, + barMaxWidth: 40, // 最大宽度 itemStyle:{ normal:{ color:'#40B4E8',