echarts [Feature] 同一个系列使用不同的y轴

ctrmrzij  于 3个月前  发布在  Echarts
关注(0)|答案(2)|浏览(54)

What problem does this feature solve?

同一个系列使用不同的y轴

What does the proposed API look like?

const option = {
xAxis: {
type: 'category',
data: ['项目1', '项目2', '项目3', '项目4', '项目5'],
},
yAxis: [
{
type: 'value',
name: 'Y 轴 1',
},
{
type: 'value',
name: 'Y 轴 2',
position: 'right', // 将第二个 y 轴放置在右侧
},
],
series: [
{
name: '数据系列1',
type: 'bar',
data: [
{ value: 120, yAxisIndex: 0 }, // 使用第一个 y 轴
{ value: 10000, yAxisIndex: 1 }, // 使用第二个 y 轴
{ value: 150, yAxisIndex: 0 }, // 使用第一个 y 轴
{ value: 12000, yAxisIndex: 1 }, // 使用第二个 y 轴
{ value: 70, yAxisIndex: 0 }, // 使用第一个 y 轴
],
// 其他系列配置...
},
],
};

nfzehxib

nfzehxib1#

@Chunliuliu It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED

TITLE

[Feature] The same series uses different y-axes

BODY

What problem does this feature solve?

The same series uses different y-axes

What does the proposed API look like?

const option = {
xAxis: {
type: 'category',
data: ['item 1', 'item 2', 'item 3', 'item 4', 'item 5'],
},
yAxis: [
{
type: 'value',
name: 'Y-axis 1',
},
{
type: 'value',
name: 'Y-axis 2',
position: 'right', // Place the second y-axis on the right
},
],
series: [
{
name: 'Data Series 1',
type: 'bar',
data: [
{ value: 120, yAxisIndex: 0 }, // Use the first y-axis
{ value: 10000, yAxisIndex: 1 }, // Use the second y-axis
{ value: 150, yAxisIndex: 0 }, // Use the first y-axis
{ value: 12000, yAxisIndex: 1 }, // Use the second y-axis
{ value: 70, yAxisIndex: 0 }, // Use the first y-axis
],
Other series of configurations...
},
],
};

mw3dktmi

mw3dktmi2#

maybe that's what you are looking for - Demo Code

or without xAxis.data :

or use axis type='log' - Demo Code

相关问题