|
|
@@ -1,28 +1,28 @@
|
|
|
-export default (config, silent) => {
|
|
|
+export default (config, silent, thumbnail) => {
|
|
|
const { viewType, option } = config;
|
|
|
let o;
|
|
|
switch(viewType) {
|
|
|
case 'bar': {
|
|
|
- o = barConfig(option, silent);
|
|
|
+ o = barConfig(option, silent, thumbnail);
|
|
|
break;
|
|
|
}
|
|
|
case 'pie': {
|
|
|
- o = pieConfig(option, silent);
|
|
|
+ o = pieConfig(option, silent, thumbnail);
|
|
|
break;
|
|
|
}
|
|
|
case 'line': {
|
|
|
- o = lineConfig(option, silent);
|
|
|
+ o = lineConfig(option, silent, thumbnail);
|
|
|
break;
|
|
|
}
|
|
|
case 'scatter': {
|
|
|
- o = scatterConfig(option, silent);
|
|
|
+ o = scatterConfig(option, silent, thumbnail);
|
|
|
break;
|
|
|
}
|
|
|
case 'aggregateTable': {
|
|
|
- o = tableConfig(option, silent);
|
|
|
+ o = tableConfig(option, silent, thumbnail);
|
|
|
break;
|
|
|
}case 'dataView' : {
|
|
|
- o = tableConfig(option, silent);
|
|
|
+ o = tableConfig(option, silent, thumbnail);
|
|
|
break;
|
|
|
}
|
|
|
default:{
|
|
|
@@ -33,13 +33,13 @@ export default (config, silent) => {
|
|
|
return o;
|
|
|
}
|
|
|
|
|
|
-function barConfig(option, silent) {
|
|
|
+function barConfig(option, silent, thumbnail) {
|
|
|
const { xAxis, serieses, xTitle, yTitle } = option;
|
|
|
|
|
|
let o = {
|
|
|
- animation: !silent,
|
|
|
+ animation: !thumbnail,
|
|
|
tooltip : {
|
|
|
- show: !silent,
|
|
|
+ show: !silent && !thumbnail,
|
|
|
trigger: "axis",
|
|
|
axisPointer: {
|
|
|
type: "cross",
|
|
|
@@ -49,23 +49,24 @@ function barConfig(option, silent) {
|
|
|
}
|
|
|
},
|
|
|
legend: {
|
|
|
- show: !silent
|
|
|
+ show: !thumbnail,
|
|
|
+ selectedMode: !silent
|
|
|
},
|
|
|
grid: {
|
|
|
- left: silent ? 0 : '10%',
|
|
|
- right: silent ? 0 : '10%',
|
|
|
- top: silent ? 0 : 60,
|
|
|
- bottom: silent ? 0 : 60,
|
|
|
- containLabel: !silent
|
|
|
+ left: thumbnail ? 10 : '10%',
|
|
|
+ right: thumbnail ? 10 : '10%',
|
|
|
+ top: thumbnail ? 10 : 60,
|
|
|
+ bottom: thumbnail ? 10 : 60,
|
|
|
+ containLabel: !thumbnail
|
|
|
},
|
|
|
xAxis: [{
|
|
|
- show: !silent,
|
|
|
+ show: !thumbnail,
|
|
|
type: 'category',
|
|
|
data: xAxis,
|
|
|
name: xTitle || '横轴',
|
|
|
}],
|
|
|
yAxis: [{
|
|
|
- show: !silent,
|
|
|
+ show: !thumbnail,
|
|
|
name: yTitle || '纵轴',
|
|
|
type: 'value'
|
|
|
}],
|
|
|
@@ -74,7 +75,7 @@ function barConfig(option, silent) {
|
|
|
name: s.name,
|
|
|
type: 'bar',
|
|
|
data: s.value,
|
|
|
- showSymbol: !silent,
|
|
|
+ showSymbol: !thumbnail,
|
|
|
silent,
|
|
|
}
|
|
|
})
|
|
|
@@ -82,27 +83,28 @@ function barConfig(option, silent) {
|
|
|
return o;
|
|
|
}
|
|
|
|
|
|
-function pieConfig(option, silent) {
|
|
|
+function pieConfig(option, silent, thumbnail) {
|
|
|
|
|
|
const { xAxis, columnName, serieses } = option;
|
|
|
|
|
|
let o = {
|
|
|
- animation: !silent,
|
|
|
+ animation: !thumbnail,
|
|
|
grid: {
|
|
|
- left: silent ? 0 : '10%',
|
|
|
- right: silent ? 0 : '10%',
|
|
|
- top: silent ? 0 : 60,
|
|
|
- bottom: silent ? 0 : 60,
|
|
|
- containLabel: !silent
|
|
|
+ left: thumbnail ? 10 : '10%',
|
|
|
+ right: thumbnail ? 10 : '10%',
|
|
|
+ top: thumbnail ? 10 : 60,
|
|
|
+ bottom: thumbnail ? 10 : 60,
|
|
|
+ containLabel: !thumbnail
|
|
|
},
|
|
|
tooltip : {
|
|
|
- show: !silent,
|
|
|
+ show: !silent && !thumbnail,
|
|
|
trigger: 'item',
|
|
|
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
|
|
},
|
|
|
legend: {
|
|
|
- show: !silent,
|
|
|
- data: xAxis
|
|
|
+ show: !thumbnail,
|
|
|
+ data: xAxis,
|
|
|
+ selectedMode: !silent
|
|
|
},
|
|
|
series : [
|
|
|
{
|
|
|
@@ -127,35 +129,36 @@ function pieConfig(option, silent) {
|
|
|
return o;
|
|
|
}
|
|
|
|
|
|
-function lineConfig(option, silent) {
|
|
|
+function lineConfig(option, silent, thumbnail) {
|
|
|
const { serieses, xTitle, yTitle } = option;
|
|
|
|
|
|
let o = {
|
|
|
- animation: !silent,
|
|
|
+ animation: !thumbnail,
|
|
|
grid: {
|
|
|
- left: silent ? 0 : '10%',
|
|
|
- right: silent ? 0 : '10%',
|
|
|
- top: silent ? 0 : 60,
|
|
|
- bottom: silent ? 0 : 60,
|
|
|
- containLabel: !silent
|
|
|
+ left: thumbnail ? 10 : '10%',
|
|
|
+ right: thumbnail ? 10 : '10%',
|
|
|
+ top: thumbnail ? 10 : 60,
|
|
|
+ bottom: thumbnail ? 10 : 60,
|
|
|
+ containLabel: !thumbnail
|
|
|
},
|
|
|
tooltip: {
|
|
|
- show: !silent,
|
|
|
+ show: !silent && !thumbnail,
|
|
|
trigger: 'axis',
|
|
|
axisPointer: {
|
|
|
type: 'cross'
|
|
|
}
|
|
|
},
|
|
|
legend: {
|
|
|
- show: !silent
|
|
|
+ show: !thumbnail,
|
|
|
+ selectedMode: !silent
|
|
|
},
|
|
|
xAxis: {
|
|
|
- show: !silent,
|
|
|
+ show: !thumbnail,
|
|
|
name: xTitle,
|
|
|
type: 'time'
|
|
|
},
|
|
|
yAxis: {
|
|
|
- show: !silent,
|
|
|
+ show: !thumbnail,
|
|
|
name: yTitle,
|
|
|
type: 'value'
|
|
|
},
|
|
|
@@ -167,7 +170,7 @@ function lineConfig(option, silent) {
|
|
|
data: s.mdata.map(m => {
|
|
|
return [m.date, m.value]
|
|
|
}),
|
|
|
- showSymbol: !silent,
|
|
|
+ showSymbol: !thumbnail,
|
|
|
silent
|
|
|
}
|
|
|
})
|
|
|
@@ -176,19 +179,19 @@ function lineConfig(option, silent) {
|
|
|
return o;
|
|
|
}
|
|
|
|
|
|
-function scatterConfig(option, silent) {
|
|
|
+function scatterConfig(option, silent, thumbnail) {
|
|
|
const { serieses, xTitle, yTitle } = option;
|
|
|
let o = {
|
|
|
- animation: !silent,
|
|
|
+ animation: !thumbnail,
|
|
|
grid: {
|
|
|
- left: silent ? 10 : '10%',
|
|
|
- right: silent ? 10 : '10%',
|
|
|
- top: silent ? 10 : 60,
|
|
|
- bottom: silent ? 10 : 60,
|
|
|
- containLabel: !silent
|
|
|
+ left: thumbnail ? 10 : '10%',
|
|
|
+ right: thumbnail ? 10 : '10%',
|
|
|
+ top: thumbnail ? 10 : 60,
|
|
|
+ bottom: thumbnail ? 10 : 60,
|
|
|
+ containLabel: !thumbnail
|
|
|
},
|
|
|
tooltip : {
|
|
|
- show: !silent,
|
|
|
+ show: !silent && !thumbnail,
|
|
|
showDelay : 0,
|
|
|
axisPointer:{
|
|
|
show: true,
|
|
|
@@ -200,11 +203,12 @@ function scatterConfig(option, silent) {
|
|
|
}
|
|
|
},
|
|
|
legend: {
|
|
|
- show: !silent
|
|
|
+ show: !thumbnail,
|
|
|
+ selectedMode: !silent
|
|
|
},
|
|
|
xAxis : [
|
|
|
{
|
|
|
- show: !silent,
|
|
|
+ show: !thumbnail,
|
|
|
type : 'value',
|
|
|
name: xTitle,
|
|
|
scale:true,
|
|
|
@@ -215,7 +219,7 @@ function scatterConfig(option, silent) {
|
|
|
],
|
|
|
yAxis : [
|
|
|
{
|
|
|
- show: !silent,
|
|
|
+ show: !thumbnail,
|
|
|
type : 'value',
|
|
|
name: yTitle,
|
|
|
scale:true,
|
|
|
@@ -243,7 +247,7 @@ function tableConfig(option, silent) {
|
|
|
let o = {
|
|
|
columns: columns.map(c => {
|
|
|
if(c.dataIndex === 'percent') {
|
|
|
- return { ...c, render: (value, record, index) => {console.log(record);return ((+value*100).toFixed(2)) + '%'} };
|
|
|
+ return { ...c, render: (value, record, index) => ((+value*100).toFixed(2)) + '%'};
|
|
|
}else {
|
|
|
return c;
|
|
|
}
|