Search code examples
angularjsnvd3.jsangular-nvd3

display months name in angular NVD3 multicharts


I'm trying to display the months name to make a multi-chart graph that will analyze the data for this year and the previous one. I was trying to do that using ticks. here is a punker where i'm trying to do that, but I'm not able to display months name, it shows always January. is there a way to do it differently? which is the best way and how to fix that?

xAxis: {
    axisLabel: 'Months',
    showMaxMin: true,
    tickFormat: function(d) {
      return d3.time.format('%B')(new Date(d))
    },
    ticks:12,
    tickValues:['Jan','Fev','Mars','Avr','Mai','Juin','Juil','Aout','Sept','Oct','Nov','Dec']
  },

Solution

  • you can do that using tickformat, and to get that displayed in the tooltip you need to use the interactiveLayer options to get that correctly displayed. here is a working plunker.