Skip to content

Commit 0459735

Browse files
committed
refactor: refactor overlay module
1 parent b2688b9 commit 0459735

File tree

8 files changed

+230
-504
lines changed

8 files changed

+230
-504
lines changed

src/Chart.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ export default class ChartImp implements Chart {
712712

713713
createIndicator (value: string | IndicatorCreate, isStack?: boolean, paneOptions?: Nullable<PaneOptions>, callback?: () => void): Nullable<string> {
714714
const indicator = isString(value) ? { name: value } : value
715-
if (getIndicatorClass(indicator.name as string) === null) {
715+
if (getIndicatorClass(indicator.name) === null) {
716716
logWarn('createIndicator', 'value', 'indicator not supported, you may need to use registerIndicator to add one!!!')
717717
return null
718718
}
@@ -820,7 +820,7 @@ export default class ChartImp implements Chart {
820820
}
821821

822822
getOverlayById (id: string): Nullable<Overlay> {
823-
return this._chartStore.getOverlayStore().getInstanceById(id)
823+
return this._chartStore.getOverlayStore().getInstanceById(id)?.getOverlay() ?? null
824824
}
825825

826826
overrideOverlay (override: Partial<OverlayCreate>): void {

src/component/Indicator.ts

-5
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,6 @@ export interface Indicator<D = any> {
218218
* Calculation result
219219
*/
220220
result: D[]
221-
222-
/**
223-
* Others
224-
*/
225-
[key: string]: any
226221
}
227222

228223
export type IndicatorTemplate<D = any> = ExcludePickPartial<Omit<Indicator<D>, 'result'>, 'name' | 'calc'>

0 commit comments

Comments
 (0)