import { ComponentProps } from 'react' ; import { ChartType } from '../..' ; import { Color } from '../../../common/colors' ; import { Spec } from '../../../specs' ; import { SpecType } from '../../../specs/constants' ; import { specComponentFactory } from '../../../state/spec_factory' ; import { LabelAccessor , ValueFormatter } from '../../../utils/common' ; import { defaultGoalSpec } from '../layout/types/viewmodel_types' ; import { GoalSubtype } from './constants' ; alpha export interface BandFillColorAccessorInput { value : number ; index : number ; base : number ; target ? : number ; highestValue : number ; lowestValue : number ; aboveBaseCount : number ; belowBaseCount : number ; } alpha export type BandFillColorAccessor = ( input : BandFillColorAccessorInput ) => Color ; alpha export type GoalLabelAccessor = LabelAccessor < BandFillColorAccessorInput > ; alpha export interface GoalSpec extends Spec { specType : typeof SpecType . Series ; chartType : typeof ChartType . Goal ; subtype : GoalSubtype ; base : number ; target ? : number ; actual : number ; bands : number [ ] ; ticks : number [ ] ; bandFillColor : BandFillColorAccessor ; tickValueFormatter : GoalLabelAccessor ; labelMajor : string | GoalLabelAccessor ; labelMinor : string | GoalLabelAccessor ; centralMajor : string | GoalLabelAccessor ; centralMinor : string | GoalLabelAccessor ; angleStart : number ; angleEnd : number ; bandLabels : string [ ] ; tooltipValueFormatter : ValueFormatter ; } alpha export const Goal = specComponentFactory < GoalSpec > ( ) ( { specType : SpecType . Series , chartType : ChartType . Goal , } , { ... defaultGoalSpec , } ) ; public export type GoalProps = ComponentProps < typeof Goal > ;