更改字体dateTimeLabel Highstock

问题描述 投票:1回答:1

如何从高库存图表中的工具提示(以红色突出显示)增加字体?

enter image description here

javascript highcharts
1个回答
1
投票

使用tooltip:headerFormat它会起作用

    tooltip: {
      headerFormat: '<span style="font-size:18px">{point.x:%A, %b %e, %Y}</span>'
    }

$(document).ready(function(){
    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function (data)    {
        // Create the chart
        
        var dataObject = {
            rangeSelector: {
                selected: 1,
                inputEnabled: $('#container').width() > 480
            },
            
            title: {
                text: 'AAPL Stock Price'
            },
            
            series: [{
                name: 'AAPL',
                data: data,
                tooltip: {
                    valueDecimals: 2
                }
            }],
            tooltip: {
            headerFormat: '<span style="font-size:18px">{point.x:%A, %b %e, %Y}</span>'
    },
            chart: {
                renderTo: 'container'
            }
        };
        
        var chart = new Highcharts.StockChart(dataObject);   
        //var chart = $('#container').highcharts('StockChart', dataObject);
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>

<div id="container" style="height: 400px; min-width: 310px"></div>
© www.soinside.com 2019 - 2024. All rights reserved.