|
|
@@ -16,6 +16,8 @@ function converter(data) {
|
|
|
return lineConfig(v);
|
|
|
} else if (type == 'pie') {
|
|
|
return pieConfig(v);
|
|
|
+ } else if(type == 'mixchart') {
|
|
|
+ return mixChartConfig(v);
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
@@ -112,18 +114,28 @@ function tableConfig(model) {
|
|
|
|
|
|
function barConfig(model) {
|
|
|
let { type, config, layout } = model;
|
|
|
- let { fontSize, title, subtitle, xtitle, xtype, xfields, ytitle, ytype, yfields, series, legendconfig, areaconfig, color } = config;
|
|
|
+ let { fontSize, title, subtitle, xtitle, xtype, xfields, xconfig, ytitle, ytype, yfields, series, yconfig,
|
|
|
+ legendconfig, areaconfig, barconfig, color } = config;
|
|
|
|
|
|
+ xconfig = parseObjectStr(xconfig);
|
|
|
+ yconfig = parseObjectStr(yconfig);
|
|
|
legendconfig = parseObjectStr(legendconfig);
|
|
|
areaconfig = parseObjectStr(areaconfig);
|
|
|
+ barconfig = parseObjectStr(barconfig);
|
|
|
+
|
|
|
color = eval(color);
|
|
|
series = series ? ((series instanceof Array) ? series : [series]) : [];
|
|
|
let xf = (xfields instanceof Array) ? xfields : (xfields.replace(['['], '').replace([']'], '').split(',')),
|
|
|
- legendTop = legendconfig.top ? (legendconfig.top)+'%' : null,
|
|
|
- itemGap = legendconfig.itemGap ? Number(legendconfig.itemGap) : layout.w / 10,
|
|
|
- itemWidth = legendconfig.itemWidth ? Number(legendconfig.itemWidth) : 25,
|
|
|
- itemHeight = legendconfig.itemHeight ? Number(legendconfig.itemHeight) : 14;
|
|
|
-
|
|
|
+ areaLeft = Number(areaconfig.left)>=0 ? areaconfig.left+'%' : '5%',
|
|
|
+ areaRight = Number(areaconfig.right)>=0 ? areaconfig.right+'%' : '5%',
|
|
|
+ areaTop = Number(areaconfig.top)>=0 ? areaconfig.top+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '35%' : '28%'),
|
|
|
+ areaBottom = Number(areaconfig.bottom)>=0 ? areaconfig.bottom+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '16%'),
|
|
|
+
|
|
|
+ legendLeft = Number(legendconfig.left)>=0 ? legendconfig.left+'%' : null,
|
|
|
+ legendTop = Number(legendconfig.top)>=0 ? legendconfig.top+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '18%'),
|
|
|
+ itemGap = Number(legendconfig.itemGap)>=0 ? Number(legendconfig.itemGap) : layout.w / 10,
|
|
|
+ itemWidth = Number(legendconfig.itemWidth)>=0 ? Number(legendconfig.itemWidth) : 25,
|
|
|
+ itemHeight = Number(legendconfig.itemHeight)>=0 ? Number(legendconfig.itemHeight) : 14;
|
|
|
let o = {
|
|
|
type: 'charts',
|
|
|
config: {
|
|
|
@@ -137,17 +149,14 @@ function barConfig(model) {
|
|
|
},
|
|
|
grid: {
|
|
|
containLabel: true,
|
|
|
- top_: areaconfig.top ? areaconfig.top+'%' : null,
|
|
|
- bottom_: areaconfig.bottom ? areaconfig.bottom+'%' : null,
|
|
|
- left_: areaconfig.left ? areaconfig.left+'%' : null,
|
|
|
- right_: areaconfig.right ? areaconfig.right+'%' : null,
|
|
|
- top: layout.h * getScreenSize().height / 100 < 310 ? '35%' : '28%',
|
|
|
- bottom: layout.h * getScreenSize().height / 100 < 310 ? '20%' : '16%',
|
|
|
+ left: areaLeft,
|
|
|
+ right: areaRight,
|
|
|
+ top: areaTop,
|
|
|
+ bottom: areaBottom
|
|
|
},
|
|
|
legend: {
|
|
|
show: !legendconfig.hide,
|
|
|
- top_: legendTop,
|
|
|
- top: (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '18%'),
|
|
|
+ top: legendTop,
|
|
|
padding: 0,
|
|
|
orient: legendconfig.orient || 'horizontal',
|
|
|
itemGap: itemGap,
|
|
|
@@ -164,14 +173,15 @@ function barConfig(model) {
|
|
|
type: xtype,
|
|
|
data: xf,
|
|
|
name: xtitle,
|
|
|
- nameGap: 5,
|
|
|
- nameRotate: 270,
|
|
|
- nameLocation: 'end',
|
|
|
+ position: xconfig.position || 'bottom',
|
|
|
+ nameGap: xconfig.nameGap || 5,
|
|
|
+ nameRotate: xconfig.nameRotate || 0,
|
|
|
+ nameLocation: xconfig.nameLocation || 'end',
|
|
|
nameTextStyle: {
|
|
|
fontSize: getFontSize() * .7
|
|
|
},
|
|
|
axisLabel: {
|
|
|
- rotate: getScreenSize().width * layout.w / xf.length / 100 < 80 ? 45 : 0,
|
|
|
+ rotate: Number(xconfig.labelRotate)>=0 ? Number(xconfig.labelRotate) : (getScreenSize().width * layout.w / xf.length / 100 < 80 ? 45 : 0),
|
|
|
interval: 0,
|
|
|
textStyle: {
|
|
|
fontSize: getFontSize() * .7
|
|
|
@@ -180,7 +190,10 @@ function barConfig(model) {
|
|
|
}],
|
|
|
yAxis: [{
|
|
|
name: ytitle,
|
|
|
- nameRotate: .1,
|
|
|
+ nameRotate: yconfig.nameRotate || 0,
|
|
|
+ position: yconfig.position || 'left',
|
|
|
+ nameLocation: yconfig.nameLocation || 'end',
|
|
|
+ nameGap: yconfig.nameGap || 15,
|
|
|
type: ytype == 'numeric' ? 'value' : ytype,
|
|
|
nameTextStyle: {
|
|
|
fontSize: getFontSize() * .7
|
|
|
@@ -191,7 +204,7 @@ function barConfig(model) {
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
- series: getBarSeries(fontSize, layout, series, areaconfig)
|
|
|
+ series: getBarSeries(fontSize, layout, series, barconfig)
|
|
|
}
|
|
|
},
|
|
|
layout: getLayout(layout)
|
|
|
@@ -199,27 +212,33 @@ function barConfig(model) {
|
|
|
if(color && color.length > 0) {
|
|
|
o.config.option.color = color;
|
|
|
}
|
|
|
- if(Number(legendconfig.left) >= 0) {
|
|
|
- o.config.option.legend.left = Number(legendconfig.left)+'%';
|
|
|
- }else {
|
|
|
- o.config.option.legend.right = '5%';
|
|
|
- }
|
|
|
+ legendLeft ? (o.config.option.legend.left = legendLeft) : (o.config.option.legend.right = '5%');
|
|
|
return o;
|
|
|
}
|
|
|
|
|
|
function lineConfig(model) {
|
|
|
let { type, config, layout } = model;
|
|
|
- let { fontSize, title, subtitle, xtitle, xtype, xfields, ytitle, ytype, yfields, series, legendconfig, areaconfig, color } = config;
|
|
|
+ let { fontSize, title, subtitle, xtitle, xtype, xfields, xconfig, ytitle, ytype, yfields, yconfig,
|
|
|
+ series, legendconfig, areaconfig, lineconfig, color } = config;
|
|
|
|
|
|
+ xconfig = parseObjectStr(xconfig);
|
|
|
+ yconfig = parseObjectStr(yconfig);
|
|
|
legendconfig = parseObjectStr(legendconfig);
|
|
|
areaconfig = parseObjectStr(areaconfig);
|
|
|
+ lineconfig = parseObjectStr(lineconfig);
|
|
|
color = eval(color);
|
|
|
series = series ? ((series instanceof Array) ? series : [series]) : [];
|
|
|
let xf = (xfields instanceof Array) ? xfields : (xfields.replace(['['], '').replace([']'], '').split(',')),
|
|
|
- legendTop = legendconfig.top ? (legendconfig.top)+'%' : null,
|
|
|
- itemGap = legendconfig.itemGap ? Number(legendconfig.itemGap) : layout.w / 10,
|
|
|
- itemWidth = legendconfig.itemWidth ? Number(legendconfig.itemWidth) : 25,
|
|
|
- itemHeight = legendconfig.itemHeight ? Number(legendconfig.itemHeight) : 14;
|
|
|
+ areaLeft = Number(areaconfig.left)>=0 ? areaconfig.left+'%' : '5%',
|
|
|
+ areaRight = Number(areaconfig.right)>=0 ? areaconfig.right+'%' : '5%',
|
|
|
+ areaTop = Number(areaconfig.top)>=0 ? areaconfig.top+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '35%' : '28%'),
|
|
|
+ areaBottom = Number(areaconfig.bottom)>=0 ? areaconfig.bottom+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '16%'),
|
|
|
+
|
|
|
+ legendLeft = Number(legendconfig.left)>=0 ? legendconfig.left+'%' : null,
|
|
|
+ legendTop = Number(legendconfig.top)>=0 ? legendconfig.top+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '18%'),
|
|
|
+ itemGap = Number(legendconfig.itemGap)>=0 ? Number(legendconfig.itemGap) : layout.w / 10,
|
|
|
+ itemWidth = Number(legendconfig.itemWidth)>=0 ? Number(legendconfig.itemWidth) : 25,
|
|
|
+ itemHeight = Number(legendconfig.itemHeight)>=0 ? Number(legendconfig.itemHeight) : 14;
|
|
|
|
|
|
let o = {
|
|
|
type: 'charts',
|
|
|
@@ -231,17 +250,14 @@ function lineConfig(model) {
|
|
|
},
|
|
|
grid: {
|
|
|
containLabel: true,
|
|
|
- top_: areaconfig.top ? areaconfig.top+'%' : null,
|
|
|
- bottom_: areaconfig.bottom ? areaconfig.bottom+'%' : null,
|
|
|
- left_: areaconfig.left ? areaconfig.left+'%' : null,
|
|
|
- right_: areaconfig.right ? areaconfig.right+'%' : null,
|
|
|
- top: layout.h * getScreenSize().height / 100 < 310 ? '35%' : '28%',
|
|
|
- bottom: layout.h * getScreenSize().height / 100 < 310 ? '20%' : '16%',
|
|
|
+ left: areaLeft,
|
|
|
+ right: areaRight,
|
|
|
+ top: areaTop,
|
|
|
+ bottom: areaBottom
|
|
|
},
|
|
|
legend: {
|
|
|
show: !legendconfig.hide,
|
|
|
- top_: legendTop,
|
|
|
- top: (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '18%'),
|
|
|
+ top: legendTop,
|
|
|
padding: 0,
|
|
|
orient: legendconfig.orient || 'horizontal',
|
|
|
itemGap: itemGap,
|
|
|
@@ -258,14 +274,15 @@ function lineConfig(model) {
|
|
|
type: xtype,
|
|
|
data: xf,
|
|
|
name: xtitle,
|
|
|
- nameRotate: 270,
|
|
|
- nameLocation: 'end',
|
|
|
- nameGap: 5,
|
|
|
+ position: xconfig.position || 'bottom',
|
|
|
+ nameRotate: xconfig.nameRotate || 0,
|
|
|
+ nameLocation: xconfig.nameLocation || 'end',
|
|
|
+ nameGap: xconfig.nameGap || 15,
|
|
|
nameTextStyle: {
|
|
|
fontSize: fontSize || getFontSize() * .7
|
|
|
},
|
|
|
axisLabel: {
|
|
|
- rotate: getScreenSize().width * layout.w / xf.length / 100 < 80 ? 45 : 0,
|
|
|
+ rotate: Number(xconfig.labelRotate)>=0 ? Number(xconfig.labelRotate) : (getScreenSize().width * layout.w / xf.length / 100 < 80 ? 45 : 0),
|
|
|
interval: 0,
|
|
|
textStyle: {
|
|
|
fontSize: fontSize || getFontSize() * .7
|
|
|
@@ -274,7 +291,10 @@ function lineConfig(model) {
|
|
|
}],
|
|
|
yAxis: [{
|
|
|
name: ytitle,
|
|
|
- nameRotate: .1,
|
|
|
+ nameRotate: yconfig.nameRotate || 0,
|
|
|
+ position: yconfig.position || 'left',
|
|
|
+ nameLocation: yconfig.nameLocation || 'end',
|
|
|
+ nameGap: yconfig.nameGap || 15,
|
|
|
type: ytype == 'numeric' ? 'value' : ytype,
|
|
|
nameTextStyle: {
|
|
|
fontSize: fontSize || getFontSize() * .7
|
|
|
@@ -285,7 +305,7 @@ function lineConfig(model) {
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
- series: getLineSeries(fontSize, series, areaconfig),
|
|
|
+ series: getLineSeries(fontSize, series, lineconfig),
|
|
|
dataZoom: series.length > 0 ? [
|
|
|
{
|
|
|
type: 'slider',
|
|
|
@@ -302,11 +322,127 @@ function lineConfig(model) {
|
|
|
if(color && color.length > 0) {
|
|
|
o.config.option.color = color;
|
|
|
}
|
|
|
- if(Number(legendconfig.left) >= 0) {
|
|
|
- o.config.option.legend.left = Number(legendconfig.left)+'%';
|
|
|
- }else {
|
|
|
- o.config.option.legend.right = '5%';
|
|
|
- }
|
|
|
+ legendLeft ? (o.config.option.legend.left = legendLeft) : (o.config.option.legend.right = '5%');
|
|
|
+ return o;
|
|
|
+}
|
|
|
+
|
|
|
+function mixChartConfig(model) {
|
|
|
+ let { type, config, layout } = model;
|
|
|
+ let { fontSize, title, subtitle, xtitle, xtype, xfields, xconfig, ybar, yline, series, legendconfig,
|
|
|
+ areaconfig, barconfig, lineconfig, barcolor, linecolor } = config;
|
|
|
+
|
|
|
+ xconfig = parseObjectStr(xconfig);
|
|
|
+ ybar = parseObjectStr(ybar);
|
|
|
+ ybar.config = parseObjectStr(ybar.config);
|
|
|
+ yline = parseObjectStr(yline);
|
|
|
+ yline.config = parseObjectStr(yline.config);
|
|
|
+
|
|
|
+ legendconfig = parseObjectStr(legendconfig);
|
|
|
+ areaconfig = parseObjectStr(areaconfig);
|
|
|
+ barconfig = parseObjectStr(barconfig);
|
|
|
+ lineconfig = parseObjectStr(lineconfig);
|
|
|
+ barcolor = eval(barcolor);
|
|
|
+ linecolor = eval(linecolor);
|
|
|
+ series = series ? ((series instanceof Array) ? series : [series]) : [];
|
|
|
+
|
|
|
+ let xf = (xfields instanceof Array) ? xfields : (xfields.replace(['['], '').replace([']'], '').split(',')),
|
|
|
+ areaLeft = Number(areaconfig.left)>=0 ? areaconfig.left+'%' : '5%',
|
|
|
+ areaRight = Number(areaconfig.right)>=0 ? areaconfig.right+'%' : '5%',
|
|
|
+ areaTop = Number(areaconfig.top)>=0 ? areaconfig.top+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '35%' : '28%'),
|
|
|
+ areaBottom = Number(areaconfig.bottom)>=0 ? areaconfig.bottom+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '16%'),
|
|
|
+
|
|
|
+ legendLeft = Number(legendconfig.left)>=0 ? legendconfig.left+'%' : null,
|
|
|
+ legendTop = Number(legendconfig.top)>=0 ? legendconfig.top+'%' : (layout.h * getScreenSize().height / 100 < 310 ? '20%' : '18%'),
|
|
|
+ itemGap = Number(legendconfig.itemGap)>=0 ? Number(legendconfig.itemGap) : layout.w / 10,
|
|
|
+ itemWidth = Number(legendconfig.itemWidth)>=0 ? Number(legendconfig.itemWidth) : 25,
|
|
|
+ itemHeight = Number(legendconfig.itemHeight)>=0 ? Number(legendconfig.itemHeight) : 14;
|
|
|
+ var o = {
|
|
|
+ type: 'charts',
|
|
|
+ config: {
|
|
|
+ option: {
|
|
|
+ title: getChartsTitle(fontSize, layout, title, subtitle),
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis'
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ show: !legendconfig.hide,
|
|
|
+ top: legendTop,
|
|
|
+ padding: 0,
|
|
|
+ orient: legendconfig.orient || 'horizontal',
|
|
|
+ itemGap: itemGap,
|
|
|
+ itemWidth: itemWidth,
|
|
|
+ itemHeight: itemHeight,
|
|
|
+ textStyle: {
|
|
|
+ fontSize: fontSize || getFontSize() * 0.7
|
|
|
+ },
|
|
|
+ data: series.map((v, i) => {
|
|
|
+ return v.name
|
|
|
+ })
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ containLabel: true,
|
|
|
+ top: areaTop,
|
|
|
+ bottom: areaBottom,
|
|
|
+ left: areaLeft,
|
|
|
+ right: areaRight
|
|
|
+ },
|
|
|
+ xAxis: [{
|
|
|
+ type: xtype,
|
|
|
+ data: xf,
|
|
|
+ name: xtitle,
|
|
|
+ position: xconfig.position || 'bottom',
|
|
|
+ nameGap: xconfig.nameGap || 15,
|
|
|
+ nameRotate: xconfig.nameRotate || 0,
|
|
|
+ nameLocation: xconfig.nameLocation || 'end',
|
|
|
+ nameTextStyle: {
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ rotate: Number(xconfig.labelRotate)>=0 ? xconfig.labelRotate : (getScreenSize().width * layout.w / xf.length / 100 < 80 ? 45 : 0),
|
|
|
+ interval: 0,
|
|
|
+ textStyle: {
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ yAxis: [{
|
|
|
+ name: ybar.title,
|
|
|
+ position: ybar.config ? (ybar.config.position || 'left') : 'left',
|
|
|
+ nameRotate: ybar.config ? (ybar.config.nameRotate || 0) : 0,
|
|
|
+ nameLocation: ybar.config ? (ybar.config.nameLocation || 'end') : 'end',
|
|
|
+ nameGap: ybar.config ? (ybar.config.nameGap || 15) : 15,
|
|
|
+ type: ybar.type == 'numeric' ? 'value' : ytype,
|
|
|
+ nameTextStyle: {
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ textStyle: {
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },{
|
|
|
+ name: yline.title,
|
|
|
+ position: yline.config ? (yline.config.position || 'right') : 'right',
|
|
|
+ nameRotate: yline.config ? (yline.config.nameRotate || 0) : 0,
|
|
|
+ nameLocation: yline.config ? (yline.config.nameLocation || 'end') : 'end',
|
|
|
+ nameGap: yline.config ? (yline.config.nameGap || 15) : 15,
|
|
|
+ type: yline.type == 'numeric' ? 'value' : ytype,
|
|
|
+ nameTextStyle: {
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ textStyle: {
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ series: getMixChartSeries(fontSize, layout, series, barconfig, lineconfig, barcolor, linecolor)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ layout: getLayout(layout)
|
|
|
+ };
|
|
|
+ legendLeft ? (o.config.option.legend.left = legendLeft) : (o.config.option.legend.right = '5%');
|
|
|
+
|
|
|
return o;
|
|
|
}
|
|
|
|
|
|
@@ -371,34 +507,26 @@ function getChartsTitle(fontSize, layout, title, subtitle) {
|
|
|
return title;
|
|
|
}
|
|
|
|
|
|
-function getBarSeries(fontSize, layout, series, areaconfig) {
|
|
|
+function getBarSeries(fontSize, layout, series, barconfig) {
|
|
|
let s = [];
|
|
|
const model = {
|
|
|
type: 'bar',
|
|
|
label: {
|
|
|
normal: {
|
|
|
- show: !areaconfig.hideLabel,
|
|
|
- position: areaconfig.labelPosition || 'top',
|
|
|
- distance: areaconfig.labelDistance ? Number(areaconfig.labelDistance) : 5,
|
|
|
- formatter: areaconfig.labelFormatter || '{c}',
|
|
|
+ show: !barconfig.hideLabel,
|
|
|
+ position: barconfig.labelPosition || 'top',
|
|
|
+ distance: barconfig.labelDistance ? Number(barconfig.labelDistance) : 5,
|
|
|
+ formatter: barconfig.labelFormatter || '{c}',
|
|
|
textStyle: {
|
|
|
fontSize: fontSize || getFontSize() * .7
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- barGap: '10%'
|
|
|
- }
|
|
|
- if(areaconfig.barMaxWidth) {
|
|
|
- model.barMaxWidth = areaconfig.barMaxWidth;
|
|
|
- }
|
|
|
- if(areaconfig.barWidth) {
|
|
|
- model.barWidth = areaconfig.barWidth;
|
|
|
- }
|
|
|
- if(areaconfig.barMinHeight) {
|
|
|
- model.barMinHeight = areaconfig.barMinHeight;
|
|
|
- }
|
|
|
- if(areaconfig.barGap) {
|
|
|
- model.barGap = areaconfig.barGap+"%";
|
|
|
+ barGap: '10%',
|
|
|
+ barMaxWidth: barconfig.barMaxWidth || undefined,
|
|
|
+ barWidth: barconfig.barWidth || undefined,
|
|
|
+ barMinHeight: barconfig.barMinHeight || undefined,
|
|
|
+ barGap: barconfig.barGap || undefined
|
|
|
}
|
|
|
s = series.map((v, i) => {
|
|
|
let m = Object.assign({}, model);
|
|
|
@@ -410,15 +538,15 @@ function getBarSeries(fontSize, layout, series, areaconfig) {
|
|
|
return s;
|
|
|
}
|
|
|
|
|
|
-function getLineSeries(fontSize, series, areaconfig) {
|
|
|
+function getLineSeries(fontSize, series, lineconfig) {
|
|
|
let s = [];
|
|
|
const model = {
|
|
|
type: 'line',
|
|
|
- smooth: areaconfig.smooth || false,
|
|
|
+ smooth: lineconfig.smooth || false,
|
|
|
lineStyle: {
|
|
|
normal: {
|
|
|
- width: areaconfig.lineWidth || 2,
|
|
|
- type: areaconfig.lineType || 'solid'
|
|
|
+ width: lineconfig.lineWidth || 2,
|
|
|
+ type: lineconfig.lineType || 'solid'
|
|
|
}
|
|
|
},
|
|
|
markLine: {
|
|
|
@@ -434,15 +562,15 @@ function getLineSeries(fontSize, series, areaconfig) {
|
|
|
xAxis: ''
|
|
|
}]
|
|
|
},
|
|
|
- symbol: areaconfig.symbol || 'circle',
|
|
|
- symbolSize: areaconfig.symbolSize || 4,
|
|
|
- showSymbol: !areaconfig.hideSymbol,
|
|
|
+ symbol: lineconfig.symbol || 'circle',
|
|
|
+ symbolSize: lineconfig.symbolSize || 4,
|
|
|
+ showSymbol: !lineconfig.hideSymbol,
|
|
|
label: {
|
|
|
normal: {
|
|
|
- show: !areaconfig.hideLabel,
|
|
|
- position: areaconfig.labelPosition || 'top',
|
|
|
- distance: areaconfig.labelDistance ? Number(areaconfig.labelDistance) : 5,
|
|
|
- formatter: areaconfig.labelFormatter || '{c}',
|
|
|
+ show: !lineconfig.hideLabel,
|
|
|
+ position: lineconfig.labelPosition || 'top',
|
|
|
+ distance: lineconfig.labelDistance ? Number(lineconfig.labelDistance) : 5,
|
|
|
+ formatter: lineconfig.labelFormatter || '{c}',
|
|
|
textStyle: {
|
|
|
fontSize: fontSize || getFontSize() * .7
|
|
|
}
|
|
|
@@ -474,7 +602,7 @@ function getPieSeries(fontSize, layout, series, pieconfig) {
|
|
|
textStyle: {
|
|
|
fontSize: fontSize || getFontSize() * 0.7
|
|
|
},
|
|
|
- formatter: '{b}: {c} \n {d}%'
|
|
|
+ formatter: pieconfig.labelFormatter || '{b}: {c} \n {d}%'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -503,7 +631,7 @@ function getPieSeries(fontSize, layout, series, pieconfig) {
|
|
|
}
|
|
|
|
|
|
function getPieLegend(fontSize, layout, series, legendconfig) {
|
|
|
- let hide = legendconfig.hide == 'true',
|
|
|
+ let hide = legendconfig.hide === 'true' || legendconfig.hide === true,
|
|
|
top = legendconfig.top ? (legendconfig.top)+'%' : null,
|
|
|
left = legendconfig.left ? legendconfig.left+'%' : null,
|
|
|
itemGap = legendconfig.itemGap ? Number(legendconfig.itemGap) : layout.w / 10,
|
|
|
@@ -511,7 +639,7 @@ function getPieLegend(fontSize, layout, series, legendconfig) {
|
|
|
itemHeight = legendconfig.itemHeight ? Number(legendconfig.itemHeight) : 14;
|
|
|
|
|
|
let legend = {
|
|
|
- hide_: hide,
|
|
|
+ show: !hide,
|
|
|
top_: top,
|
|
|
left_: left,
|
|
|
width: legendconfig.width,
|
|
|
@@ -534,6 +662,79 @@ function getPieLegend(fontSize, layout, series, legendconfig) {
|
|
|
return legend;
|
|
|
}
|
|
|
|
|
|
+function getMixChartSeries(fontSize, layout, series, barconfig, lineconfig, barcolor, linecolor) {
|
|
|
+ let s = [];
|
|
|
+ const barmodel = {
|
|
|
+ type: 'bar',
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ show: !barconfig.hideLabel,
|
|
|
+ position: barconfig.labelPosition || 'top',
|
|
|
+ distance: barconfig.labelDistance ? Number(barconfig.labelDistance) : 5,
|
|
|
+ formatter: barconfig.labelFormatter || '{c}',
|
|
|
+ textStyle: {
|
|
|
+ fontSize: fontSize || getFontSize() * .7
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ barGap: '10%',
|
|
|
+ barMaxWidth: barconfig.barMaxWidth || undefined,
|
|
|
+ barWidth: barconfig.barWidth || undefined,
|
|
|
+ barMinHeight: barconfig.barMinHeight || undefined,
|
|
|
+ barGap: barconfig.barGap || undefined
|
|
|
+ }
|
|
|
+ const linemodel = {
|
|
|
+ type: 'line',
|
|
|
+ yAxisIndex: 1,
|
|
|
+ smooth: lineconfig.smooth || false,
|
|
|
+ lineStyle: {
|
|
|
+ normal: {
|
|
|
+ width: lineconfig.lineWidth || 2,
|
|
|
+ type: lineconfig.lineType || 'solid'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ markLine: {
|
|
|
+ symbol: '',
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: [{
|
|
|
+ name: '起始位置',
|
|
|
+ yAxis: null,
|
|
|
+ xAxis: ''
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ symbol: lineconfig.symbol || 'circle',
|
|
|
+ symbolSize: lineconfig.symbolSize || 4,
|
|
|
+ showSymbol: !lineconfig.hideSymbol,
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ show: !lineconfig.hideLabel,
|
|
|
+ position: lineconfig.labelPosition || 'top',
|
|
|
+ distance: lineconfig.labelDistance ? Number(lineconfig.labelDistance) : 5,
|
|
|
+ formatter: lineconfig.labelFormatter || '{c}',
|
|
|
+ textStyle: {
|
|
|
+ fontSize: fontSize || getFontSize() * .7
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ s = series.map((v, i) => {
|
|
|
+ let type = v.type;
|
|
|
+ let m = Object.assign({}, eval(`${type}model`));
|
|
|
+ m.name = v.name;
|
|
|
+ m.data = v.data instanceof Array ? v.data : [v.data];
|
|
|
+ let c = [eval(`${type}color`) ? eval(`${type}color`).shift() : undefined];
|
|
|
+ m.color = c;
|
|
|
+ return m;
|
|
|
+ });
|
|
|
+
|
|
|
+ return s;
|
|
|
+}
|
|
|
+
|
|
|
function getLayout(layout) {
|
|
|
let l = {};
|
|
|
for (let k in layout) {
|