简体   繁体   English

确定(识别)dc.js 图表类型

[英]determine (identify) dc.js chart type

I'm looking for some solution to determine or identify existing dc.js chart types on the page.我正在寻找一些解决方案来确定或识别页面上现有的 dc.js 图表类型。 I need it to work properly with d3.tip.我需要它与 d3.tip 一起正常工作。 For different types of charts I use different javascript code.对于不同类型的图表,我使用不同的 javascript 代码。

As answered by Matt Traynham on gitter, there is nothing built-in to do this, but you can add a member when you create a chart, as long as it has a name that doesn't clash with the chart members正如 Matt Traynham 在 gitter 上回答的那样,没有任何内置功能可以做到这一点,但是您可以在创建图表时添加一个成员,只要它的名称与图表成员不冲突

var chart = dc.rowChart("#history");
chart.chartType = 'row';
chart.chartType; // "row"

PRs welcome!欢迎 PR!

chart.constructor.name

这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM