c3js / c3js/c3

clone y-domain for y2 and y2-domain for y if there is no data target

Open
#1,522 4 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

Hi,
there are user who want to have both axes showing the same data. One option would be to use max and min for axes to copy the scale of one axis but the calculation of min and max with the padding is not easy and in many situations there are no animations after static values are given.
So, i have made an enchanchement that clones the other axis-domain if there is no target. Look at the screenshoots

![clone-y-domain-01](https://cloud.githubusercontent.com/assets/11871137/12051521/511c2572-af05-11e5-89a9-05a2d2ad475c.png)
this one is if all data_values are given to y-axis. if i decide to show y2-axis it scales from 0 to 1 as standard. in this case i copy the domain from y-axis to get a scaling that is maybe more useful
![clone-y-domain-02](https://cloud.githubusercontent.com/assets/11871137/12051522/534acd76-af05-11e5-9ea8-1125469e8eb9.png)
if both axes have their targets the bahaviour is the same
![clone-y-domain-03](https://cloud.githubusercontent.com/assets/11871137/12051523/54bda8e0-af05-11e5-9466-17efe1bafa0a.png)
if i hide all data_values of y-axis there are no targets left and so y-axis copies the domain from y2-axis
![clone-y-domain-04](https://cloud.githubusercontent.com/assets/11871137/12051524/561a364a-af05-11e5-9021-f0f4ebeb499c.png)
if i hide all data_values of y2-axis there are no targets left and so y2-axis copies the domain from y-axis

one point is that it could be confusing for case 3 and 4. but if you use two axes you should be prepared for confusion.

my question is, is anyone interested in this enchanchment (is it an enchanchment ?) ?
this is only one line code change so I would make a pull request for it

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.