Skip to content

Commit

Permalink
feat: indicator styles support merge
Browse files Browse the repository at this point in the history
  • Loading branch information
liihuu committed Aug 19, 2023
1 parent 9ce5e8e commit 4bb4d03
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/component/Indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { XAxis } from './XAxis'
import { YAxis } from './YAxis'

import { formatValue } from '../common/utils/format'
import { isValid } from '../common/utils/typeChecks'
import { isValid, merge } from '../common/utils/typeChecks'

import { ArcAttrs } from '../extension/figure/arc'
import { RectAttrs } from '../extension/figure/rect'
Expand Down Expand Up @@ -311,7 +311,7 @@ export default abstract class IndicatorImp<D = any> implements Indicator<D> {
this.visible = visible ?? true
this.minValue = minValue ?? null
this.maxValue = maxValue ?? null
this.styles = styles ?? null
this.styles = styles ?? {}
this.extendData = extendData
this.regenerateFigures = regenerateFigures ?? null
this.createTooltipDataSource = createTooltipDataSource ?? null
Expand Down Expand Up @@ -378,8 +378,8 @@ export default abstract class IndicatorImp<D = any> implements Indicator<D> {
}

setStyles (styles: Nullable<Partial<IndicatorStyle>>): boolean {
if (this.styles !== styles) {
this.styles = styles
if (styles !== null) {
merge(this.styles, styles)
return true
}
return false
Expand Down

0 comments on commit 4bb4d03

Please sign in to comment.