Grouped legends | Multiple lane xAxis
I'm working with stacked columns in Baidu echarts and I can't find any information these 2 questions.
1st question: Is it possible to make grouped legends? I would like to be able to select/deselect all '_h' or '_m' using a single button (one for each group).
2nd question: Would I be able to create a multiple lane xAxis? That way I could show my 'A1' and 'A2' at the top lane, and a group name "A" at the bottom lane ( similar to "scope" on html4 tables).
My code
legend: {
data: [ '16_h',
'20_h',
'30_h',
'40_h',
'50_h',
'60_h',
'16_m',
'20_m',
'30_m',
'40_m',
'50_m',
'60_m'
] },
xAxis: { data: [ ["A1","A2"], "B", "C", "D" ] },
...
}
Thanks!
1st question:
legend controls series by series.name. So you can make a legend btn control multiple series via setting those series with the same name (_h in the example bellow).
option = {
legend: {
...,
data: ['_h', '-m']
},
series: [{
name: '_h',
id: '16_h',
data: [ ... ]
}, {
name: '_h',
id: '20_h',
data: [ ... ]
}, {
name: '_h',
id: '30_h',
data: [ ... ]
}, {
name: '_h',
id: '40_h',
data: [ ... ]
}, ...
]
}
2nd question:
I am afraid it can not be implemented directly, but you can try to use multiple axis to simulate multiple lane effect.
Non grouped legend: is it possible to build a legend like this one https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://github.com/apache/incubator-echarts/issues/4761&ved=2ahUKEwiC7dedmImNAxXGnf0HHYZwM9IQFnoECF8QAQ&usg=AOvVaw2q6fkrmAfZ6kQvjfol01mF whereby clicking on the single items would work as usual but clicking on the group name would hide / show all series in the group?