learntech
learntech

Reputation: 133

Line Chart - Y Axis value not showing in tooltip

Hi I am using Angular NVD3 line chart. I am getting decimal value for Y Axis. In tickFormat of Y axis, I am changing it to integer format.

Now, the Y axis value in the tooltip not showing up. if the value is integer then only it's showing up.

I tried to use tooltip valueFormatter like below in my chart option -

tooltip: {
            valueFormatter: function (d, i){
                return d3.format('.02f')(val);
            }
        }

but it's not getting called. Any idea how to show value in tooltip if the tickFormat is different than value.

Upvotes: 0

Views: 247

Answers (1)

learntech
learntech

Reputation: 133

I fixed my issue by using below option..

interactiveLayer: {
            tooltip: {
                valueFormatter:  function (d, i){
                  return d3.format('.02f')(val);
                }
            }
        }

I am not sure why there are two tooltip options. one inside interactiveLayer and another outside. it's pretty confusing. Anyways, it worked for me.

Upvotes: 0

Related Questions