我正在尝试将第二个类别添加到x轴,以使其看起来像按类别分组。 由plotly提供的示例不显示此选项。有没有人尝试过双重类别
var trace1 = {
x: ['A12', 'BC2', 109, '12F', 215, 304],
y: [1, 6, 3, 5, 1, 4],
mode: 'markers',
type: 'bar',
name: 'Team A',
text: ['Apples', 'Pears', 'Peaches', 'Bananas', 'Pineapples', Cherries'],
};
var data = [ trace1 ];
var layout = {
xaxis: {
type: 'category',
title: 'Product Code',
},
yaxis: {
range: [0, 7],
title: 'Number of Items in Stock'
},
title:'Inventory'
};
Plotly.plot('myDiv', data, layout);
https://plot.ly/javascript/axes/
期望的结果(样本图像) -