c3js / c3js/c3

Wrong y axis min/max for roteted charts

Open
#1,849 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Expected min/max Y: [0:150], actual: [-200, 350]

C3 version: 0.4.11
Browser: last Firefox or Chrome

Config for http://c3js.org/samples/chart_bar.html :

```
var chart = c3.generate({
data: {
columns: [["1", 70], ["2", 25], ["3", 10], ["4", 5]],
type: 'bar',
labels: {
show: true,
format: function (v, id, i, j) {
return "Some text " + i;
}
}
},
tooltip: {
show: false
},
axis: {
rotated: true,
x: {
show: false
},
y: {
min: 0,
max: 150
}
},
legend: {
show: false
},
size: {
width: 350,
height: 275
}
});

```

Maybe problem in c3_chart_internal_fn.getYDomain.
It returns `[yDomainMin - padding_bottom, yDomainMax + padding_top]`
where yDomainMin = 0, yDomainMax = 150, padding_bottom = -200, padding_top = 100.
Also this bug looks different on different browsers (my is chrome based) depends on labels font-family (labels width affect padding).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.