c3js / c3js/c3

c3 JS chart data onclick event not firing off consistently

Open
#1,929 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Hi,
I am currently trying to add some onclick events to the c3 JS chart's data points, and then added some console.log printouts just to check if the function is being called.

I noticed that the function is either sometimes not being called or sometimes called with much delay.

Below is a sample code I have been working on:

this.cchart = c3.generate({
data: {
x: 'date',
columns: [ pointsDate, pointsValue ],
onmouseover: _.throttle(function(d, el) {
var xVal = moment(d.x).valueOf();
var yVal = d.value;
view.options.parentModel.copyTooltipInfo(xVal, yVal, tzDiff);
}, 100),
onmouseout: _.throttle(function(d) {
view.options.parentModel.copyTooltipInfo();
}, 100),
onclick: function(d, el) {
console.log("Chart point clicked");
console.log(d);
console.log(el);
}
}
...
}

Any ideas why this is happening? Your inputs are much needed and most welcome.

I am currently using the latest version of c3 JS code, taken from this page: https://github.com/c3js/c3.

Thanks!

-Cromwell

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.