You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
825 B
33 lines
825 B
import { CoreSeries } from '@chartwerk/core'; |
|
import { BarSerie, SizeType } from '../types'; |
|
|
|
import * as _ from 'lodash'; |
|
|
|
const DEFAULT_MIN_ANNOTATION_SIZE = 6; //px |
|
const DEFAULT_MAX_ANNOTATION_SIZE = 10; //px |
|
|
|
const BAR_SERIE_DEFAULTS = { |
|
annotation: { |
|
enable: false, |
|
color: undefined, |
|
size: { |
|
esimated: { value: undefined, type: (SizeType.PERCENT as SizeType.PERCENT) }, |
|
max: DEFAULT_MAX_ANNOTATION_SIZE, |
|
min: DEFAULT_MIN_ANNOTATION_SIZE, |
|
} |
|
}, |
|
color: undefined, |
|
opacity: 1, |
|
}; |
|
|
|
export class BarSeries extends CoreSeries<BarSerie> { |
|
|
|
constructor(series: BarSerie[]) { |
|
super(series, BAR_SERIE_DEFAULTS); |
|
} |
|
|
|
// move to parent |
|
public getSerieByTarget(target: string): BarSerie | undefined { |
|
return _.find(this.visibleSeries, serie => serie.target === target); |
|
} |
|
}
|
|
|