简体   繁体   English

我如何将Highcharts传奇的标题加粗?

[英]How do I unbold title of Highcharts' legend?

This is the API reference I found: https://api.highcharts.com/highcharts/legend.title.style.fontWeight 这是我找到的API参考: https : //api.highcharts.com/highcharts/legend.title.style.fontWeight

Title's fontWeight is set to bold by default. 标题的fontWeight默认情况下设置为bold I try setting it to normal or lighter . 我尝试将其设置为normallighter Neither produces compilation error but neither works. 都不会产生编译错误,但是都不会起作用。

legend: {
    title: {
        style: {
            fontWeight: 'lighter',
        }
    }
},

How do I change the fontWeight ? 如何更改fontWeight

Full code: 完整代码:

<!DOCTYPE html>
<html lang="en">

<html>
<head>
    <script src="https://code.highcharts.com/highcharts.js"></script>
</head>

<body>
    <div id="container"></div>
    <script>
        var scoreChart = Highcharts.chart('container', {
            chart: {
                type: 'scatter',
                zoomType: 'xy'
            },
            legend: {
                title: {
                    style: {
                        fontWeight: 'lighter',
                    }
                }
            },

            series: [{
                name: 'score',
                data: [[167.5, 59.0], [159.5, 49.2], [157.0, 63.0], [155.8, 53.6],
                    [170.0, 59.0], [159.1, 47.6],]
            },
            ]
        });
    </script>

</body>
</html>

To style legend , use itemStyle 要设置legend样式,请使用itemStyle

Stack snippet 堆栈片段

 var scoreChart = Highcharts.chart('container', { chart: { type: 'scatter', zoomType: 'xy' }, legend: { itemStyle: { fontWeight: 'lighter' } }, series: [{ name: 'score', data: [ [167.5, 59.0], [159.5, 49.2], [157.0, 63.0], [155.8, 53.6], [170.0, 59.0], [159.1, 47.6], ] }, ] }); 
 <script src="https://code.highcharts.com/highcharts.js"></script> <div id="container"></div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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