option = {
let lastMetric = _.last(metrics)
let last2Metric = metrics[metrics.length - 2]
let lastDimension = _.last(dimensions)
let sorted = sortedData
let translationDict = finalTranDict
lastMetric = `${lastMetric}_inv` in translationDict ? `${lastMetric}_inv` : lastMetric
last2Metric = `${last2Metric}_inv` in translationDict ? `${last2Metric}_inv` : last2Metric
return {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {type: 'scroll'},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: (sorted || []).map((d) => d[dimensions[1]]),
axisLabel: { rotate: 30 }
}
],
yAxis: [
{
type: 'value',
boundaryGap: [0, 0.01]
},
{
type: 'value',
boundaryGap: [0, 0.01],
splitLine: {show: false},
scale: true
}
],
color: [
'#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'
],
series: [
{
name: translationDict[metrics[0]] || metrics[0],
type: "bar",
barMaxWidth: '30%',
data: (sorted || []).map((d) => d[metrics[0]])
},
{
name: translationDict[last2Metric] || last2Metric,
type: "bar",
barMaxWidth: '30%',
data: (sorted || []).map((d) => _.round(d[last2Metric], 2))
},
{
name: translationDict[lastMetric] || lastMetric,
type: 'line',
symbol: 'circle',
yAxisIndex: 1,
data: (sorted || []).map((d) => _.round(d[metrics[0]]/d[last2Metric]*100,2))
}
]
}
}