@blueprint-chart/lib 2.9.0 → 2.11.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.
@@ -12,6 +12,11 @@ export interface AnnotationContext {
12
12
  backgroundColor?: string;
13
13
  orientation?: 'horizontal';
14
14
  transition?: boolean;
15
+ /** Centre of the mark a label names, for charts whose marks are dots on a band (dot plot). */
16
+ markCenter?: (label: string) => {
17
+ x: number;
18
+ y: number;
19
+ } | undefined;
15
20
  /** Pre-computed snapshots of old annotation positions (captured before DOM is cleared). */
16
21
  priorAnnotations?: Map<string, AnnotationSnapshot>;
17
22
  }
@@ -13,6 +13,13 @@ export declare function computeAnchorPoint(datum: {
13
13
  x: number;
14
14
  y: number;
15
15
  };
16
+ export declare function pointAnchor(center: {
17
+ x: number;
18
+ y: number;
19
+ }, anchorDirection: CompassDirection): {
20
+ x: number;
21
+ y: number;
22
+ };
16
23
  export declare function bboxEdgeToward(bbox: {
17
24
  x: number;
18
25
  y: number;
@@ -0,0 +1,4 @@
1
+ import { AnnotationContext } from '../../plugins/annotations';
2
+ import { DotPlotRow } from './rows';
3
+ import * as d3 from 'd3';
4
+ export declare function dotPlotAnnotationContext(rows: DotPlotRow[], x: AnnotationContext['scaleY'], y: d3.ScaleBand<string>, rowY: (name: string) => number): Pick<AnnotationContext, 'scaleX' | 'scaleY' | 'data' | 'orientation' | 'markCenter'>;
@@ -0,0 +1,4 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLOR = "#4e79a7";
3
+ export declare const DOT_RADIUS = 5;
4
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,11 @@
1
+ import { ScaleType } from '../../../enums';
2
+ import { ChartData } from '../../types';
3
+ import { DotPlotMapping } from './mapping';
4
+ export interface DotPlotIssue {
5
+ code: string;
6
+ severity: 'warning';
7
+ message: string;
8
+ key?: 'low' | 'high';
9
+ suggestion?: string;
10
+ }
11
+ export declare function dotPlotIssues(data: ChartData, overrides: DotPlotMapping, scaleType?: ScaleType): DotPlotIssue[];
@@ -0,0 +1,17 @@
1
+ import { DotStyle } from '../../../enums';
2
+ import { ChartData } from '../../types';
3
+ export type DotPlotMode = 'single' | 'dumbbell' | 'range';
4
+ export interface DotPlotMapping {
5
+ dotStyle?: DotStyle;
6
+ low?: string;
7
+ high?: string;
8
+ }
9
+ export interface ResolvedDotPlot {
10
+ mode: DotPlotMode;
11
+ values: string[];
12
+ low?: string;
13
+ high?: string;
14
+ ignored: string[];
15
+ }
16
+ export declare function detectRangeColumn(columns: string[], role: 'low' | 'high'): string | undefined;
17
+ export declare function resolveDotPlotMapping(data: ChartData, overrides?: DotPlotMapping): ResolvedDotPlot;
@@ -0,0 +1,20 @@
1
+ import { ScaleType, SortMode } from '../../../enums';
2
+ import { ChartData } from '../../types';
3
+ import { DotPlotMode, ResolvedDotPlot } from './mapping';
4
+ export interface DotPlotRow {
5
+ name: string;
6
+ values: number[];
7
+ low?: number;
8
+ high?: number;
9
+ }
10
+ export type DotPlotDropReason = 'missing-value' | 'missing-range' | 'non-positive-log';
11
+ type DroppedRow = {
12
+ name: string;
13
+ reason: DotPlotDropReason;
14
+ };
15
+ export declare function buildDotPlotRows(data: ChartData, resolved: ResolvedDotPlot, scaleType?: ScaleType): {
16
+ rows: DotPlotRow[];
17
+ dropped: DroppedRow[];
18
+ };
19
+ export declare function sortDotPlotRows(rows: DotPlotRow[], sortMode: SortMode | undefined, mode: DotPlotMode): DotPlotRow[];
20
+ export {};
@@ -0,0 +1,3 @@
1
+ import { DotPlotRow } from './rows';
2
+ import { ResolvedDotPlot } from './mapping';
3
+ export declare function formatDotPlotTooltip(row: DotPlotRow, resolved: ResolvedDotPlot, format?: string): string;
@@ -16,5 +16,22 @@ type Ranges = {
16
16
  x?: AxisRange;
17
17
  y?: AxisRange;
18
18
  };
19
+ export declare const MAX_LISTED_ROWS = 5;
20
+ export declare function columnNames(data: ChartData): string[];
21
+ export declare function unknownColumns<K extends string, S extends 'error' | 'warning'>(data: ChartData, overrides: Partial<Record<K, string>>, keys: readonly K[], severity: S): {
22
+ code: string;
23
+ severity: S;
24
+ key: K;
25
+ message: string;
26
+ suggestion: string | undefined;
27
+ }[];
28
+ export declare function droppedRows<R extends string>(dropped: {
29
+ name: string;
30
+ reason: R;
31
+ }[], reasons: Record<R, string>): {
32
+ code: 'dropped-rows';
33
+ severity: 'warning';
34
+ message: string;
35
+ }[];
19
36
  export declare function scatterIssues(data: ChartData, overrides: ScatterMapping, scaleTypes: ScaleTypes, ranges: Ranges, trend?: string): ScatterIssue[];
20
37
  export {};
@@ -17,6 +17,7 @@ type ScaleTypes = {
17
17
  x?: ScaleType;
18
18
  y?: ScaleType;
19
19
  };
20
+ export declare function numericColumn(data: ChartData, name?: string): number[] | undefined;
20
21
  export declare function buildScatterPoints(data: ChartData, mapping: ScatterMapping, scaleTypes: ScaleTypes): {
21
22
  points: ScatterPoint[];
22
23
  dropped: DroppedRow[];
@@ -1,4 +1,4 @@
1
- import { AxisDirection, ScaleType, GridStyle, LabelPosition, LabelRotation, TickPosition, FrameSizing, AnnotationKind, Orientation, SymbolShape, SymbolShowOn, SymbolStyle, SortDirection, SortMode, LegendPosition, Anchor, ValueLabelPosition, CrosshairDirection, CrosshairStyle, StackMode, ChartOptionType, CompassDirection, AnnotationLineStyle, StrokeStyle, RangeAnchor } from '../enums';
1
+ import { AxisDirection, ScaleType, GridStyle, LabelPosition, LabelRotation, TickPosition, FrameSizing, AnnotationKind, Orientation, SymbolShape, SymbolShowOn, SymbolStyle, SortDirection, SortMode, DotStyle, ArrowDirection, LegendPosition, Anchor, ValueLabelPosition, CrosshairDirection, CrosshairStyle, StackMode, ChartOptionType, CompassDirection, AnnotationLineStyle, StrokeStyle, RangeAnchor } from '../enums';
2
2
  export { CompassDirection, AnnotationLineStyle, StrokeStyle, RangeAnchor, LineStyle, } from '../enums';
3
3
  export interface ChartData {
4
4
  labels: string[];
@@ -199,6 +199,10 @@ export interface ChartOptions {
199
199
  size?: string;
200
200
  group?: string;
201
201
  trend?: string;
202
+ dotStyle?: DotStyle;
203
+ low?: string;
204
+ high?: string;
205
+ arrows?: ArrowDirection;
202
206
  }
203
207
  export type ChartRenderer = (container: HTMLElement, data: ChartData, options: ChartOptions, transition?: boolean) => void;
204
208
  export interface ChartOptionDef {
@@ -289,5 +293,9 @@ export interface ChartTypeOptions {
289
293
  size: string;
290
294
  group: string;
291
295
  trend: string;
296
+ dotStyle: DotStyle;
297
+ low: string;
298
+ high: string;
299
+ arrows: ArrowDirection;
292
300
  }
293
301
  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-gzeMNwqx.js";
1
+ import { a as e, i as t, o as n, r, t as i } from "./runtime-D_vHKSyR.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
@@ -13,6 +13,7 @@ export declare enum ChartType {
13
13
  Donut = "donut",
14
14
  Pie = "pie",
15
15
  Scatter = "scatter",
16
+ DotPlot = "dot-plot",
16
17
  VerticalBar = "vertical-bar",
17
18
  HorizontalBar = "horizontal-bar"
18
19
  }
@@ -135,10 +136,22 @@ export declare enum SortDirection {
135
136
  Descending = "descending",
136
137
  None = "none"
137
138
  }
139
+ export declare enum ArrowDirection {
140
+ None = "none",
141
+ Forward = "forward",
142
+ Backward = "backward",
143
+ Both = "both"
144
+ }
145
+ export declare enum DotStyle {
146
+ Dumbbell = "dumbbell",
147
+ Range = "range"
148
+ }
138
149
  export declare enum SortMode {
139
150
  Total = "total",
140
151
  WithinGroups = "within-groups",
141
- None = "none"
152
+ None = "none",
153
+ Value = "value",
154
+ Gap = "gap"
142
155
  }
143
156
  export declare enum LegendPosition {
144
157
  Top = "top",
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { ChartType, AxisDirection, ScaleType, GridStyle, LabelPosition, LabelRotation, TickPosition, FrameSizing, CompassDirection, AnnotationLineStyle, StrokeStyle, AnnotationKind, RangeAnchor, Orientation, SymbolShape, SymbolShowOn, SymbolStyle, SortDirection, SortMode, LegendPosition, Anchor, ValueLabelPosition, CrosshairDirection, CrosshairStyle, StackMode, LineStyle, ChartOptionType, DirectLabelMode, Interpolation, DslNodeType, TransformType, FilterCondition, ParseOperationCategory, } from './enums';
1
+ export { ChartType, AxisDirection, ScaleType, GridStyle, LabelPosition, LabelRotation, TickPosition, FrameSizing, CompassDirection, AnnotationLineStyle, StrokeStyle, AnnotationKind, RangeAnchor, Orientation, SymbolShape, SymbolShowOn, SymbolStyle, SortDirection, SortMode, DotStyle, ArrowDirection, LegendPosition, Anchor, ValueLabelPosition, CrosshairDirection, CrosshairStyle, StackMode, LineStyle, ChartOptionType, DirectLabelMode, Interpolation, DslNodeType, TransformType, FilterCondition, ParseOperationCategory, } from './enums';
2
2
  export { ANNOTATION_KIND_KEYWORD } from './enums';
3
3
  export type { ChartData, ChartOptions, ChartRenderer, ChartOptionDef, ChartTypeOptions, ChartTypeOptionKey, ColorizeConfig, HighlightConfig, AxisOptions, FrameOptions, AreaFillConfig, AnnotationConfig, PointAnnotationConfig, RangeAnnotationConfig, FreeAnnotationConfig, AnnotationLineConfig, LineSymbolConfig, SeriesOverride, Margin, } from './charts/types';
4
4
  export { createFrame } from './charts/frame/frame';
@@ -12,6 +12,7 @@ export { registerChart, getChart, getChartOptions, listCharts } from './charts/r
12
12
  export { parseData, buildChartOptions } from './charts/chart-helpers';
13
13
  export { stripDigitGroupSpaces } from './charts/number-parse';
14
14
  export { resolveScatterMapping, numericColumns, MAPPING_NONE, type ScatterMapping } from './charts/types/scatter/mapping';
15
+ export { resolveDotPlotMapping, detectRangeColumn, type DotPlotMapping, type DotPlotMode, type ResolvedDotPlot } from './charts/types/dot-plot/mapping';
15
16
  export { recommendCharts } from './recommendations/recommend';
16
17
  export { classifyIntent } from './recommendations/intent';
17
18
  export { shapeOf } from './recommendations/shape';