|
|
@@ -23,25 +23,17 @@ function converter(data) {
|
|
|
}
|
|
|
});
|
|
|
return {
|
|
|
- title: {
|
|
|
- title
|
|
|
- },
|
|
|
+ title: titleConfig(title),
|
|
|
content: {
|
|
|
items: newItems
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function titleConfig(model) {
|
|
|
- let {render, state, cls, style, width, height, layout} = model;
|
|
|
-
|
|
|
+function titleConfig(title) {
|
|
|
return {
|
|
|
- render: Renders[render] || render,
|
|
|
- cls,
|
|
|
- style: parseStr(style),
|
|
|
- width,
|
|
|
- height,
|
|
|
- layout
|
|
|
+ title: title,
|
|
|
+ fontSize: getFontSize()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -51,7 +43,7 @@ function formConfig(model) {
|
|
|
let c = {
|
|
|
type: 'form',
|
|
|
config: {
|
|
|
- fontSize: fontSize || getFontSize(layout),
|
|
|
+ fontSize: fontSize || getFontSize(),
|
|
|
header: Renders[header] || header,
|
|
|
fieldStyle: parseStr(fieldstyle),
|
|
|
valueStyle: parseStr(valuestyle),
|
|
|
@@ -69,7 +61,7 @@ function tableConfig(model) {
|
|
|
return {
|
|
|
type: 'table',
|
|
|
config: {
|
|
|
- fontSize: fontSize || getFontSize(layout),
|
|
|
+ fontSize: fontSize || getFontSize(),
|
|
|
rowHeight: rowHeight,
|
|
|
title: Renders[title] || title,
|
|
|
render: Renders[render],
|
|
|
@@ -112,7 +104,7 @@ function barConfig(model) {
|
|
|
orient: 'horizontal',
|
|
|
itemGap: layout.w,
|
|
|
textStyle: {
|
|
|
- fontSize: getFontSize(layout) * 0.7
|
|
|
+ fontSize: getFontSize() * 0.7
|
|
|
},
|
|
|
data: series.map((v, i) => {
|
|
|
return v.name
|
|
|
@@ -125,13 +117,13 @@ function barConfig(model) {
|
|
|
nameGap: 0,
|
|
|
nameRotate: 270,
|
|
|
nameTextStyle: {
|
|
|
- fontSize: getFontSize(layout) * .7
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
},
|
|
|
axisLabel: {
|
|
|
rotate: getScreenSize().screenWidth * layout.w / xf.length / 100 < 60 ? 45 : 0,
|
|
|
interval: 0,
|
|
|
textStyle: {
|
|
|
- fontSize: getFontSize(layout) * .7
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
@@ -139,11 +131,11 @@ function barConfig(model) {
|
|
|
name: ytitle,
|
|
|
type: ytype == 'numeric' ? 'value' : ytype,
|
|
|
nameTextStyle: {
|
|
|
- fontSize: getFontSize(layout) * .7
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
},
|
|
|
axisLabel: {
|
|
|
textStyle: {
|
|
|
- fontSize: getFontSize(layout) * .7
|
|
|
+ fontSize: getFontSize() * .7
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
@@ -176,7 +168,7 @@ function lineConfig(model) {
|
|
|
orient: 'horizontal',
|
|
|
itemGap: layout.w,
|
|
|
textStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * 0.7
|
|
|
+ fontSize: fontSize || getFontSize() * 0.7
|
|
|
},
|
|
|
data: series.map((v, i) => {
|
|
|
return v.name
|
|
|
@@ -189,13 +181,13 @@ function lineConfig(model) {
|
|
|
nameRotate: 270,
|
|
|
nameGap: 0,
|
|
|
nameTextStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * .7
|
|
|
+ fontSize: fontSize || getFontSize() * .7
|
|
|
},
|
|
|
axisLabel: {
|
|
|
rotate: getScreenSize().screenWidth * layout.w / xf.length / 100 < 60 ? 45 : 0,
|
|
|
interval: 0,
|
|
|
textStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * .7
|
|
|
+ fontSize: fontSize || getFontSize() * .7
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
@@ -203,11 +195,11 @@ function lineConfig(model) {
|
|
|
name: ytitle,
|
|
|
type: ytype == 'numeric' ? 'value' : ytype,
|
|
|
nameTextStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * .7
|
|
|
+ fontSize: fontSize || getFontSize() * .7
|
|
|
},
|
|
|
axisLabel: {
|
|
|
textStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * .7
|
|
|
+ fontSize: fontSize || getFontSize() * .7
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
@@ -250,11 +242,11 @@ function getChartsTitle(fontSize, layout, title, subtitle) {
|
|
|
textAlign: 'center',
|
|
|
textStyle: {
|
|
|
verticalAlign: 'top',
|
|
|
- fontSize: fontSize || getFontSize(layout) * 1
|
|
|
+ fontSize: fontSize || getFontSize() * 1
|
|
|
},
|
|
|
subtextStyle: {
|
|
|
verticalAlign: 'top',
|
|
|
- fontSize: fontSize || getFontSize(layout) * 0.75
|
|
|
+ fontSize: fontSize || getFontSize() * 0.75
|
|
|
},
|
|
|
left: '50%',
|
|
|
right: '50%',
|
|
|
@@ -274,7 +266,7 @@ function getBarSeries(fontSize, layout, series) {
|
|
|
position: 'top',
|
|
|
formatter: '{c}',
|
|
|
textStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * .7
|
|
|
+ fontSize: fontSize || getFontSize() * .7
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -283,7 +275,7 @@ function getBarSeries(fontSize, layout, series) {
|
|
|
s = series.map((v, i) => {
|
|
|
let m = Object.assign({},model);
|
|
|
m.name = v.name;
|
|
|
- m.data = v.data;
|
|
|
+ m.data = v.data instanceof Array ? v.data : [v.data];
|
|
|
return m;
|
|
|
});
|
|
|
return s;
|
|
|
@@ -304,7 +296,7 @@ function getLineSeries(fontSize, series) {
|
|
|
s = series.map((v, i) => {
|
|
|
let m = Object.assign({},model);
|
|
|
m.name = v.name;
|
|
|
- m.data = v.data;
|
|
|
+ m.data = v.data instanceof Array ? v.data : [v.data];
|
|
|
return m;
|
|
|
});
|
|
|
return s;
|
|
|
@@ -319,7 +311,7 @@ function getPieSeries(fontSize, layout, series) {
|
|
|
label: {
|
|
|
normal: {
|
|
|
textStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * 0.7
|
|
|
+ fontSize: fontSize || getFontSize() * 0.7
|
|
|
},
|
|
|
formatter: '{b}: {c} \n {d}%'
|
|
|
}
|
|
|
@@ -327,7 +319,7 @@ function getPieSeries(fontSize, layout, series) {
|
|
|
}
|
|
|
let s = Object.assign({},model);
|
|
|
s.name = '';
|
|
|
- s.data = series
|
|
|
+ s.data = series instanceof Array ? series : [series];
|
|
|
return [s];
|
|
|
}
|
|
|
|
|
|
@@ -341,7 +333,7 @@ function getPieLegend(fontSize, layout, series) {
|
|
|
itemGap: layout.w / 10,
|
|
|
top: '20%',
|
|
|
textStyle: {
|
|
|
- fontSize: fontSize || getFontSize(layout) * 0.7
|
|
|
+ fontSize: fontSize || getFontSize() * 0.7
|
|
|
},
|
|
|
data: series.map((v, i) => {
|
|
|
return v.name
|
|
|
@@ -389,7 +381,7 @@ function getScreenSize() {
|
|
|
return {screenHeight, screenWidth};
|
|
|
}
|
|
|
|
|
|
-function getFontSize(layout) {
|
|
|
+function getFontSize() {
|
|
|
let {screenHeight, screenWidth} = getScreenSize();
|
|
|
if(screenWidth > 800) {
|
|
|
return 22;
|