jeudi 16 juin 2016

NVD3 / D3.js making xAxis string from date format


I'm working on this fiddle example. I had difficult time changing x-Axis value to string(ex: Apple, IBM.. ) I look into .tickFormat but still no luck

Here fiddle example

chart.xAxis
  .tickFormat(function(d) {
      var dx = testdata[0].values[d] && testdata[0].values[d].x || 0;
      return dx ? d3.time.format('%x')(new Date(dx)) : '';
      })
  .showMaxMin(false)
  .axisLabel("X-axis Label");

Aucun commentaire:

Enregistrer un commentaire