从 plotly javascript 中提取所有属性 [英] extract all attributes from plotly javascript
本文介绍了从 plotly javascript 中提取所有属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何提取 JavaScript 绘图中使用的所有属性?
How to extract all the attributes being used in a plotly JavaScript plot?
例如,我在此处绘制了散点图.如何提取data
和layout的完整属性信息
正在使用?
For example, I draw a scatter plot at here. How to extract the full attribute information of data
and layout
being used?
推荐答案
对 newPlot
的调用将返回一个 Promise
,当它完成时解析为新的情节.一旦这个承诺得到解决,你就可以得到你想要的属性的值.
The call to newPlot
will return a Promise
that resolves to the new plot when it is complete. You can get the values of the attributes you want once this promise has resolved.
Plotly.newPlot('myDiv', data, layout).then(plot => {
console.log(plot.data);
console.log(plot.layout);
console.log(plot._fullLayout);
});
这篇关于从 plotly javascript 中提取所有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文