label y-position for all-zero-valued graph
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.4k
- Avg merge
- 6d 16h
- Merged PRs (30d)
- 1
Description
https://github.com/c3js/c3/blob/98769492d07b6103bfc30a0254ccb1e1ec1cca50/src/text.js
getYForText function looks to make a decision for dropping the labels below bars for negative graphs, and treats the all-zero-values case as a negative bar graph
If you are graphing data that is always non-zero positive this can cause the labels to disappear behind the x-axis, I have looked around a bit and I can't see a way to override this decision through configuration
Reproduction code
http://jsfiddle.net/jaa7e1h4/
```
// label for zero values visible above x-axis
var chart = c3.generate({
data: {
columns: [
['data1', 1, 0, 0, 0, 0, 0]
],
labels: true,
type: 'bar'
}
});
```
http://jsfiddle.net/jaa7e1h4/1/
```
// change to all zeroes, no labels visible
var chart = c3.generate({
data: {
columns: [
['data1', 0, 0, 0, 0, 0, 0]
],
labels: true,
type: 'bar'
}
});
```
C3js version c3@0.4.11
Confirmed in Chrome, Firefox
Contributor guide
Assessment
This issue has not been assessed yet.