novus / nvd3

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

Line Chart y-axis label hidden on Live Code Examples page #2069

Open dennisvang opened 7 years ago

dennisvang commented 7 years ago

The Line Chart example on the Live Code part of the website (http://nvd3.org/livecode/index.html#codemirrorNav) has a label for the y-axis, but this label is hidden. I guess one fix would be to set e.g. nv.models.lineChart().margin({left: 100}).

u5surf commented 7 years ago

I suggest to use chart.yAxis.axisLabelDistance

nv.addGraph(function() {
  var chart = nv.models.lineChart()
    .useInteractiveGuideline(true)
    ;

  chart.xAxis
    .axisLabel('Time (ms)')
    .tickFormat(d3.format(',r'))
    ;

  chart.yAxis
    .axisLabel('Voltage (v)')
    .axisLabelDistance(40)
   .tickFormat(d3.format('.02f'))
    ;

  d3.select('#chart svg')
    .datum(data())
    .transition().duration(500)
    .call(chart)
    ;
  nv.utils.windowResize(chart.update);
  return chart;
});

https://stackoverflow.com/questions/17289403/nvd3-discretebarchart-y-axis-label