|
@@ -31,7 +31,7 @@
|
|
const inst = getInstance();
|
|
const inst = getInstance();
|
|
const domWidth = inst ? inst.getWidth() : 500;
|
|
const domWidth = inst ? inst.getWidth() : 500;
|
|
// 依据每一个图表配置生成图表选项
|
|
// 依据每一个图表配置生成图表选项
|
|
- const { yAxis = [], xAxis = [], legend, order, type, sortBy, series } = props.chartConfig;
|
|
|
|
|
|
+ const { yAxis = [], xAxis = [], legend, order, type, sortBy, series, dataZoom = [] } = props.chartConfig;
|
|
const textStyle = {
|
|
const textStyle = {
|
|
color: '#fff',
|
|
color: '#fff',
|
|
};
|
|
};
|
|
@@ -68,6 +68,15 @@
|
|
return res;
|
|
return res;
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
+ const baseDataZoom = dataZoom.map((e, i) => {
|
|
|
|
+ return {
|
|
|
|
+ type: 'slider',
|
|
|
|
+ show: get(baseSeries, '[0].data.length', 1) > e.maxAxisLength,
|
|
|
|
+ xAxisIndex: i,
|
|
|
|
+ end: e.maxAxisLength,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
if (type === 'pie') {
|
|
if (type === 'pie') {
|
|
return {
|
|
return {
|
|
textStyle,
|
|
textStyle,
|
|
@@ -105,7 +114,7 @@
|
|
textStyle,
|
|
textStyle,
|
|
grid: {
|
|
grid: {
|
|
top: 50,
|
|
top: 50,
|
|
- bottom: 50,
|
|
|
|
|
|
+ bottom: dataZoom.length ? 70 : 50,
|
|
},
|
|
},
|
|
legend: {
|
|
legend: {
|
|
textStyle,
|
|
textStyle,
|
|
@@ -114,6 +123,7 @@
|
|
tooltip: {
|
|
tooltip: {
|
|
trigger: 'item',
|
|
trigger: 'item',
|
|
},
|
|
},
|
|
|
|
+ dataZoom: baseDataZoom,
|
|
xAxis: xAxis.map((e) => {
|
|
xAxis: xAxis.map((e) => {
|
|
return {
|
|
return {
|
|
...e,
|
|
...e,
|
|
@@ -188,8 +198,9 @@
|
|
left: 60,
|
|
left: 60,
|
|
top: 40,
|
|
top: 40,
|
|
right: 60,
|
|
right: 60,
|
|
- bottom: 30,
|
|
|
|
|
|
+ bottom: dataZoom.length ? 70 : 30,
|
|
},
|
|
},
|
|
|
|
+ dataZoom: baseDataZoom,
|
|
xAxis: xAxis.map((e) => {
|
|
xAxis: xAxis.map((e) => {
|
|
return {
|
|
return {
|
|
...e,
|
|
...e,
|
|
@@ -231,8 +242,9 @@
|
|
grid: {
|
|
grid: {
|
|
left: 60,
|
|
left: 60,
|
|
right: 60,
|
|
right: 60,
|
|
- bottom: 30,
|
|
|
|
|
|
+ bottom: dataZoom.length ? 70 : 30,
|
|
},
|
|
},
|
|
|
|
+ dataZoom: baseDataZoom,
|
|
xAxis: xAxis.map((e) => {
|
|
xAxis: xAxis.map((e) => {
|
|
return {
|
|
return {
|
|
...e,
|
|
...e,
|
|
@@ -274,8 +286,9 @@
|
|
left: 50,
|
|
left: 50,
|
|
top: 50,
|
|
top: 50,
|
|
right: 50,
|
|
right: 50,
|
|
- bottom: 50,
|
|
|
|
|
|
+ bottom: dataZoom.length ? 70 : 50,
|
|
},
|
|
},
|
|
|
|
+ dataZoom: baseDataZoom,
|
|
xAxis: xAxis.map((e) => {
|
|
xAxis: xAxis.map((e) => {
|
|
return {
|
|
return {
|
|
...e,
|
|
...e,
|
|
@@ -329,9 +342,10 @@
|
|
left: 40,
|
|
left: 40,
|
|
top: 50,
|
|
top: 50,
|
|
right: 40,
|
|
right: 40,
|
|
- bottom: 10,
|
|
|
|
|
|
+ bottom: dataZoom.length ? 70 : 10,
|
|
show: false,
|
|
show: false,
|
|
},
|
|
},
|
|
|
|
+ dataZoom: baseDataZoom,
|
|
xAxis: xAxis.map((e) => {
|
|
xAxis: xAxis.map((e) => {
|
|
return {
|
|
return {
|
|
...e,
|
|
...e,
|