我正在使用外部按鈕來導出圖表。當我進入註釋模式並執行導出時,圖表會通過註釋導出。但是當圖表重新加載時,註釋模式不會恢復。Amchart註釋。從註釋模式返回正常模式
有人可以讓我知道如何從註釋返回到正常模式。使用菜單評論家
menuReviver: function (item, li) {
if (item.format === "XLSX" || item.format === "JSON") {
li.style.display = "none";
}
$(li).click(function() {
if (item.action == "draw") {
$("#chart_annotations").val(1);
}
if (item.action == "cancel") {
$("#chart_annotations").val(0);
}
});
return li;
}
現在在導出圖表圖像使用$
if (chart.export.drawing.buffer.enabled === true) {
// Exporting the annotated chart with out "
//chart.export.capture"
chart.export.toPNG({}, function (data) {
chartimage.postImageData(data, chart_image_name)
});
} else {
chart.export.capture({
// action: "draw"
}, function() {
this.toPNG({
}, function (data) {
images.push({
"image": data,
"fit": [523.28, 769.89]
});
pending--;
if (pending === 0) {
chart.export.toPNG({
content: images
}, function (data) {
chartimage.postImageData(data, chart_image_name)
});
}
});
});
}
}
看看這裏:https://www.amcharts.com/kbase/using-export-api-functions-dynamically-save-load-chart-annotations/ – martynasma
謝謝 - Martynasma。但是這個鏈接並沒有說如何恢復到正常模式。我需要像chart.export.drawing.buffer.enabled = false。更具體地說,我需要手動觸發註釋取消選項。有任何想法嗎? – balu
剛剛發佈了另一個示例:https://www.amcharts.com/kbase/toggling-export-annotation-mode/將發佈爲其他人看到的SO答案。 – martynasma