refactor(largeScreen): 优化现金流报表样式
- 调整 legend 位置和样式 - 优化 tooltip 内容和格式 - 调整图表布局和样式
This commit is contained in:
@ -696,23 +696,29 @@ export const getInventoryOption = () => {
|
|||||||
};
|
};
|
||||||
export const getBarOptions = (data: any) => {
|
export const getBarOptions = (data: any) => {
|
||||||
const option = {
|
const option = {
|
||||||
|
|
||||||
legend: {
|
|
||||||
show: true,
|
|
||||||
top: '50%',
|
|
||||||
},
|
|
||||||
backgroundColor: '',
|
backgroundColor: '',
|
||||||
grid: {
|
grid: {
|
||||||
left: '8%',
|
left: '8%',
|
||||||
top: '4%',
|
top: '10%', // 顶部留一点空间给 legend
|
||||||
bottom: '8%',
|
bottom: '8%',
|
||||||
right: '2%'
|
right: '2%'
|
||||||
},
|
},
|
||||||
|
legend: {
|
||||||
|
data: ['现金流入', '现金流出'], // 与 series.name 对应
|
||||||
|
top: '0%',
|
||||||
|
textStyle: { color: '#fff', fontSize: 12 }
|
||||||
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: true,
|
||||||
backgroundColor: '',
|
backgroundColor: '',
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
formatter: '{b0}:{c0}万元',
|
// formatter: '{b0}:{c0}万元',
|
||||||
|
formatter: (params: any) => {
|
||||||
|
// params 是数组,对应每条柱子
|
||||||
|
return params
|
||||||
|
.map((p: any) => `${p.seriesName}:${p.value} 万元`)
|
||||||
|
.join('<br/>');
|
||||||
|
},
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#fff'
|
color: '#fff'
|
||||||
},
|
},
|
||||||
@ -788,6 +794,7 @@ export const getBarOptions = (data: any) => {
|
|||||||
// ],
|
// ],
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
|
name: '现金流入',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: data.value[0],
|
data: data.value[0],
|
||||||
// stack: '合并',
|
// stack: '合并',
|
||||||
@ -826,6 +833,7 @@ export const getBarOptions = (data: any) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: '现金流出',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: data.value[1],
|
data: data.value[1],
|
||||||
// stack: '合并',
|
// stack: '合并',
|
||||||
@ -859,8 +867,8 @@ export const getBarOptions = (data: any) => {
|
|||||||
formatter: '{c}',
|
formatter: '{c}',
|
||||||
position: 'top',
|
position: 'top',
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
fontSize: 10
|
fontSize: 10,
|
||||||
// padding: 5
|
padding: 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -888,7 +896,9 @@ export const getBarOptions2 = (data: any) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'item'
|
trigger: 'item',
|
||||||
|
show: true
|
||||||
|
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
top: '5%',
|
top: '5%',
|
||||||
|
Reference in New Issue
Block a user