简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM