2 回答

TA貢獻(xiàn)1921條經(jīng)驗(yàn) 獲得超9個(gè)贊
您好,認(rèn)為下面的代碼片段會對您有所幫助:
chart: {
type: "line",
renderTo: "chart",
events: {
render(events) {
let chart = this;
if (chart.customButton) {
chart.customButton.destroy();
}
chart.customButton = chart.renderer
.button("custom button", 100, 40, () => {
console.log("clicked.....");
chart.exportChart({
type: "application/pdf",
filename: "line-chart"
});
})
.add();
}
}
}
在這里單擊按鈕,您可以實(shí)現(xiàn)導(dǎo)出。此處的示例導(dǎo)出 PDF。

TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超8個(gè)贊
exporting.buttons是僅在導(dǎo)出菜單中編輯按鈕的選項(xiàng):https ://api.highcharts.com/highcharts/exporting.buttons
要呈現(xiàn)自定義按鈕,請使用SVGRenderer功能:https ://api.highcharts.com/class-reference/Highcharts.SVGRenderer#button
您可以在渲染回調(diào)中添加這些按鈕- 在初始加載后和每次重繪后調(diào)用:https ://api.highcharts.com/highcharts/chart.events.render
添加回答
舉報(bào)