d3.js - Extending c3js with d3js code -
i new c3js, apologies if question sounds basic. c3js library seems powerful yet there features in d3js not available in c3js plan use inside c3js code. has experience in using d3js code c3js or using d3js inside or c3js code. reference, plan use click functions present in d3js on visualizations built in c3js.
thanks
while can access c3 chart elements using classes c3 uses (you can find full list of classes in source @ https://github.com/masayuki0812/c3/blob/master/c3.js#l5754), wouldn't right way attach click handlers - reason being c3 charts rendered in layers , click event may not triggered because it's used layer comes above.
for instance, while
var chart = c3.generate({ data: { columns: [ ['data1', 30, 200, 100, 400, 150, 250], ['data2', 130, 100, 140, 200, 150, 50] ], type: 'bar' } }); d3.selectall('.' + c3.chart.internal.fn.class.bar + ':nth-child(2)').attr('display', 'none');
would way of hiding 2nd set of data points, can't use same attach click handler 2nd set of data points.
the right way use data.onclick c3 provides - see http://c3js.org/reference.html#data-onclick.
Comments
Post a Comment