Chart JS custom tooltip option?

后端 未结 7 761
野趣味
野趣味 2020-12-03 03:44

I am trying to build chart using Chart.Js. This chart.js has default option for tooltip, I want to make customized tooltip option. Is there a way to make it possible?

<
7条回答
  •  -上瘾入骨i
    2020-12-03 04:00

    You can check for tooltip css - http://www.chartjs.org/docs/#chart-configuration-tooltip-configuration

    tooltips: 
    {
    
        bodyFontColor: "#000000", //#000000
        bodyFontSize: 50,
        bodyFontStyle: "bold",
        bodyFontColor: '#FFFFFF',
        bodyFontFamily: "'Helvetica', 'Arial', sans-serif",
        footerFontSize: 50,
        callbacks: {
            label: function(tooltipItem, data) {
                    var value = data.datasets[0].data[tooltipItem.index];
                  if(tooltipItem.index == 0) {
                    return "";
                    }
                else if(tooltipItem.index == 1) {
                    return "";
                }
                else if(tooltipItem.index == 2) {
                    return "";
                }
                else {
                    return "";
                    }
            },
        },
    },
    

提交回复
热议问题