Skip to content

Commit 5a9ee3f

Browse files
committed
feat: removeHtml supports batch id.
1 parent 7c4b9a3 commit 5a9ee3f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/widget/Widget.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,14 @@ export default class Widget {
9191
*/
9292
removeHtml (id) {
9393
if (id) {
94-
const html = this._htmls.get(id)
95-
if (html) {
96-
this._element.removeChild(html)
97-
this._htmls.delete(id)
98-
}
94+
const ids = [].concat(id)
95+
ids.forEach(htmlId => {
96+
const html = this._htmls.get(htmlId)
97+
if (html) {
98+
this._element.removeChild(html)
99+
this._htmls.delete(htmlId)
100+
}
101+
})
99102
} else {
100103
this._htmls.forEach(html => {
101104
this._element.removeChild(html)

types/Chart.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export declare interface Chart {
6363
createTag(tag: Tag | Tag[], paneId?: string): void;
6464
removeTag(paneId?: string, tagId?: string | string[]): void;
6565
createHtml(html: HTML, paneId?: string): string | null;
66-
removeHtml(paneId?: string, tagId?: string | string[]): void;
66+
removeHtml(paneId?: string, htmlId?: string | string[]): void;
6767
scrollByDistance(distance: number, animationDuration?: number): void;
6868
scrollToRealTime(animationDuration?: number): void;
6969
scrollToDataIndex(dataIndex: number, animationDuration?: number): void;

0 commit comments

Comments
 (0)