'How to set the legend area in a two-column fashion in Apache Echarts
I want to set the legend area in a two-column fashion in Apache Echarts, how I can achieve this with legend options? I'm not able to find any example related to this.
Sample image (I want a legend area like the image mentioned below).
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
top: '3%',
},
grid: {
top: '28%',
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
},
xAxis: {
type: 'value',
},
yAxis: {
type: 'category',
data: ['Actual Avg', 'Min Standard']
},
series: JSON.parse(data),
};
Solution 1:[1]
In "legend" you can define the data by writing something like this
legend:{
...,
data: [
{name: 'series 1', ...},
{name: 'series 2', ...}
]
}
If you want the legend to generate automatically, it will depend on what you have on "series".
"If data is not specified, it will be auto collected from series. For most of series, it will be collected from series.name or the dimension name specified by seriesName of series.encode. For some types of series like pie and funnel, it will be collected from the name field of series.data." - Echarts Documentation
Since i don't know how your "series" is defined, i can't give you a code example, but i think the documentation part will help you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Paulo Gonçalves |

