我的组织使用 HiQPdf 从 .Net MVC Razor 视图创建 PDF。我想在视图/pdf 中包含一个使用 Chart.js 库的图表。问题是,当从视图呈现 pdf 时,图表不会显示在页面上。该图表在呈现为视图时显示良好。
这是 chart.js 代码:
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: '# of Complaints',
data: data,
backgroundColor: 'rgba(11, 73, 150, 1)',
borderColor: 'rgba(11, 73, 150, 1)',
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
precision: 0,
fontSize: 18,
fontColor: '#000'
}
}],
xAxes: [{
ticks: {
fontSize: 18,
fontColor: '#000'
}
}]
},
responsive: false
}
});