@blueprint-chart/lib 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,19 @@
1
- import { SortDirection } from '../enums';
1
+ import { SortDirection, SortMode } from '../enums';
2
2
  export declare function sortByValue<T>(items: readonly T[], value: (item: T, index: number) => number, direction: SortDirection | undefined): T[];
3
3
  export declare function labelTotal(series: readonly {
4
4
  values: number[];
5
5
  }[], index: number): number;
6
+ interface CategorySortOptions {
7
+ sortMode?: SortMode;
8
+ sortSeries?: string;
9
+ sortReverse?: boolean;
10
+ }
11
+ export declare function sortCategories(labels: readonly string[], series: readonly {
12
+ name: string;
13
+ values: number[];
14
+ }[], { sortMode, sortSeries, sortReverse }: CategorySortOptions): readonly string[];
15
+ export declare function withinGroupSlots(labels: readonly string[], series: readonly {
16
+ name: string;
17
+ values: number[];
18
+ }[]): (label: string, seriesName: string) => string;
19
+ export {};
@@ -15,3 +15,8 @@ export declare function computeStack(data: ChartData): d3.Series<Record<string,
15
15
  * Each category's magnitudes sum to 100, negatives below the baseline.
16
16
  */
17
17
  export declare function computeStack100(data: ChartData): d3.Series<Record<string, number>, string>[];
18
+ export declare function restackWithinGroups<T extends {
19
+ label: string;
20
+ y0: number;
21
+ y1: number;
22
+ }>(segments: readonly T[]): T[];
@@ -16,5 +16,9 @@ export declare function buildDotPlotRows(data: ChartData, resolved: ResolvedDotP
16
16
  rows: DotPlotRow[];
17
17
  dropped: DroppedRow[];
18
18
  };
19
- export declare function sortDotPlotRows(rows: DotPlotRow[], sortMode: SortMode | undefined, mode: DotPlotMode): DotPlotRow[];
19
+ export declare function percentChange(row: DotPlotRow): number;
20
+ export declare function sortDotPlotRows(rows: DotPlotRow[], { sortMode, sortReverse }: {
21
+ sortMode?: SortMode;
22
+ sortReverse?: boolean;
23
+ }, mode: DotPlotMode): DotPlotRow[];
20
24
  export {};
@@ -151,6 +151,8 @@ export interface ChartOptions {
151
151
  horizontalAxis?: AxisOptions;
152
152
  sort?: SortDirection;
153
153
  sortMode?: SortMode;
154
+ sortSeries?: string;
155
+ sortReverse?: boolean;
154
156
  colorizes?: ColorizeConfig[];
155
157
  highlights?: HighlightConfig[];
156
158
  colors?: string[];
@@ -181,6 +183,10 @@ export interface ChartOptions {
181
183
  seriesOverrides?: SeriesOverride[];
182
184
  displayAsPercentage?: boolean;
183
185
  showTotal?: boolean;
186
+ centerLabel?: string;
187
+ centerSlice?: string;
188
+ centerText?: string;
189
+ totalLabel?: string;
184
190
  showLabels?: boolean;
185
191
  showValues?: boolean;
186
192
  sliceMax?: number;
@@ -193,6 +199,7 @@ export interface ChartOptions {
193
199
  barGap?: number;
194
200
  connectedColumns?: boolean;
195
201
  connectionsOpacity?: number;
202
+ negativeColor?: string;
196
203
  stackMode?: StackMode;
197
204
  edgePadding?: boolean;
198
205
  waterfall?: boolean;
@@ -208,6 +215,7 @@ export interface ChartOptions {
208
215
  low?: string;
209
216
  high?: string;
210
217
  arrows?: ArrowDirection;
218
+ dotLabels?: 'both' | 'start' | 'end' | 'difference' | 'change';
211
219
  }
212
220
  export type ChartRenderer = (container: HTMLElement, data: ChartData, options: ChartOptions, transition?: boolean) => void;
213
221
  export interface ChartOptionDef {
@@ -271,6 +279,10 @@ export interface ChartTypeOptions {
271
279
  lineSymbolOpacity: string;
272
280
  displayAsPercentage: boolean;
273
281
  showTotal: boolean;
282
+ centerLabel: string;
283
+ centerSlice: string;
284
+ centerText: string;
285
+ totalLabel: string;
274
286
  showLabels: boolean;
275
287
  showValues: boolean;
276
288
  swapLabelValue: boolean;
@@ -279,11 +291,14 @@ export interface ChartTypeOptions {
279
291
  autoContrast: boolean;
280
292
  allowDarkMode: boolean;
281
293
  sortMode: SortMode;
294
+ sortSeries: string;
295
+ sortReverse: boolean;
282
296
  barBackground: boolean;
283
297
  barSeparators: boolean;
284
298
  barGap: string;
285
299
  connectedColumns: boolean;
286
300
  connectionsOpacity: string;
301
+ negativeColor: string;
287
302
  stackMode: string;
288
303
  stacked: boolean;
289
304
  stackPercent: boolean;
@@ -304,5 +319,6 @@ export interface ChartTypeOptions {
304
319
  low: string;
305
320
  high: string;
306
321
  arrows: ArrowDirection;
322
+ dotLabels: string;
307
323
  }
308
324
  export type ChartTypeOptionKey = keyof ChartTypeOptions;
package/dist/enums.d.ts CHANGED
@@ -149,9 +149,11 @@ export declare enum DotStyle {
149
149
  export declare enum SortMode {
150
150
  Total = "total",
151
151
  WithinGroups = "within-groups",
152
+ Series = "series",
152
153
  None = "none",
153
154
  Value = "value",
154
- Gap = "gap"
155
+ Gap = "gap",
156
+ Change = "change"
155
157
  }
156
158
  export declare enum LegendPosition {
157
159
  Top = "top",
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { shapeOf } from './recommendations/shape';
19
19
  export type { ChartRecommendation, RecommendationFitness, ColumnType, Intent, ShapeSignature } from './recommendations/types';
20
20
  export { getChartTypeDefaults, resolveChartTypeOptions } from './charts/resolve';
21
21
  export { resolveBarGapPadding, DEFAULT_BAR_GAP } from './charts/scale-helpers';
22
- export { resolvePalette, listPalettes } from './charts/palettes';
22
+ export { DEFAULT_COLORS, resolvePalette, listPalettes } from './charts/palettes';
23
23
  export type { PaletteEntry } from './charts/palettes';
24
24
  export { listThemes } from './charts/themes';
25
25
  export type { ThemeEntry } from './charts/themes';