twitter-bootstrap 如何将Highchart的字体系列更改为Bootstrap css默认字体系列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30050681/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change the font family of Highchart to Bootstrap css default font family
提问by fatCop
I want to change the font of title, data labeland tooltipto Bootstrap default default font in the pie chart (I'm using Highchart library to show the chart). I'm How can I change these? Tried to add fontFamily but it didn't work.
我想将饼图中的标题、数据标签和工具提示的字体更改为 Bootstrap 默认默认字体(我使用 Highchart 库来显示图表)。我如何改变这些?尝试添加 fontFamily 但没有用。
var chart = new Highcharts.Chart({
chart: {
renderTo: $(element).attr('id'),
backgroundColor: '#F8F8F8'
},
title: {
text: "Space Used by Users",
fontFamily: 'Helvetica'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '{point.name}: {point.sizeText}',
style: {
fontSize: '11px'
}
},
showInLegend: true
}
},
credits: {
enabled: false
},
tooltip: {
pointFormat: '{series.name}: <b>{point.sizeText}</b>'
},
series: [{
type: 'pie',
data: [
{
name: 'Personal Usage',
y: scope.item.personalUsage,
sizeText: scope.item.personalUsageSizeText
},
{
name: 'Shared Usage',
y: scope.item.sharedUsage,
sizeText: scope.item.sharedUsageSizeText
}
]
}]
});
How to change the font to default bootstrap?
如何将字体更改为默认引导程序?
回答by Sharath Daniel
You are only setting the font for the chart title. The below code sets the font globally for the pie chart.
您只是在设置图表标题的字体。以下代码为饼图全局设置字体。
Highcharts.setOptions({
chart: {
style: {
fontFamily: 'Helvetica'
}
}
});

