Skip to content

Commit

Permalink
refactor: refactor overlay module
Browse files Browse the repository at this point in the history
  • Loading branch information
liihuu committed Jun 7, 2024
1 parent b2688b9 commit 0459735
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 504 deletions.
4 changes: 2 additions & 2 deletions src/Chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ export default class ChartImp implements Chart {

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

getOverlayById (id: string): Nullable<Overlay> {
return this._chartStore.getOverlayStore().getInstanceById(id)
return this._chartStore.getOverlayStore().getInstanceById(id)?.getOverlay() ?? null
}

overrideOverlay (override: Partial<OverlayCreate>): void {
Expand Down
5 changes: 0 additions & 5 deletions src/component/Indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ export interface Indicator<D = any> {
* Calculation result
*/
result: D[]

/**
* Others
*/
[key: string]: any
}

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

0 comments on commit 0459735

Please sign in to comment.