[BUG] The horizontalBar chart skips the first value from dataset.
See original GitHub issueExpected Behavior
In the line chart (second dataset), the line should also be drawn for the first value, as it is in the horizontalBar chart(first dataset).
Current Behavior
In the line graph, the line is drawn from the second value, the horizontalBar graph is drawn from the first value. When I only draw a Gaussian curve, all points are drawn correctly. Inversion of histogram doesn’t help.
Possible Solution
Steps to Reproduce (for bugs)
https://codepen.io/krna/pen/ejzqwg
var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'horizontalBar', data: { labels: [0,1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15], datasets: [{ borderWidth: 1, backgroundColor: 'rgba(255, 99, 132,0.5)', borderColor: 'rgb(255, 99, 132)', data: [3,1,0,0,0,2,0 ,2,0,2,0,0,0,0,0,0] },{ type: 'line', fill: false, borderWidth: 1, data: [ { "x": 0.4175611241375584, "y": 0 }, { "x": 0.5959532140041752, "y": 1 }, { "x": 0.7859097829567998, "y": 2 }, { "x": 0.9576386017705346, "y": 3 }, { "x": 1.0781992198876187, "y": 4 }, { "x": 1.1216692215727766, "y": 5 }, { "x": 1.0781992198876187, "y": 6 }, { "x": 0.9576386017705346, "y": 7 }, { "x": 0.7859097829567998, "y": 8 }, { "x": 0.5959532140041752, "y": 9 }, { "x": 0.4175611241375584, "y": 10 }, { "x": 0.27033132329127463, "y": 11 }, { "x": 0.1617115734967744, "y": 12 }, { "x": 0.08938286189552247, "y": 13 }, { "x": 0.045649479432087706, "y": 14 }, { "x": 0.02154199016167806, "y": 15 } ], borderColor: 'rgb(54, 162, 235)', radius: 2 }] }, options: { scales: { yAxes: [{ categoryPercentage : 1, barPercentage: 1 }], xAxes: [{ type: 'linear', position: 'bottom', ticks: { stepSize: 1, min: 0, max: 4 } }] } } });
Context
I’m trying to draw a histogram with a gaussian curve.
Environment
- Chart.js version: 2.6.0, 2.7.2
- Browser name and version: Chrome 67.0.3396.99
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top GitHub Comments
Ok. This should be Chart.js config not a data. I suspected earlier that problem is bigger and the data is non-standardized. 😃
I wouldn’t expect that. Data looks perfectly valid, generated following deterministic formula… This is the screenshot of one segment of the graph on 300% zoom:
Haven’t managed to check this out because it’s already good enough 😁 Will post an update if I figure out what was the issue.