From 3093ec943662671e0ba8e9b55f95c4435ee0006d Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Thu, 4 Jul 2019 16:04:11 +0200 Subject: [PATCH] chore: allows stackAsPercentage only for areas and bars --- src/lib/series/domains/y_domain.ts | 11 ++--------- src/lib/series/specs.ts | 12 ++++++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/lib/series/domains/y_domain.ts b/src/lib/series/domains/y_domain.ts index 546d87b9f0..a0d87175af 100644 --- a/src/lib/series/domains/y_domain.ts +++ b/src/lib/series/domains/y_domain.ts @@ -16,15 +16,8 @@ export type YDomain = BaseDomain & { }; export type YBasicSeriesSpec = Pick< BasicSeriesSpec, - | 'id' - | 'seriesType' - | 'yScaleType' - | 'groupId' - | 'stackAccessors' - | 'yScaleToDataExtent' - | 'colorAccessors' - | 'stackAsPercentage' ->; + 'id' | 'seriesType' | 'yScaleType' | 'groupId' | 'stackAccessors' | 'yScaleToDataExtent' | 'colorAccessors' +> & { stackAsPercentage?: boolean }; export function mergeYDomain( dataSeries: Map, diff --git a/src/lib/series/specs.ts b/src/lib/series/specs.ts index 5d7cf5e688..5a88632944 100644 --- a/src/lib/series/specs.ts +++ b/src/lib/series/specs.ts @@ -96,10 +96,6 @@ export interface SeriesAccessors { splitSeriesAccessors?: Accessor[]; /** An array of fields thats indicates the stack membership */ stackAccessors?: Accessor[]; - /** - * Stack each series in percentage for each point. - */ - stackAsPercentage?: boolean; /** An optional array of field name thats indicates the stack membership */ colorAccessors?: Accessor[]; } @@ -140,6 +136,10 @@ export type BarSeriesSpec = BasicSeriesSpec & { /** If true, will stack all BarSeries and align bars to ticks (instead of centered on ticks) */ enableHistogramMode?: boolean; barSeriesStyle?: CustomBarSeriesStyle; + /** + * Stack each series in percentage for each point. + */ + stackAsPercentage?: boolean; }; /** @@ -171,6 +171,10 @@ export type AreaSeriesSpec = BasicSeriesSpec & /** The type of interpolator to be used to interpolate values between points */ curve?: CurveType; areaSeriesStyle?: AreaSeriesStyle; + /** + * Stack each series in percentage for each point. + */ + stackAsPercentage?: boolean; }; interface HistogramConfig {