So passen Sie das Format des Y-Werts in NVD3.js von Sekunden bis Min./Sek. An
Ich versuche, das Diagramm mit Daten in folgendem Format zu zeichnen:
[
{'label':'0', 'seconds':1094},
{'label':'1', 'seconds':1096},
{'label':'2', 'seconds':1112},
...
]
und das Ergebnis sieht so aus:
Es sieht gut aus und die Frage ist:Wie kann das Format der Anzeige des Y-Werts angepasst werden?:
AKTUALISIEREN: Der Code, der das Diagramm erstellt
nv.addGraph(function() {
var chart = nv.models.multiBarHorizontalChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.margin({top: 30, right: 20, bottom: 50, left: 20})
.showValues(true) //Show bar value next to each bar.
.tooltips(false) //Show tooltips on hover.
.transitionDuration(350)
.showControls(true); //Allow user to switch between "Grouped" and "Stacked" mode.
chart.yAxis
.tickFormat(d3.format(',.0f'));
d3.select('#chart1 svg')
.datum(jsonData)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});