我正在验证导出的 PDF 上的类别与我的设置中显示的图表的比较。但是,我总是看到导出的图表中缺少一些类别名称。
如何将 xAxis 类别设置为空,我的意思是导出的 PDF 不包含导出的 PDF 中的一月、二月等类别。我这里有一个 fiddle http://jsfiddle.net/p9nt0he9/
$(function () {
$('#container').highcharts({
title: {
text: 'Exports a pdf with name: my-pdf'
},
credits: {
enabled: false
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}],
navigation: {
buttonOptions: {
enabled: false
}
}
});
// the button handler
$('#button').click(function () {
var chart = $('#container').highcharts();
chart.exportChart({
type: 'application/pdf',
filename: 'my-pdf',
xAxis: [],
});
});
});
谁能帮帮我吗?
最佳答案
您可以使用导出/图表选项,并在 xAxis/labels 中在格式化程序中返回空字符串。
exporting:{
chartOptions:{
xAxis:[{
labels:{
formatter:function(){
return '';
}
}
}]
}
},
示例:http://jsfiddle.net/p9nt0he9/1/
文档:http://api.highcharts.com/highcharts#exporting.chartOptions
关于javascript - Highcharts 导出图表 PDF 未显示所有类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29792273/