Bubble getting cut off in Chart.js -
i'm having issue last bubble in chart cuts off. need way of extending chart entire circle displayed. i've tried adding value end, adjusting padding. nothing seems work. unfortunately, chart js documention on bubble charts severely lacking well.
var randomscalingfactor = function() { return (math.random() > 0.5 ? 1.0 : -1.0) * math.round(math.random() * 100); }; var randomcolorfactor = function() { return math.round(math.random() * 255); }; var randomcolor = function() { return 'rgba(' + randomcolorfactor() + ',' + randomcolorfactor() + ',' + randomcolorfactor() + ',.7)'; }; var bubblechartdata = { animation: { duration: 10000 }, datasets: [{ label: "my first dataset", backgroundcolor: randomcolor(), data: [ { x: 10, y: 0, r: math.abs(randomscalingfactor()) / 5, }, { x: 20, y: 0, r: math.abs(randomscalingfactor()) / 5, }, { x: 30, y: 0, r: math.abs(randomscalingfactor()) / 5, }, { x: 40, y: 0, r: math.abs(randomscalingfactor()) / 5, }, { x: 50, y: 0, r: math.abs(randomscalingfactor()) / 5, }, { x: 60, y: 0, r: math.abs(randomscalingfactor()) / 5, }, { x: 70, y: 0, r: 30, }] }] }; var ctx = document.getelementbyid('chart').getcontext('2d'); var chart = new chart(ctx, { type: 'bubble', data: bubblechartdata })
jsfiddle: https://jsfiddle.net/3dog0bec/
i solved issue modifying xaxes ticks min , max. worked because have set number of data display, set values 10 less first data point , 10 more last.
var chart = new chart(ctx, { type: 'bubble', data: bubblechartdata, options: { scales: { xaxes: [ { ticks: { min: -10, max: 100 } }] } } });
Comments
Post a Comment