我想在 html 页面上创建一个自定义按钮,就像 highcharts 上的按钮一样。但我的页面上也有一张表格。现在我想要该按钮将 highchart + table 导出到 pdf 文件。我的代码包括:
function DrawPieChart(series)
{
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: 1, //null,
plotShadow: false,
backgroundColor: {
linearGradient: [50, 0, 100, 500],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(0, 00, 0)']
]
}
},
title: {
text: 'Matched and Unmatched Regions',
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
exportButton: {
enabled: true
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
type: 'pie',
name: 'Percentage',
data: series
}]
});
图表上的内置按钮仅导出饼图,我需要将所有数据导出为pdf。这就是为什么我想以这种方式完成事情。对此有什么建议或指导吗?
最佳答案
您不需要另一个按钮。 Highcharts
上有一个选项可将您的数据表包含在页面中:DEMO
此外,您应该在发布问题之前进行搜索:HERE
但是,如果您的表格与您的图表无关(极不可能),那么这将是一个问题,因为 Highcharts
上的导出功能与他们的服务器配合使用,它发送数据并带来返回 JPEG
或 PDF
文件。因此,如果您想要导出与图表无关的另一个表格,我认为您必须深入研究它的 js
文件。
关于javascript - 如何使用asp.net访问highcharts中内置按钮的功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28124757/