是否有比创建多条迹线更简单的图例创建方法?
例如,通过提供另一列将包含图例值的列?:
var trace = {
x: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
y: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
legend: [‘active’, ‘active’, ‘completed’, ‘completed’, ‘pending’, ‘pending’, ‘pending’,‘active’, ‘completed’, ‘active’],
};
Plotly.plot(‘chart’, [trace])