@blueprint-chart/lib 2.12.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,6 +1,7 @@
1
- import { LineSymbolConfig } from './types';
1
+ import { ChartOptions, LineSymbolConfig } from './types';
2
2
  import * as d3 from 'd3';
3
3
  export declare function shouldShowSymbol(index: number, total: number, showOn: LineSymbolConfig['showOn']): boolean;
4
+ export declare function shouldShowValueLabel(index: number, total: number, categoryIndex: number, points: ChartOptions['valueLabelPoints'], every?: number): boolean;
4
5
  export declare function renderLineSymbols(parent: d3.Selection<SVGGElement, unknown, null, undefined>, points: {
5
6
  cx: number;
6
7
  cy: number;
@@ -5,8 +5,7 @@ export interface ArcLabelDatum {
5
5
  startAngle: number;
6
6
  endAngle: number;
7
7
  color: string;
8
- percentage?: number;
9
- displayAsPercentage?: boolean;
8
+ valueText: string;
10
9
  showLabel?: boolean;
11
10
  showValue?: boolean;
12
11
  }
@@ -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[];
@@ -4,3 +4,4 @@ export interface ThemeEntry {
4
4
  description: string;
5
5
  }
6
6
  export declare function listThemes(): ThemeEntry[];
7
+ export declare function darkSchemeQuery(): MediaQueryList | null;
@@ -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 {};
@@ -50,6 +50,7 @@ export interface AxisOptions {
50
50
  export interface FrameOptions {
51
51
  title?: string;
52
52
  description?: string;
53
+ altText?: string;
53
54
  byline?: string;
54
55
  note?: string;
55
56
  source?: string;
@@ -58,6 +59,8 @@ export interface FrameOptions {
58
59
  aspectRatio?: number;
59
60
  padding?: string;
60
61
  transparentBackground?: boolean;
62
+ getTheData?: boolean;
63
+ data?: ChartData;
61
64
  }
62
65
  export interface AreaFillConfig {
63
66
  from: string;
@@ -148,6 +151,8 @@ export interface ChartOptions {
148
151
  horizontalAxis?: AxisOptions;
149
152
  sort?: SortDirection;
150
153
  sortMode?: SortMode;
154
+ sortSeries?: string;
155
+ sortReverse?: boolean;
151
156
  colorizes?: ColorizeConfig[];
152
157
  highlights?: HighlightConfig[];
153
158
  colors?: string[];
@@ -166,6 +171,8 @@ export interface ChartOptions {
166
171
  areaLines?: boolean;
167
172
  valueLabels?: boolean | 'percent';
168
173
  valueLabelPosition?: ValueLabelPosition;
174
+ valueLabelPoints?: SymbolShowOn | 'everyN';
175
+ valueLabelEvery?: number;
169
176
  tooltips?: boolean;
170
177
  crosshair?: boolean;
171
178
  crosshairDirection?: CrosshairDirection;
@@ -176,6 +183,10 @@ export interface ChartOptions {
176
183
  seriesOverrides?: SeriesOverride[];
177
184
  displayAsPercentage?: boolean;
178
185
  showTotal?: boolean;
186
+ centerLabel?: string;
187
+ centerSlice?: string;
188
+ centerText?: string;
189
+ totalLabel?: string;
179
190
  showLabels?: boolean;
180
191
  showValues?: boolean;
181
192
  sliceMax?: number;
@@ -188,6 +199,7 @@ export interface ChartOptions {
188
199
  barGap?: number;
189
200
  connectedColumns?: boolean;
190
201
  connectionsOpacity?: number;
202
+ negativeColor?: string;
191
203
  stackMode?: StackMode;
192
204
  edgePadding?: boolean;
193
205
  waterfall?: boolean;
@@ -203,6 +215,7 @@ export interface ChartOptions {
203
215
  low?: string;
204
216
  high?: string;
205
217
  arrows?: ArrowDirection;
218
+ dotLabels?: 'both' | 'start' | 'end' | 'difference' | 'change';
206
219
  }
207
220
  export type ChartRenderer = (container: HTMLElement, data: ChartData, options: ChartOptions, transition?: boolean) => void;
208
221
  export interface ChartOptionDef {
@@ -251,6 +264,8 @@ export interface ChartTypeOptions {
251
264
  horizontalRangeMax: string;
252
265
  valueLabels: boolean | 'percent';
253
266
  valueLabelPosition: string;
267
+ valueLabelPoints: string;
268
+ valueLabelEvery: string;
254
269
  tooltips: boolean;
255
270
  crosshair: boolean;
256
271
  crosshairDirection: string;
@@ -264,6 +279,10 @@ export interface ChartTypeOptions {
264
279
  lineSymbolOpacity: string;
265
280
  displayAsPercentage: boolean;
266
281
  showTotal: boolean;
282
+ centerLabel: string;
283
+ centerSlice: string;
284
+ centerText: string;
285
+ totalLabel: string;
267
286
  showLabels: boolean;
268
287
  showValues: boolean;
269
288
  swapLabelValue: boolean;
@@ -272,11 +291,14 @@ export interface ChartTypeOptions {
272
291
  autoContrast: boolean;
273
292
  allowDarkMode: boolean;
274
293
  sortMode: SortMode;
294
+ sortSeries: string;
295
+ sortReverse: boolean;
275
296
  barBackground: boolean;
276
297
  barSeparators: boolean;
277
298
  barGap: string;
278
299
  connectedColumns: boolean;
279
300
  connectionsOpacity: string;
301
+ negativeColor: string;
280
302
  stackMode: string;
281
303
  stacked: boolean;
282
304
  stackPercent: boolean;
@@ -297,5 +319,6 @@ export interface ChartTypeOptions {
297
319
  low: string;
298
320
  high: string;
299
321
  arrows: ArrowDirection;
322
+ dotLabels: string;
300
323
  }
301
324
  export type ChartTypeOptionKey = keyof ChartTypeOptions;
package/dist/embed.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, o as n, r, t as i } from "./runtime-D_vHKSyR.js";
1
+ import { a as e, i as t, o as n, r, t as i } from "./runtime-CT02Shsd.js";
2
2
  export { r as ERROR_MESSAGE, t as RESIZE_MESSAGE, i as buildSrcdoc, e as isErrorMessage, n as readResizeHeight };
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';
@@ -47,5 +47,6 @@ export { ChartParseError, PngBrowserUnsupportedError, MissingNodeRenderDepsError
47
47
  export { buildFrameSvg } from './render';
48
48
  export type { FrameSvgLayout, FrameSvgTextBlock, FrameSvgPlot, ChartAccessibility } from './render';
49
49
  export { buildSrcdoc } from './runtime/runtime';
50
+ export { RESIZE_MESSAGE } from './runtime/messages';
50
51
  export { SceneTransition, getSceneTransition, featureJoin, snapshotLiveAttrs, BC_TRANSITION_NAME, } from './transitions';
51
52
  export type { CommitOptions, TransitionMode, SceneTransitionState, FeatureRole, FeatureJoinConfig, AttrMap, AttrValue, } from './transitions';