简体   繁体   English

更改Highcharts字体大小

[英]Changing Highcharts font size

I'm looking at using HighCharts for a webpage, specifically: 我正在考虑将HighCharts用于网页,特别是:

http://www.highcharts.com/demo/column-basic/dark-green http://www.highcharts.com/demo/column-basic/dark-green

However, the font sizes are too small. 但是,字体太小。 I've tried adding: 我试过添加:

legend: {
        itemStyle: {
            color: '#000000',
            fontWeight: 'bold',
            fontSize: '15px'
        }

to my js file that the site provided but this doesn't result in a font size change. 到我的网站提供的js文件,但这不会导致字体大小更改。 Additionally I would also like to increase the size of the key (where it states Tokyo, New York, London, Berlin). 此外,我还想增加密钥的大小(它指的是东京,纽约,伦敦,柏林)。 This is my first time using Highcharts and I've been doing research for a couple hours now and I can't seem to find the answer. 这是我第一次使用Highcharts而且我已经做了几个小时的研究,我似乎无法找到答案。 Any help would be much appreciated! 任何帮助将非常感激!

For legend font size, your code is working perfect. 对于图例字体大小,您的代码工作正常。 Here is working demo . 这是工作演示

and for X-axis and Y-axis,put the font size in (x-Axis/y-Axis)->labels->style object: Here is the sample : 对于X轴和Y轴,将字体大小放在(x-Axis / y-Axis) - > labels-> style对象中:以下是示例:

 xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            labels: {
                style: {
                    color: 'red',
                    fontSize:'15px'
                }
            }
        },

Demo : http://jsfiddle.net/4VznG/ 演示: http//jsfiddle.net/4VznG/

I was having an issue setting fontSize of my x-Axis labels. 我在设置x-Axis标签的fontSize时遇到了问题。 Setting it using font in the labels worked for me: 使用标签中的字体设置它对我有用:

xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        labels: {
            style: {
                color: 'red',
                font: '13px Arial, sans-serif'
            }
        }
    },
xAxis: {
        categories: ['Climate Change', 'Marketing', 'Development', 'Customer Support',
                'Information Technology', 'Administration'],
        tickmarkPlacement: 'on',
        lineWidth: 0,
        labels: {

            style: {
                fontSize: '14px',
                fontFamily: 'Verdana, sans-serif',

            }}
    },

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

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