question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] The horizontalBar chart skips the first value from dataset.

See original GitHub issue

Expected 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. hisogram with curve only curve

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:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
krnacommented, Nov 13, 2018

Ok. This should be Chart.js config not a data. I suspected earlier that problem is bigger and the data is non-standardized. 😃

0reactions
milosodaloviccommented, Nov 13, 2018

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: screenshot

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pgfplots: Error bars ignore missing data
The data is provided as comma separated values. The first column contains the x axis the rest is to be plotted against. Columns...
Read more >
Missing bar/value on SSRS bar chart
Made sure there were NO chart or dataset filters set and the chart is not in a table or anything else that has...
Read more >
Bar Chart
A bar chart provides a way of showing data values represented as vertical bars. It is sometimes used to show trend data, and...
Read more >
Skip Zero Value Rows on Bar Chart - microsoft excel
I have seen how to do this in a Stacked Bar Chart, but that's not what I want. The chart can either be...
Read more >
Using bar charts - Amazon QuickSight
This is an image of a multi-measure bar chart. Clustered - a clustered bar chart shows values for a single measure for a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found