|
|
@ -25,6 +25,12 @@ export const CORE_SERIE_DEFAULTS = { |
|
|
|
color: undefined, |
|
|
|
color: undefined, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export enum Extremum { |
|
|
|
|
|
|
|
MIN = 'min', |
|
|
|
|
|
|
|
MAX = 'max', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class CoreSeries<T extends Serie> { |
|
|
|
export class CoreSeries<T extends Serie> { |
|
|
|
_series: Array<T> = []; |
|
|
|
_series: Array<T> = []; |
|
|
|
|
|
|
|
|
|
|
@ -99,50 +105,76 @@ export class CoreSeries<T extends Serie> { |
|
|
|
return this.visibleSeries.filter(serie => serie.yOrientation = yAxisOrientation.RIGHT); |
|
|
|
return this.visibleSeries.filter(serie => serie.yOrientation = yAxisOrientation.RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get minValueY(): number { |
|
|
|
get areSeriesForY1Exist(): boolean { |
|
|
|
|
|
|
|
return this.rightYRelatedSeries.length > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get areSeriesForYExist(): boolean { |
|
|
|
|
|
|
|
return this.leftYRelatedSeries.length > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get minValueY(): number | undefined { |
|
|
|
return lodashMin( |
|
|
|
return lodashMin( |
|
|
|
this.leftYRelatedSeries.map( |
|
|
|
this.leftYRelatedSeries.map( |
|
|
|
serie => lodashMinBy<number[]>(serie.datapoints, dp => dp[1])[1] |
|
|
|
serie => { |
|
|
|
|
|
|
|
const mins = lodashMinBy<number[]>(serie.datapoints, dp => dp[1]); |
|
|
|
|
|
|
|
return !lodashIsNil(mins) ? mins[1] : undefined; |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get maxValueY(): number { |
|
|
|
get maxValueY(): number | undefined { |
|
|
|
return lodashMax( |
|
|
|
return lodashMax( |
|
|
|
this.leftYRelatedSeries.map( |
|
|
|
this.leftYRelatedSeries.map( |
|
|
|
serie => lodashMaxBy<number[]>(serie.datapoints, dp => dp[1])[1] |
|
|
|
serie => { |
|
|
|
|
|
|
|
const maxs = lodashMaxBy<number[]>(serie.datapoints, dp => dp[1]); |
|
|
|
|
|
|
|
return !lodashIsNil(maxs) ? maxs[1] : undefined; |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get minValueX(): number { |
|
|
|
get minValueX(): number | undefined { |
|
|
|
return lodashMin( |
|
|
|
return lodashMin( |
|
|
|
this.visibleSeries.map( |
|
|
|
this.visibleSeries.map( |
|
|
|
serie => lodashMinBy<number[]>(serie.datapoints, dp => dp[0])[0] |
|
|
|
serie => { |
|
|
|
|
|
|
|
const mins = lodashMinBy<number[]>(serie.datapoints, dp => dp[0]); |
|
|
|
|
|
|
|
return !lodashIsNil(mins) ? mins[0] : undefined; |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get maxValueX(): number { |
|
|
|
get maxValueX(): number | undefined { |
|
|
|
return lodashMax( |
|
|
|
return lodashMax( |
|
|
|
this.visibleSeries.map( |
|
|
|
this.visibleSeries.map( |
|
|
|
serie => lodashMaxBy<number[]>(serie.datapoints, dp => dp[0])[0] |
|
|
|
serie => { |
|
|
|
|
|
|
|
const maxs = lodashMaxBy<number[]>(serie.datapoints, dp => dp[0]); |
|
|
|
|
|
|
|
return !lodashIsNil(maxs) ? maxs[0] : undefined; |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get minValueY1(): number { |
|
|
|
get minValueY1(): number | undefined { |
|
|
|
return lodashMin( |
|
|
|
return lodashMin( |
|
|
|
this.rightYRelatedSeries.map( |
|
|
|
this.rightYRelatedSeries.map( |
|
|
|
serie => lodashMinBy<number[]>(serie.datapoints, dp => dp[1])[1] |
|
|
|
serie => { |
|
|
|
|
|
|
|
const mins = lodashMinBy<number[]>(serie.datapoints, dp => dp[1]); |
|
|
|
|
|
|
|
return !lodashIsNil(mins) ? mins[1] : undefined; |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get maxValueY1(): number { |
|
|
|
get maxValueY1(): number | undefined { |
|
|
|
return lodashMax( |
|
|
|
return lodashMax( |
|
|
|
this.rightYRelatedSeries.map( |
|
|
|
this.rightYRelatedSeries.map( |
|
|
|
serie => lodashMaxBy<number[]>(serie.datapoints, dp => dp[1])[1] |
|
|
|
serie => { |
|
|
|
|
|
|
|
const maxs = lodashMaxBy<number[]>(serie.datapoints, dp => dp[1]); |
|
|
|
|
|
|
|
return !lodashIsNil(maxs) ? maxs[1] : undefined; |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|