【发布时间】:2015-09-03 12:37:43
【问题描述】:
我正在使用 c3 图表,当我单击栏并双击其他内容时,我需要显示工具提示。
c3也有onclick
data: {
columns: [],
onclick: function(d, i) {
//dosth
},
}
找不到任何用于双击的资源。 有什么想法吗?
更新: 在我的html中
<c3-chart config="MyChart"></c3-chart>
$scope.MyChart= {
data: {
columns: [],
type: 'bar',
}
}
$scope.MyChart.internal.main.selectAll('.' + c3.chart.internal.fn.CLASS.eventRect).on('dblclick', function (d) {
var $$ = chart.internal;
$$.main.selectAll('.' + c3.chart.internal.fn.CLASS.circle).each(function (d) {
if ($$.isWithinShape(this, d)) {
// event handling
alert(d.value);
}
});
})
有两个问题 1. 我收到 TypeError: Cannot read property 'main' of undefined 2.怀疑这适用于栏,因为它搜索圆圈以启动双击
【问题讨论】: