Skip to content

Commit

Permalink
修改绘图工具绘制刷新问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zcZhang123 committed Oct 28, 2019
1 parent b9d035a commit 3225c8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/kline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default {
klineData: null,
coinType: "",
watchLoading: false,
loadingTime: 0
loadingTime: 0,
sourceCanvas: null
};
},
props: {
Expand Down Expand Up @@ -94,6 +95,7 @@ export default {
this.coinType = this.chartDataObj.coinType;
} else {
this.kline.updateOption(data, this.currentCycle);
this.test(this.sourceCanvas);
}
}
} else {
Expand Down Expand Up @@ -152,6 +154,15 @@ export default {
this.dispose();
},
methods: {
test(sourceCanvas) {
if (sourceCanvas) {
this.sourceCanvas = sourceCanvas;
let kline = document.getElementById("kline");
let canvas = kline.firstChild.firstChild;
let ctx = canvas.getContext("2d");
ctx.drawImage(this.sourceCanvas, 0, 0);
}
},
init(clear) {
this.refreshKline = true;
this.kline.initChart(this.$refs.klineRef, clear);
Expand Down
2 changes: 2 additions & 0 deletions src/components/klineChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,8 @@ export default {
mouseUpCanvas() {
this.toolbarType = "";
this.showDrawCanvas = false;
let c = document.getElementById("drawToolCanvas");
this.$refs.candle.test(c);
},
// 绘制写字板
drawTablet() {
Expand Down

0 comments on commit 3225c8e

Please sign in to comment.