猿问

如何更改 Highchart 工具提示字体系列

我想改变highchart的字体。我怎样才能改变这些?更改了 x 轴和 y 轴标签,但我无法更改工具提示字体


Highcharts.chart('container', {


    chart: {

        scrollablePlotArea: {

            minWidth: 700

        },

        style: {

            fontFamily: 'Bonbon'

       

        }

    },


    data: {

        csvURL: 'https://cdn.jsdelivr.net/gh/highcharts/highcharts@v7.0.0/samples/data/analytics.csv',

        beforeParse: function (csv) {

            return csv.replace(/\n\n/g, '\n');

        }

    },


    title: {

        text: 'Daily sessions at www.highcharts.com'

    },


    subtitle: {

        text: 'Source: Google Analytics'

    },


    xAxis: {

        tickInterval: 7 * 24 * 3600 * 1000, // one week

        tickWidth: 0,

        gridLineWidth: 1,

        labels: {

            align: 'left',

            x: 3,

            y: -3

        }

    },


    yAxis: [{ // left y axis

        title: {

            text: null

        },

         tooltip: {

        

        backgroundColor: null,

        borderWidth: 0,

        shadow: false,

        useHTML: false,

        style: {

            padding: 0

        }

    },

        labels: {

            align: 'left',

            x: 3,

            y: 16,

            format: '{value:.,0f}'

        },

        showFirstLabel: false

    }, { // right y axis

        linkedTo: 0,

        gridLineWidth: 0,

        opposite: true,

        title: {

            text: null

        },

        labels: {

            align: 'right',

            x: -3,

            y: 16,

            format: '{value:.,0f}'

        },

        showFirstLabel: false

    }],


    legend: {

        align: 'left',

        verticalAlign: 'top',

        borderWidth: 0

    },


    tooltip: {

        shared: true,

        crosshairs: true

    },

天涯尽头无女友
浏览 169回答 3
3回答

慕仙森

如果工具提示 useHTML 为 true 那么.highcharts-tooltip > span{font-family: Bonbon !important;}

MM们

对于工具提示,你应该使用这个:.highcharts-tooltip > text > tspan {font-family: Bonbon !important;}
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答