|
|
@@ -99,10 +99,10 @@ function barConfig(model) {
|
|
|
itemGap: 0,
|
|
|
padding: 0
|
|
|
},
|
|
|
- tooltip1: {
|
|
|
+ tooltip: {
|
|
|
trigger: 'axis',
|
|
|
axisPointer: {
|
|
|
- type: 'shandow'
|
|
|
+ type: 'shadow'
|
|
|
}
|
|
|
},
|
|
|
legend: {
|
|
|
@@ -116,23 +116,12 @@ function barConfig(model) {
|
|
|
data : xfields,
|
|
|
axisTick: {
|
|
|
alignWithLabel: true
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
- color: "white"
|
|
|
- }
|
|
|
}
|
|
|
}],
|
|
|
yAxis: [{
|
|
|
- // type: ytype,
|
|
|
- type: 'value',
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
- color: "white"
|
|
|
- }
|
|
|
- }
|
|
|
+ type: ytype == 'numeric' ? 'value' : ytype
|
|
|
}],
|
|
|
- series: getSeries(series, 'bar')
|
|
|
+ series: getBarSeries(series)
|
|
|
}
|
|
|
},
|
|
|
layout: getLayout(layout)
|
|
|
@@ -157,11 +146,8 @@ function lineConfig(model) {
|
|
|
itemGap: 0,
|
|
|
padding: 0
|
|
|
},
|
|
|
- tooltip1: {
|
|
|
- trigger: 'axis',
|
|
|
- axisPointer: {
|
|
|
- type: 'line'
|
|
|
- }
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis'
|
|
|
},
|
|
|
legend: {
|
|
|
right: '3%',
|
|
|
@@ -174,23 +160,12 @@ function lineConfig(model) {
|
|
|
data : xfields,
|
|
|
axisTick: {
|
|
|
alignWithLabel: true
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
- color: "white"
|
|
|
- }
|
|
|
}
|
|
|
}],
|
|
|
yAxis: [{
|
|
|
- // type: ytype,
|
|
|
- type: 'value',
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
- color: "white"
|
|
|
- }
|
|
|
- }
|
|
|
+ type: ytype == 'numeric' ? 'value' : ytype
|
|
|
}],
|
|
|
- series: getSeries(series,'line')
|
|
|
+ series: getLineSeries(series)
|
|
|
}
|
|
|
},
|
|
|
layout: getLayout(layout)
|
|
|
@@ -202,7 +177,6 @@ function pieConfig(model) {
|
|
|
let { title, subtitle, series} = config;
|
|
|
series = series.map((v, i) => {
|
|
|
v.value = v.data;
|
|
|
- delete v.data;
|
|
|
return v;
|
|
|
});
|
|
|
return {
|
|
|
@@ -219,7 +193,7 @@ function pieConfig(model) {
|
|
|
itemGap: 0,
|
|
|
padding: 0
|
|
|
},
|
|
|
- tooltip1: {
|
|
|
+ tooltip: {
|
|
|
trigger: 'item',
|
|
|
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
|
|
},
|
|
|
@@ -229,25 +203,22 @@ function pieConfig(model) {
|
|
|
return v.name
|
|
|
})
|
|
|
},
|
|
|
- series: [getPieSeries(series)]
|
|
|
+ series: getPieSeries(series)
|
|
|
}
|
|
|
},
|
|
|
layout: getLayout(layout)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function getSeries(s,t) {
|
|
|
+function getBarSeries(s) {
|
|
|
let series = [];
|
|
|
const model = {
|
|
|
- type: t,
|
|
|
+ type: 'bar',
|
|
|
label: {
|
|
|
normal: {
|
|
|
show: true,
|
|
|
position: 'top',
|
|
|
- formatter: '{c}',
|
|
|
- textStyle: {
|
|
|
- color: 'white'
|
|
|
- }
|
|
|
+ formatter: '{c}'
|
|
|
}
|
|
|
},
|
|
|
barGap: 0
|
|
|
@@ -261,6 +232,27 @@ function getSeries(s,t) {
|
|
|
return series;
|
|
|
}
|
|
|
|
|
|
+function getLineSeries(s) {
|
|
|
+ let series = [];
|
|
|
+ const model = {
|
|
|
+ type: 'line',
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ show: true,
|
|
|
+ position: 'inside',
|
|
|
+ formatter: '{c}'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ series = s.map((v, i) => {
|
|
|
+ let m = Object.assign({},model);
|
|
|
+ m.name = v.name;
|
|
|
+ m.data = v.data;
|
|
|
+ return m;
|
|
|
+ });
|
|
|
+ return series;
|
|
|
+}
|
|
|
+
|
|
|
function getPieSeries(s) {
|
|
|
const model = {
|
|
|
type: 'pie',
|
|
|
@@ -274,7 +266,7 @@ function getPieSeries(s) {
|
|
|
let series = Object.assign({},model);
|
|
|
series.name = '';
|
|
|
series.data = s
|
|
|
- return series;
|
|
|
+ return [series];
|
|
|
}
|
|
|
|
|
|
function getLayout(l) {
|