n3-charts / line-chart

Awesome charts for AngularJS.
http://n3-charts.github.io/line-chart/
MIT License
1.2k stars 180 forks source link

Make y2 axis shown only when y2 is used #526

Closed frankfralick closed 7 years ago

frankfralick commented 7 years ago

Hi! I was getting the y2 axis displayed in situations where it was not being specified in any series, and the y parameter of the axes object is being modified. I believe this is a bug and not the intent, but if it is please disregard this. If you take a look at the "y0 - y1" example you will see that the y2 axis is drawn, but no series targets it. If "axes: y: {something}" is defined, then you will get both y and y2 being drawn. This change corrects this. Thanks!

chaosmail commented 7 years ago

Hi @frankfralick I think this is a good idea, however it would change the default behavior of existing n3-charts installations. The y2 axis can easily be hidden via css, such as

.chart .y2-axis {
  display: none;
}

You could even hide the axis line and disply only the ticks via

.chart .y2-axis .domain {
  display: none;
}

I find this CSS styling really convenient and therfore vote for closing this PR. Please let me know if you have a different opinion and more arguments in favor of this feature.

Best, Christoph