第一次与
highcharts-vue
.
我有以下全局图表选项,我将其导入到我的
app.js
。在这里,我在导出菜单中添加了一个按钮,以便
download CSV / XLSX
功能,利用
maatwebsite/laravel-excel
,因为最终导出将包括图表上显示的其他列(而不仅仅是通过其CSV/XSLX插件下载图表数据)。
我想将网址传递到图表上的导出按钮下拉列表中,但我没有成功。如何将prop(数据请求的目标url)传递给此配置?
我在一个页面上有多个图表实例,每个实例都需要自己的目标url。
欢迎提出任何建议。
export const highChartConfig = function(page) {
return {
credits: {
enabled: false
},
title: {
align: 'center',
style: {
color: "#4B5563",
fontSize: "16px",
fontWeight: "300",
},
},
exporting: {
buttons: {
contextButton: {
menuItems: [{
textKey: 'printChart',
onclick: function () {
this.print();
}
}, {
separator: true
},{
textKey: 'downloadCSV',
onclick: function () {
// THIS PROP I WOULD LIKE TO PASS TO THIS POINT. I GET UNDEFINED HERE
console.log(this.downloadCsvRoute)
if (this.downloadCsvRoute && this.downloadCsvRoute != '') {
axios.get(this.downloadCsvRoute)
}
}
}]
}
}
},
}
}