简体   繁体   中英

determine (identify) dc.js chart type

I'm looking for some solution to determine or identify existing dc.js chart types on the page. I need it to work properly with d3.tip. For different types of charts I use different javascript code.

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

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

PRs welcome!

chart.constructor.name

这对我有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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