novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.14k forks source link

X axis not displaying in discreteBar #392

Closed severa closed 9 years ago

severa commented 10 years ago

v: 1.1.15b The x-axis zero line is not displaying in discreteBarCharts.

The opacity of the x-axis line is controllable in the css file (line 226), however, even setting that to non-zero will not display the x-axis line if the grid lines in the chart are displayed because the svg element for the horizontal grids, which are part of the y-axis g element, are drawn on top of the x-axis line. This is a function of the code generally setting the x-axis first, then the y-axis.

It is easy to fix this by switching the order of the axis svg generation by moving line 3377 (x-axis creation) down 4 lines to below the y-axis creation, however, based on comments in the js, there seems to be some desire to change how axes displaying is controlled as well as some confusion about how to manage the zero line characteristics.

FWIW IMHO, being able to turn the axis lines on and off from the code would be preferable to CSS.

Note this issue likely exists for other graphs that use grid lines, though I did not test them all.

fernoftheandes commented 10 years ago

A stackoverflow question led me to this issue. Indeed, the x-axis line does not show in many of the ndv3 charts.

liquidpele commented 9 years ago

showXAxis() and showYAxis() options are available, cheers.

cloudeeo commented 9 years ago

Actually this does not work for the axis itself but only for the labels.

liquidpele commented 9 years ago

Try with latest 1.7 version... Seemed to work fine when I tested it.