Frage

I'm using NVD3 ver 3.1.7 for generating pieChart.

Everything works perfect except the chart labels. If the label value is of very low percentage, it does not appear. I want to make it visible irrespective of its value.

This is my code.

nv.addGraph(function() {
  var chart = nv.models.pieChart()
      .x(function(d) { return d.label })
      .y(function(d) { return d.value })
      .showLabels(true);

    d3.select("#chart svg")
        .datum(data)
      .transition().duration(1200)
        .call(chart);

  return chart;
});

Help would highly be appreciated.

War es hilfreich?

Lösung

I just managed to resolve this issue.

In nvd3 pieChart, there is a parameter

.labelThreshold(.05)

which sets percentage for chart labels to display or hide. By default this is set to

.02 => 2%.

I increased it to

.05 => 5%

which solved my problem.

Andere Tipps

You can use this option also.

.labelSunbeamLayout(true)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top