@blueprint-chart/lib 0.1.2

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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -0
  3. package/dist/charts/axis/axis-service.d.ts +55 -0
  4. package/dist/charts/axis/horizontal-axis.d.ts +58 -0
  5. package/dist/charts/axis/index.d.ts +4 -0
  6. package/dist/charts/axis/vertical-axis.d.ts +12 -0
  7. package/dist/charts/canvas/canvas.d.ts +45 -0
  8. package/dist/charts/chart-helpers.d.ts +3 -0
  9. package/dist/charts/colorblind.d.ts +34 -0
  10. package/dist/charts/contrast.d.ts +33 -0
  11. package/dist/charts/curves.d.ts +2 -0
  12. package/dist/charts/date-parse.d.ts +12 -0
  13. package/dist/charts/defaults/expectations.d.ts +2 -0
  14. package/dist/charts/defaults/helpers.d.ts +6 -0
  15. package/dist/charts/defaults/types.d.ts +61 -0
  16. package/dist/charts/format-helpers.d.ts +31 -0
  17. package/dist/charts/frame/frame.d.ts +8 -0
  18. package/dist/charts/index.d.ts +17 -0
  19. package/dist/charts/legend/legend-size.d.ts +5 -0
  20. package/dist/charts/legend/legend.d.ts +4 -0
  21. package/dist/charts/line-symbols.d.ts +9 -0
  22. package/dist/charts/motion.d.ts +45 -0
  23. package/dist/charts/palettes.d.ts +7 -0
  24. package/dist/charts/plugins/annotations/context.d.ts +17 -0
  25. package/dist/charts/plugins/annotations/direction-helpers.d.ts +14 -0
  26. package/dist/charts/plugins/annotations/free-renderer.d.ts +4 -0
  27. package/dist/charts/plugins/annotations/index.d.ts +10 -0
  28. package/dist/charts/plugins/annotations/point-renderer.d.ts +6 -0
  29. package/dist/charts/plugins/annotations/position-helpers.d.ts +2 -0
  30. package/dist/charts/plugins/annotations/range-renderer.d.ts +4 -0
  31. package/dist/charts/plugins/annotations/shared.d.ts +57 -0
  32. package/dist/charts/plugins/annotations/snapshots.d.ts +21 -0
  33. package/dist/charts/plugins/arc-labels.d.ts +53 -0
  34. package/dist/charts/plugins/crosshair.d.ts +10 -0
  35. package/dist/charts/plugins/proximity.d.ts +27 -0
  36. package/dist/charts/plugins/test-helpers.d.ts +1 -0
  37. package/dist/charts/plugins/tooltip.d.ts +6 -0
  38. package/dist/charts/plugins/value-labels.d.ts +6 -0
  39. package/dist/charts/registry.d.ts +5 -0
  40. package/dist/charts/resolve.d.ts +3 -0
  41. package/dist/charts/scale-helpers.d.ts +19 -0
  42. package/dist/charts/series-helpers.d.ts +10 -0
  43. package/dist/charts/stack-helpers.d.ts +17 -0
  44. package/dist/charts/transition-cache.d.ts +8 -0
  45. package/dist/charts/types/area/area.d.ts +3 -0
  46. package/dist/charts/types/area-stacked/area-stacked.d.ts +3 -0
  47. package/dist/charts/types/bar-grouped/bar-grouped.d.ts +3 -0
  48. package/dist/charts/types/bar-horizontal/bar-horizontal.d.ts +3 -0
  49. package/dist/charts/types/bar-multi/bar-multi.d.ts +3 -0
  50. package/dist/charts/types/bar-split/bar-split.d.ts +3 -0
  51. package/dist/charts/types/bar-stacked/bar-stacked.d.ts +3 -0
  52. package/dist/charts/types/bar-vertical/bar-vertical.d.ts +3 -0
  53. package/dist/charts/types/column-stacked/column-stacked.d.ts +3 -0
  54. package/dist/charts/types/donut/donut.d.ts +4 -0
  55. package/dist/charts/types/line/line.d.ts +3 -0
  56. package/dist/charts/types/line-multi/line-multi.d.ts +3 -0
  57. package/dist/charts/types/pie/pie.d.ts +2 -0
  58. package/dist/charts/types.d.ts +269 -0
  59. package/dist/dsl/converter.d.ts +50 -0
  60. package/dist/dsl/index.d.ts +3 -0
  61. package/dist/dsl/lexer.d.ts +8 -0
  62. package/dist/dsl/parser.d.ts +2 -0
  63. package/dist/dsl/serializer.d.ts +3 -0
  64. package/dist/dsl/types.d.ts +88 -0
  65. package/dist/enums.d.ts +193 -0
  66. package/dist/index.d.ts +27 -0
  67. package/dist/index.js +7088 -0
  68. package/dist/lib/lib.iife.js +186 -0
  69. package/dist/runtime/chart-css.d.ts +1 -0
  70. package/dist/runtime/index.d.ts +4 -0
  71. package/dist/runtime/runtime.d.ts +1 -0
  72. package/dist/runtime/scenes.d.ts +19 -0
  73. package/dist/runtime/steps.d.ts +3 -0
  74. package/dist/samples.d.ts +10 -0
  75. package/package.json +73 -0
  76. package/src/charts/chart.scss +481 -0
@@ -0,0 +1,10 @@
1
+ import { Plugin } from 'd3-blueprint';
2
+ import { AnnotationConfig } from '../../types';
3
+ import { AnnotationContext } from './context';
4
+ export type { AnnotationContext } from './context';
5
+ export type { LineGeometry, AnnotationSnapshot } from './snapshots';
6
+ export { snapshotAnnotations } from './snapshots';
7
+ export { computeDirectionOffset, rotateDirectionForHorizontal } from './direction-helpers';
8
+ export { computeAnchorPoint, bboxEdgeToward, ensureArrowMarker, renderTargetCircle, renderConnectingLine, renderAnnotationText, } from './shared';
9
+ export declare function renderAnnotations(parent: SVGGElement, annotations: AnnotationConfig[], ctx: AnnotationContext): void;
10
+ export declare function createAnnotationPlugin<TData = unknown>(annotations: AnnotationConfig[], ctx: AnnotationContext): Plugin<TData>;
@@ -0,0 +1,6 @@
1
+ import { AnnotationConfig } from '../../types';
2
+ import { AnnotationContext } from './context';
3
+ import * as d3 from 'd3';
4
+ export declare function renderPointAnnotation(g: d3.Selection<SVGGElement, unknown, null, undefined>, ann: AnnotationConfig & {
5
+ target?: string;
6
+ }, ctx: AnnotationContext, index: number): void;
@@ -0,0 +1,2 @@
1
+ export declare function resolvePosition(value: number | string, size: number): number;
2
+ export declare function resolveMaxWidth(maxWidth: number | string | undefined, chartWidth: number): number | undefined;
@@ -0,0 +1,4 @@
1
+ import { AnnotationConfig } from '../../types';
2
+ import { AnnotationContext } from './context';
3
+ import * as d3 from 'd3';
4
+ export declare function renderRangeAnnotation(g: d3.Selection<SVGGElement, unknown, null, undefined>, ann: AnnotationConfig, ctx: AnnotationContext, index: number, labelGroup?: d3.Selection<SVGGElement, unknown, null, undefined>): void;
@@ -0,0 +1,57 @@
1
+ import { RangeAnchor, CompassDirection } from '../../types';
2
+ import { StrokeStyle, AnnotationLineStyle } from '../../../enums';
3
+ import { AnnotationContext } from './context';
4
+ import * as d3 from 'd3';
5
+ export declare function isPointScale(scale: AnnotationContext['scaleX']): scale is d3.ScalePoint<string>;
6
+ export declare function isTimeScale(scale: AnnotationContext['scaleX']): scale is d3.ScaleTime<number, number>;
7
+ export declare function scaleXValue(scale: AnnotationContext['scaleX'], label: string): number;
8
+ export declare function computeAnchorPoint(datum: {
9
+ label: string;
10
+ value: number;
11
+ }, scaleX: AnnotationContext['scaleX'], scaleY: d3.ScaleLinear<number, number> | d3.ScaleSymLog<number, number>, anchorDirection: CompassDirection, orientation?: 'horizontal'): {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ export declare function bboxEdgeToward(bbox: {
16
+ x: number;
17
+ y: number;
18
+ width: number;
19
+ height: number;
20
+ }, targetX: number, targetY: number, pad?: number): {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ export declare function ensureArrowMarker(svg: SVGElement | null, color?: string): string;
25
+ export declare function renderTargetCircle(g: d3.Selection<SVGGElement, unknown, null, undefined>, cx: number, cy: number, opts?: {
26
+ size?: number;
27
+ style?: StrokeStyle;
28
+ color?: string;
29
+ }): void;
30
+ export declare function computeElbowPath(from: {
31
+ x: number;
32
+ y: number;
33
+ }, to: {
34
+ x: number;
35
+ y: number;
36
+ }, departVertical: boolean): string;
37
+ export declare function renderConnectingLine(g: d3.Selection<SVGGElement, unknown, null, undefined>, from: {
38
+ x: number;
39
+ y: number;
40
+ }, to: {
41
+ x: number;
42
+ y: number;
43
+ }, style?: AnnotationLineStyle, opts?: {
44
+ showArrow?: boolean;
45
+ lineWeight?: number;
46
+ color?: string;
47
+ departVertical?: boolean;
48
+ }): void;
49
+ export declare function renderAnnotationText(g: d3.Selection<SVGGElement, unknown, null, undefined>, text: string, x: number, y: number, opts?: {
50
+ textColor?: string;
51
+ maxWidth?: number;
52
+ textAnchor?: string;
53
+ backgroundColor?: string;
54
+ textOutline?: boolean;
55
+ }): void;
56
+ export declare function resolveXPosition(value: number | string, scaleX: AnnotationContext['scaleX'], anchor?: RangeAnchor): number;
57
+ export declare function resolveYPosition(value: number | string, scaleY: d3.ScaleLinear<number, number> | d3.ScaleSymLog<number, number>): number;
@@ -0,0 +1,21 @@
1
+ export interface LineGeometry {
2
+ style: string;
3
+ fromX: number;
4
+ fromY: number;
5
+ toX: number;
6
+ toY: number;
7
+ departVertical: boolean;
8
+ }
9
+ export interface AnnotationSnapshot {
10
+ id: string;
11
+ element: Element;
12
+ rect: {
13
+ x: number;
14
+ y: number;
15
+ width: number;
16
+ height: number;
17
+ };
18
+ line?: LineGeometry;
19
+ }
20
+ export declare function readLineGeometry(el: Element): LineGeometry | undefined;
21
+ export declare function snapshotAnnotations(container: Element): Map<string, AnnotationSnapshot>;
@@ -0,0 +1,53 @@
1
+ import * as d3 from 'd3';
2
+ export interface ArcLabelDatum {
3
+ label: string;
4
+ value: number;
5
+ startAngle: number;
6
+ endAngle: number;
7
+ color: string;
8
+ percentage?: number;
9
+ displayAsPercentage?: boolean;
10
+ showLabel?: boolean;
11
+ showValue?: boolean;
12
+ }
13
+ /**
14
+ * Deterministic 1D value spreading.
15
+ * Pushes values apart so consecutive entries are at least `gap` apart,
16
+ * clamped within [top, bottom]. When the available space is too small
17
+ * for `(n-1) * gap`, the effective gap is reduced so labels are evenly
18
+ * distributed across the full range.
19
+ */
20
+ export declare function spreadLabels(naturalYs: number[], top: number, bottom: number, gap?: number): number[];
21
+ export declare function renderArcLabels(parent: d3.Selection<SVGGElement, unknown, null, undefined>, data: ArcLabelDatum[], opts: {
22
+ outerRadius: number;
23
+ chartWidth: number;
24
+ chartHeight: number;
25
+ fontSize?: number;
26
+ bgColor?: string;
27
+ }): void;
28
+ export declare function renderInsideArcLabels(parent: d3.Selection<SVGGElement, unknown, null, undefined>, data: ArcLabelDatum[], opts: {
29
+ outerRadius: number;
30
+ innerRadius?: number;
31
+ chartWidth: number;
32
+ chartHeight: number;
33
+ fontSize?: number;
34
+ }): void;
35
+ export declare function renderAutoArcLabels(parent: d3.Selection<SVGGElement, unknown, null, undefined>, data: ArcLabelDatum[], opts: {
36
+ outerRadius: number;
37
+ innerRadius?: number;
38
+ chartWidth: number;
39
+ chartHeight: number;
40
+ fontSize?: number;
41
+ bgColor?: string;
42
+ }): void;
43
+ /**
44
+ * Estimate extra margins needed for arc labels beyond what the arc already
45
+ * occupies. The text column sits at outerRadius + STUB_LENGTH + HORIZONTAL_SEG + 6
46
+ * from centre; we need room for the text itself beyond that.
47
+ */
48
+ export declare function estimateArcLabelMargins(labels: string[], outerRadius: number): {
49
+ left: number;
50
+ right: number;
51
+ top: number;
52
+ bottom: number;
53
+ };
@@ -0,0 +1,10 @@
1
+ import { Plugin } from 'd3-blueprint';
2
+ export declare function createCrosshairPlugin<TData = unknown>(options?: {
3
+ width?: number;
4
+ height?: number;
5
+ direction?: 'both' | 'vertical' | 'horizontal';
6
+ style?: 'solid' | 'dashed' | 'dotted';
7
+ color?: string;
8
+ dashArray?: string;
9
+ orientation?: 'vertical' | 'horizontal';
10
+ }): Plugin<TData>;
@@ -0,0 +1,27 @@
1
+ export interface ProximityPoint {
2
+ cx: number;
3
+ cy: number;
4
+ label: string;
5
+ value: number;
6
+ series?: string;
7
+ color: string;
8
+ }
9
+ export interface ProximityOptions {
10
+ width: number;
11
+ height: number;
12
+ points: ProximityPoint[];
13
+ tooltip?: boolean;
14
+ crosshair?: boolean;
15
+ crosshairDirection?: 'both' | 'vertical' | 'horizontal';
16
+ crosshairStyle?: 'solid' | 'dashed' | 'dotted';
17
+ crosshairColor?: string;
18
+ format?: (point: ProximityPoint) => string;
19
+ numberFormat?: string;
20
+ }
21
+ export declare function makeDefaultFormat(numberFormat?: string): (p: ProximityPoint) => string;
22
+ /**
23
+ * Sets up proximity-based tooltip and crosshair for line charts.
24
+ * Instead of requiring hover over tiny dot elements, this creates a
25
+ * transparent overlay that finds the nearest data point by x-position.
26
+ */
27
+ export declare function setupProximityInteraction(chartArea: SVGGElement, options: ProximityOptions): () => void;
@@ -0,0 +1 @@
1
+ export declare function makeChartStub(g: SVGGElement): unknown;
@@ -0,0 +1,6 @@
1
+ import { Plugin } from 'd3-blueprint';
2
+ export declare function makeDefaultFormat(numberFormat?: string): (d: unknown) => string;
3
+ export declare function createTooltipPlugin<TData = unknown>(options?: {
4
+ format?: (datum: unknown) => string;
5
+ numberFormat?: string;
6
+ }): Plugin<TData>;
@@ -0,0 +1,6 @@
1
+ import { Plugin } from 'd3-blueprint';
2
+ export declare function createValueLabelPlugin<TData = unknown>(options?: {
3
+ position?: 'inside' | 'outside' | 'auto';
4
+ format?: string;
5
+ orientation?: 'vertical' | 'horizontal';
6
+ }): Plugin<TData>;
@@ -0,0 +1,5 @@
1
+ import { ChartOptionDef, ChartRenderer } from './types';
2
+ export declare function registerChart(name: string, renderer: ChartRenderer, options: ChartOptionDef[]): void;
3
+ export declare function getChart(name: string): ChartRenderer | undefined;
4
+ export declare function getChartOptions(name: string): ChartOptionDef[];
5
+ export declare function listCharts(): string[];
@@ -0,0 +1,3 @@
1
+ import { ChartTypeOptions } from './types';
2
+ export declare function getChartTypeDefaults(chartType: string): Partial<ChartTypeOptions>;
3
+ export declare function resolveChartTypeOptions(chartType: string, explicit: Partial<ChartTypeOptions>): Partial<ChartTypeOptions>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Filter chart labels (and corresponding data) by a horizontal axis range.
3
+ * Returns the indices of labels that fall within [min, max].
4
+ */
5
+ export declare function filterLabelsByRange(labels: string[], range?: {
6
+ min?: number;
7
+ max?: number;
8
+ }): number[];
9
+ export declare const DEFAULT_BAR_GAP = 60;
10
+ /**
11
+ * Convert a barGap (percentage of bar size) to a d3 scaleBand paddingInner value.
12
+ * 0 = no gap, 100 = gap equals one bar width. Out-of-range values are clamped
13
+ * to [0, 100]; non-finite or undefined values fall back to DEFAULT_BAR_GAP.
14
+ */
15
+ export declare function resolveBarGapPadding(barGap?: number): number;
16
+ export declare function computeLinearDomain(values: number[], range?: {
17
+ min?: number;
18
+ max?: number;
19
+ }): [number, number];
@@ -0,0 +1,10 @@
1
+ import { SeriesOverride } from './types';
2
+ export declare function resolveSeriesColor(name: string, index: number, colors: string[], overrides?: SeriesOverride[]): string;
3
+ export declare function resolveSeriesDash(name: string, overrides?: SeriesOverride[]): string;
4
+ export declare function resolveSeriesWidth(name: string, overrides?: SeriesOverride[]): number;
5
+ export declare function resolveSeriesInterpolation(name: string, globalInterpolation: string, overrides?: SeriesOverride[]): string;
6
+ export declare function isSeriesHidden(name: string, overrides?: SeriesOverride[]): boolean;
7
+ export declare function resolveSeriesLabelMode(name: string, globalMode: string, overrides?: SeriesOverride[]): string;
8
+ export declare function resolveSeriesValueLabels(name: string, globalValueLabels: boolean, overrides?: SeriesOverride[]): boolean;
9
+ export declare function resolveSeriesOpacity(name: string, overrides?: SeriesOverride[]): number;
10
+ export declare function resolveSeriesLineSymbols(name: string, globalConfig: SeriesOverride | undefined, overrides?: SeriesOverride[]): SeriesOverride | undefined;
@@ -0,0 +1,17 @@
1
+ import { ChartData } from './types';
2
+ import * as d3 from 'd3';
3
+ export interface StackedPoint {
4
+ 0: number;
5
+ 1: number;
6
+ data: Record<string, number>;
7
+ }
8
+ /**
9
+ * Compute a stacked layout from multi-series ChartData.
10
+ * Returns d3.Series array usable by d3.area() and rect rendering.
11
+ */
12
+ export declare function computeStack(data: ChartData): d3.Series<Record<string, number>, string>[];
13
+ /**
14
+ * Compute a stacked layout normalized to 100%.
15
+ * Each category's values sum to 100.
16
+ */
17
+ export declare function computeStack100(data: ChartData): d3.Series<Record<string, number>, string>[];
@@ -0,0 +1,8 @@
1
+ import { Margin } from './types';
2
+ export interface CachedChart {
3
+ chartType: string;
4
+ margin?: Margin;
5
+ }
6
+ export declare function getCachedChart(container: HTMLElement): CachedChart | undefined;
7
+ export declare function setCachedChart(container: HTMLElement, entry: CachedChart): void;
8
+ export declare function clearCachedChart(container: HTMLElement): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLOR = "#4e79a7";
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, inputData: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,4 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
4
+ export declare function renderArc(container: HTMLElement, data: ChartData, options: ChartOptions, innerRadiusRatio: number, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLOR = "#4e79a7";
3
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,3 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare const DEFAULT_COLORS: string[];
3
+ export declare function render(container: HTMLElement, inputData: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,2 @@
1
+ import { ChartData, ChartOptions } from '../../types';
2
+ export declare function render(container: HTMLElement, data: ChartData, options?: ChartOptions, transition?: boolean): void;
@@ -0,0 +1,269 @@
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';
2
+ export { CompassDirection, AnnotationLineStyle, StrokeStyle, RangeAnchor, LineStyle, } from '../enums';
3
+ export interface ChartData {
4
+ labels: string[];
5
+ values: number[];
6
+ series?: {
7
+ name: string;
8
+ values: number[];
9
+ }[];
10
+ }
11
+ export interface ColorizeConfig {
12
+ target: string;
13
+ color: string;
14
+ label?: string;
15
+ }
16
+ export interface HighlightConfig {
17
+ target: string;
18
+ }
19
+ export interface AxisOptions {
20
+ direction?: AxisDirection;
21
+ scaleType?: ScaleType;
22
+ range?: {
23
+ min?: number;
24
+ max?: number;
25
+ };
26
+ ticks?: number[];
27
+ showAxis?: boolean;
28
+ showTicks?: boolean;
29
+ gridStyle?: GridStyle;
30
+ gridWidth?: number;
31
+ numberFormat?: string;
32
+ tickPosition?: TickPosition;
33
+ labelPosition?: LabelPosition;
34
+ labelRotation?: LabelRotation;
35
+ topPadding?: number;
36
+ width?: number;
37
+ zeroY?: number;
38
+ tickFormat?: (label: string) => string;
39
+ }
40
+ export interface FrameOptions {
41
+ title?: string;
42
+ description?: string;
43
+ byline?: string;
44
+ note?: string;
45
+ source?: string;
46
+ sourceUrl?: string;
47
+ sizing?: FrameSizing;
48
+ aspectRatio?: number;
49
+ showCredit?: boolean;
50
+ padding?: string;
51
+ transparentBackground?: boolean;
52
+ }
53
+ export interface AreaFillConfig {
54
+ from: string;
55
+ to: string;
56
+ color?: string;
57
+ negativeColor?: string;
58
+ opacity?: number;
59
+ interpolation?: string;
60
+ }
61
+ export interface AnnotationLineConfig {
62
+ anchorDirection?: CompassDirection;
63
+ textOffsetX?: number;
64
+ textOffsetY?: number;
65
+ showLine?: boolean;
66
+ lineStyle?: AnnotationLineStyle;
67
+ lineWeight?: number;
68
+ showArrow?: boolean;
69
+ lineTargetDistance?: number;
70
+ showCircle?: boolean;
71
+ circleSize?: number;
72
+ circleStyle?: StrokeStyle;
73
+ circleColor?: string;
74
+ }
75
+ interface AnnotationBase {
76
+ id?: string;
77
+ text?: string;
78
+ textColor?: string;
79
+ textOutline?: boolean;
80
+ maxWidth?: number | string;
81
+ }
82
+ export interface PointAnnotationConfig extends AnnotationBase, AnnotationLineConfig {
83
+ kind: AnnotationKind.Point;
84
+ text: string;
85
+ target: string;
86
+ }
87
+ export interface RangeAnnotationConfig extends AnnotationBase {
88
+ kind: AnnotationKind.Range;
89
+ orientation?: Orientation;
90
+ direction?: CompassDirection;
91
+ start: number | string;
92
+ end: number | string;
93
+ startAnchor?: RangeAnchor;
94
+ endAnchor?: RangeAnchor;
95
+ bgOpacity?: number;
96
+ bgColor?: string;
97
+ }
98
+ export interface FreeAnnotationConfig extends AnnotationBase {
99
+ kind: AnnotationKind.Free;
100
+ text: string;
101
+ x: number | string;
102
+ y: number | string;
103
+ }
104
+ export type AnnotationConfig = PointAnnotationConfig | RangeAnnotationConfig | FreeAnnotationConfig;
105
+ export interface LineSymbolConfig {
106
+ symbol?: SymbolShape;
107
+ showOn?: SymbolShowOn;
108
+ style?: SymbolStyle;
109
+ size?: number;
110
+ opacity?: number;
111
+ }
112
+ export interface SeriesOverride {
113
+ name: string;
114
+ color?: string;
115
+ showOutline?: boolean;
116
+ interpolation?: string;
117
+ lineWidth?: number;
118
+ dash?: string;
119
+ labelMode?: string;
120
+ labelText?: string;
121
+ valueLabels?: boolean;
122
+ lineSymbols?: boolean;
123
+ symbolShape?: string;
124
+ symbolShowOn?: string;
125
+ symbolStyle?: string;
126
+ symbolSize?: number;
127
+ symbolOpacity?: number;
128
+ opacity?: number;
129
+ hidden?: boolean;
130
+ }
131
+ export interface ChartOptions {
132
+ frame?: FrameOptions;
133
+ verticalAxis?: AxisOptions;
134
+ horizontalAxis?: AxisOptions;
135
+ sort?: SortDirection;
136
+ sortMode?: SortMode;
137
+ colorizes?: ColorizeConfig[];
138
+ highlights?: HighlightConfig[];
139
+ colors?: string[];
140
+ interpolation?: string;
141
+ legend?: boolean;
142
+ legendPosition?: LegendPosition;
143
+ legendAnchor?: Anchor;
144
+ directLabelling?: string | boolean;
145
+ directLabelAnchor?: Anchor;
146
+ areaFill?: boolean;
147
+ areaFillOpacity?: number;
148
+ areaFills?: AreaFillConfig[];
149
+ stacked?: boolean;
150
+ stackPercent?: boolean;
151
+ areaSortMode?: string;
152
+ areaLines?: boolean;
153
+ valueLabels?: boolean;
154
+ valueLabelPosition?: ValueLabelPosition;
155
+ tooltips?: boolean;
156
+ crosshair?: boolean;
157
+ crosshairDirection?: CrosshairDirection;
158
+ crosshairStyle?: CrosshairStyle;
159
+ crosshairColor?: string;
160
+ lineSymbols?: LineSymbolConfig;
161
+ annotations?: AnnotationConfig[];
162
+ seriesOverrides?: SeriesOverride[];
163
+ displayAsPercentage?: boolean;
164
+ showTotal?: boolean;
165
+ showLabels?: boolean;
166
+ showValues?: boolean;
167
+ sliceMax?: number;
168
+ sliceGroupLabel?: string;
169
+ autoContrast?: boolean;
170
+ allowDarkMode?: boolean;
171
+ swapLabelValue?: boolean;
172
+ barBackground?: boolean;
173
+ barSeparators?: boolean;
174
+ barGap?: number;
175
+ connectedColumns?: boolean;
176
+ connectionsOpacity?: number;
177
+ stackMode?: StackMode;
178
+ edgePadding?: boolean;
179
+ waterfall?: boolean;
180
+ waterfallTotal?: boolean;
181
+ sharedScale?: boolean;
182
+ categoryLabelLine?: boolean;
183
+ }
184
+ export type ChartRenderer = (container: HTMLElement, data: ChartData, options: ChartOptions, transition?: boolean) => void;
185
+ export interface ChartOptionDef {
186
+ key: string;
187
+ type: ChartOptionType;
188
+ label: string;
189
+ default?: unknown;
190
+ choices?: {
191
+ value: string;
192
+ text: string;
193
+ }[];
194
+ placeholder?: string;
195
+ }
196
+ export interface Margin {
197
+ top: number;
198
+ right: number;
199
+ bottom: number;
200
+ left: number;
201
+ }
202
+ export interface ChartTypeOptions {
203
+ colors: string[];
204
+ colorPalette: string;
205
+ interpolation: string;
206
+ legend: boolean;
207
+ legendPosition: string;
208
+ legendAnchor: string;
209
+ directLabelling: string;
210
+ directLabelAnchor: string;
211
+ showVerticalAxis: boolean;
212
+ verticalAxisDirection: string;
213
+ showVerticalTicks: boolean;
214
+ verticalGridStyle: GridStyle;
215
+ verticalNumberFormat: string;
216
+ showHorizontalAxis: boolean;
217
+ showHorizontalTicks: boolean;
218
+ horizontalGridStyle: GridStyle;
219
+ horizontalNumberFormat: string;
220
+ verticalScaleType: ScaleType;
221
+ horizontalScaleType: ScaleType;
222
+ verticalLabelPosition: string;
223
+ verticalRangeMin: string;
224
+ verticalRangeMax: string;
225
+ horizontalLabelPosition: string;
226
+ horizontalLabelRotation: string;
227
+ horizontalRangeMin: string;
228
+ horizontalRangeMax: string;
229
+ valueLabels: boolean;
230
+ valueLabelPosition: string;
231
+ tooltips: boolean;
232
+ crosshair: boolean;
233
+ crosshairDirection: string;
234
+ crosshairStyle: string;
235
+ crosshairColor: string;
236
+ lineSymbols: boolean;
237
+ lineSymbolShape: string;
238
+ lineSymbolShowOn: string;
239
+ lineSymbolStyle: string;
240
+ lineSymbolSize: string;
241
+ lineSymbolOpacity: string;
242
+ displayAsPercentage: boolean;
243
+ showTotal: boolean;
244
+ showLabels: boolean;
245
+ showValues: boolean;
246
+ swapLabelValue: boolean;
247
+ sliceMax: string;
248
+ sliceGroupLabel: string;
249
+ autoContrast: boolean;
250
+ allowDarkMode: boolean;
251
+ sortMode: SortMode;
252
+ barBackground: boolean;
253
+ barSeparators: boolean;
254
+ barGap: string;
255
+ connectedColumns: boolean;
256
+ connectionsOpacity: string;
257
+ stackMode: string;
258
+ stacked: boolean;
259
+ stackPercent: boolean;
260
+ areaSortMode: string;
261
+ areaLines: boolean;
262
+ areaFillOpacity: string;
263
+ edgePadding: boolean;
264
+ waterfall: boolean;
265
+ waterfallTotal: boolean;
266
+ sharedScale: boolean;
267
+ categoryLabelLine: boolean;
268
+ }
269
+ export type ChartTypeOptionKey = keyof ChartTypeOptions;