@tuicomponents/chart 0.2.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.
@@ -0,0 +1,2165 @@
1
+ import * as zod from 'zod';
2
+ import { z } from 'zod';
3
+ import { BaseTuiComponent, ComponentMetadata, RenderContext, RenderResult, TuiTheme } from '@tuicomponents/core';
4
+
5
+ /**
6
+ * Zod schemas for chart input validation.
7
+ */
8
+
9
+ /**
10
+ * Chart type variants.
11
+ */
12
+ declare const chartTypeSchema: z.ZodEnum<["bar", "bar-vertical", "bar-stacked", "bar-stacked-vertical", "line", "area", "area-stacked", "scatter", "pie", "donut", "heatmap"]>;
13
+ /**
14
+ * Style options for bar fill.
15
+ */
16
+ declare const barStyleSchema: z.ZodEnum<["block", "shaded", "light", "hash", "equals", "arrow"]>;
17
+ /**
18
+ * Style options for line rendering.
19
+ */
20
+ declare const lineStyleSchema: z.ZodEnum<["blocks", "braille", "dots"]>;
21
+ /**
22
+ * Style options for scatter plot rendering.
23
+ */
24
+ declare const scatterStyleSchema: z.ZodEnum<["dots", "braille"]>;
25
+ /**
26
+ * Marker shapes for scatter plot series distinction.
27
+ */
28
+ declare const scatterMarkerSchema: z.ZodEnum<["circle", "square", "triangle", "diamond", "plus"]>;
29
+ /**
30
+ * Style options for heatmap rendering.
31
+ */
32
+ declare const heatmapStyleSchema: z.ZodEnum<["blocks", "ascii", "numeric"]>;
33
+ /**
34
+ * Value format options.
35
+ */
36
+ declare const valueFormatSchema: z.ZodEnum<["number", "percent", "compact", "currency"]>;
37
+ /**
38
+ * Legend position options.
39
+ */
40
+ declare const legendPositionSchema: z.ZodEnum<["none", "top", "bottom", "right", "inline"]>;
41
+ /**
42
+ * A single data point in a chart.
43
+ */
44
+ declare const dataPointSchema: z.ZodObject<{
45
+ /**
46
+ * Category or x-value.
47
+ * Can be a string (categorical) or number (continuous).
48
+ */
49
+ x: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
50
+ /**
51
+ * Numeric y-value.
52
+ */
53
+ y: z.ZodNumber;
54
+ /**
55
+ * Optional custom label for this data point.
56
+ */
57
+ label: z.ZodOptional<z.ZodString>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ x: string | number;
60
+ y: number;
61
+ label?: string | undefined;
62
+ }, {
63
+ x: string | number;
64
+ y: number;
65
+ label?: string | undefined;
66
+ }>;
67
+ /**
68
+ * A series of data points.
69
+ */
70
+ declare const dataSeriesSchema: z.ZodObject<{
71
+ /**
72
+ * Series name (used in legend).
73
+ */
74
+ name: z.ZodString;
75
+ /**
76
+ * Data points in this series.
77
+ */
78
+ data: z.ZodArray<z.ZodObject<{
79
+ /**
80
+ * Category or x-value.
81
+ * Can be a string (categorical) or number (continuous).
82
+ */
83
+ x: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
84
+ /**
85
+ * Numeric y-value.
86
+ */
87
+ y: z.ZodNumber;
88
+ /**
89
+ * Optional custom label for this data point.
90
+ */
91
+ label: z.ZodOptional<z.ZodString>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ x: string | number;
94
+ y: number;
95
+ label?: string | undefined;
96
+ }, {
97
+ x: string | number;
98
+ y: number;
99
+ label?: string | undefined;
100
+ }>, "many">;
101
+ /**
102
+ * Optional style for this series.
103
+ */
104
+ style: z.ZodOptional<z.ZodEnum<["block", "shaded", "light", "hash", "equals", "arrow"]>>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ name: string;
107
+ data: {
108
+ x: string | number;
109
+ y: number;
110
+ label?: string | undefined;
111
+ }[];
112
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
113
+ }, {
114
+ name: string;
115
+ data: {
116
+ x: string | number;
117
+ y: number;
118
+ label?: string | undefined;
119
+ }[];
120
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
121
+ }>;
122
+ /**
123
+ * Axis configuration.
124
+ */
125
+ declare const axisConfigSchema: z.ZodObject<{
126
+ /**
127
+ * Axis title/label.
128
+ */
129
+ label: z.ZodOptional<z.ZodString>;
130
+ /**
131
+ * Explicit minimum value (auto-computed if not set).
132
+ */
133
+ min: z.ZodOptional<z.ZodNumber>;
134
+ /**
135
+ * Explicit maximum value (auto-computed if not set).
136
+ */
137
+ max: z.ZodOptional<z.ZodNumber>;
138
+ /**
139
+ * Number of tick marks.
140
+ * @default 5
141
+ */
142
+ tickCount: z.ZodDefault<z.ZodNumber>;
143
+ /**
144
+ * Whether to show tick marks.
145
+ * @default true
146
+ */
147
+ showTicks: z.ZodDefault<z.ZodBoolean>;
148
+ /**
149
+ * Value format for tick labels.
150
+ * @default "number"
151
+ */
152
+ format: z.ZodDefault<z.ZodEnum<["number", "percent", "compact", "currency"]>>;
153
+ /**
154
+ * Number of decimal places.
155
+ */
156
+ decimals: z.ZodOptional<z.ZodNumber>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ tickCount: number;
159
+ showTicks: boolean;
160
+ format: "number" | "percent" | "compact" | "currency";
161
+ label?: string | undefined;
162
+ min?: number | undefined;
163
+ max?: number | undefined;
164
+ decimals?: number | undefined;
165
+ }, {
166
+ label?: string | undefined;
167
+ min?: number | undefined;
168
+ max?: number | undefined;
169
+ tickCount?: number | undefined;
170
+ showTicks?: boolean | undefined;
171
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
172
+ decimals?: number | undefined;
173
+ }>;
174
+ /**
175
+ * Legend configuration.
176
+ */
177
+ declare const legendConfigSchema: z.ZodObject<{
178
+ /**
179
+ * Legend position.
180
+ * @default "bottom"
181
+ */
182
+ position: z.ZodDefault<z.ZodEnum<["none", "top", "bottom", "right", "inline"]>>;
183
+ /**
184
+ * Whether to use boxed style.
185
+ * @default false
186
+ */
187
+ boxed: z.ZodDefault<z.ZodBoolean>;
188
+ }, "strip", z.ZodTypeAny, {
189
+ position: "none" | "top" | "bottom" | "right" | "inline";
190
+ boxed: boolean;
191
+ }, {
192
+ position?: "none" | "top" | "bottom" | "right" | "inline" | undefined;
193
+ boxed?: boolean | undefined;
194
+ }>;
195
+ /**
196
+ * Grid configuration.
197
+ */
198
+ declare const gridConfigSchema: z.ZodObject<{
199
+ /**
200
+ * Show horizontal grid lines.
201
+ * @default false
202
+ */
203
+ horizontal: z.ZodDefault<z.ZodBoolean>;
204
+ /**
205
+ * Show vertical grid lines.
206
+ * @default false
207
+ */
208
+ vertical: z.ZodDefault<z.ZodBoolean>;
209
+ /**
210
+ * Grid character.
211
+ * @default "·"
212
+ */
213
+ char: z.ZodDefault<z.ZodString>;
214
+ }, "strip", z.ZodTypeAny, {
215
+ horizontal: boolean;
216
+ vertical: boolean;
217
+ char: string;
218
+ }, {
219
+ horizontal?: boolean | undefined;
220
+ vertical?: boolean | undefined;
221
+ char?: string | undefined;
222
+ }>;
223
+ /**
224
+ * Main chart input schema.
225
+ */
226
+ declare const chartInputSchema: z.ZodObject<{
227
+ /**
228
+ * Chart type.
229
+ */
230
+ type: z.ZodEnum<["bar", "bar-vertical", "bar-stacked", "bar-stacked-vertical", "line", "area", "area-stacked", "scatter", "pie", "donut", "heatmap"]>;
231
+ /**
232
+ * Data series to display.
233
+ */
234
+ series: z.ZodArray<z.ZodObject<{
235
+ /**
236
+ * Series name (used in legend).
237
+ */
238
+ name: z.ZodString;
239
+ /**
240
+ * Data points in this series.
241
+ */
242
+ data: z.ZodArray<z.ZodObject<{
243
+ /**
244
+ * Category or x-value.
245
+ * Can be a string (categorical) or number (continuous).
246
+ */
247
+ x: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
248
+ /**
249
+ * Numeric y-value.
250
+ */
251
+ y: z.ZodNumber;
252
+ /**
253
+ * Optional custom label for this data point.
254
+ */
255
+ label: z.ZodOptional<z.ZodString>;
256
+ }, "strip", z.ZodTypeAny, {
257
+ x: string | number;
258
+ y: number;
259
+ label?: string | undefined;
260
+ }, {
261
+ x: string | number;
262
+ y: number;
263
+ label?: string | undefined;
264
+ }>, "many">;
265
+ /**
266
+ * Optional style for this series.
267
+ */
268
+ style: z.ZodOptional<z.ZodEnum<["block", "shaded", "light", "hash", "equals", "arrow"]>>;
269
+ }, "strip", z.ZodTypeAny, {
270
+ name: string;
271
+ data: {
272
+ x: string | number;
273
+ y: number;
274
+ label?: string | undefined;
275
+ }[];
276
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
277
+ }, {
278
+ name: string;
279
+ data: {
280
+ x: string | number;
281
+ y: number;
282
+ label?: string | undefined;
283
+ }[];
284
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
285
+ }>, "many">;
286
+ /**
287
+ * Chart title.
288
+ */
289
+ title: z.ZodOptional<z.ZodString>;
290
+ /**
291
+ * X-axis configuration.
292
+ */
293
+ xAxis: z.ZodOptional<z.ZodObject<{
294
+ /**
295
+ * Axis title/label.
296
+ */
297
+ label: z.ZodOptional<z.ZodString>;
298
+ /**
299
+ * Explicit minimum value (auto-computed if not set).
300
+ */
301
+ min: z.ZodOptional<z.ZodNumber>;
302
+ /**
303
+ * Explicit maximum value (auto-computed if not set).
304
+ */
305
+ max: z.ZodOptional<z.ZodNumber>;
306
+ /**
307
+ * Number of tick marks.
308
+ * @default 5
309
+ */
310
+ tickCount: z.ZodDefault<z.ZodNumber>;
311
+ /**
312
+ * Whether to show tick marks.
313
+ * @default true
314
+ */
315
+ showTicks: z.ZodDefault<z.ZodBoolean>;
316
+ /**
317
+ * Value format for tick labels.
318
+ * @default "number"
319
+ */
320
+ format: z.ZodDefault<z.ZodEnum<["number", "percent", "compact", "currency"]>>;
321
+ /**
322
+ * Number of decimal places.
323
+ */
324
+ decimals: z.ZodOptional<z.ZodNumber>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ tickCount: number;
327
+ showTicks: boolean;
328
+ format: "number" | "percent" | "compact" | "currency";
329
+ label?: string | undefined;
330
+ min?: number | undefined;
331
+ max?: number | undefined;
332
+ decimals?: number | undefined;
333
+ }, {
334
+ label?: string | undefined;
335
+ min?: number | undefined;
336
+ max?: number | undefined;
337
+ tickCount?: number | undefined;
338
+ showTicks?: boolean | undefined;
339
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
340
+ decimals?: number | undefined;
341
+ }>>;
342
+ /**
343
+ * Y-axis configuration.
344
+ */
345
+ yAxis: z.ZodOptional<z.ZodObject<{
346
+ /**
347
+ * Axis title/label.
348
+ */
349
+ label: z.ZodOptional<z.ZodString>;
350
+ /**
351
+ * Explicit minimum value (auto-computed if not set).
352
+ */
353
+ min: z.ZodOptional<z.ZodNumber>;
354
+ /**
355
+ * Explicit maximum value (auto-computed if not set).
356
+ */
357
+ max: z.ZodOptional<z.ZodNumber>;
358
+ /**
359
+ * Number of tick marks.
360
+ * @default 5
361
+ */
362
+ tickCount: z.ZodDefault<z.ZodNumber>;
363
+ /**
364
+ * Whether to show tick marks.
365
+ * @default true
366
+ */
367
+ showTicks: z.ZodDefault<z.ZodBoolean>;
368
+ /**
369
+ * Value format for tick labels.
370
+ * @default "number"
371
+ */
372
+ format: z.ZodDefault<z.ZodEnum<["number", "percent", "compact", "currency"]>>;
373
+ /**
374
+ * Number of decimal places.
375
+ */
376
+ decimals: z.ZodOptional<z.ZodNumber>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ tickCount: number;
379
+ showTicks: boolean;
380
+ format: "number" | "percent" | "compact" | "currency";
381
+ label?: string | undefined;
382
+ min?: number | undefined;
383
+ max?: number | undefined;
384
+ decimals?: number | undefined;
385
+ }, {
386
+ label?: string | undefined;
387
+ min?: number | undefined;
388
+ max?: number | undefined;
389
+ tickCount?: number | undefined;
390
+ showTicks?: boolean | undefined;
391
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
392
+ decimals?: number | undefined;
393
+ }>>;
394
+ /**
395
+ * Legend configuration.
396
+ */
397
+ legend: z.ZodOptional<z.ZodObject<{
398
+ /**
399
+ * Legend position.
400
+ * @default "bottom"
401
+ */
402
+ position: z.ZodDefault<z.ZodEnum<["none", "top", "bottom", "right", "inline"]>>;
403
+ /**
404
+ * Whether to use boxed style.
405
+ * @default false
406
+ */
407
+ boxed: z.ZodDefault<z.ZodBoolean>;
408
+ }, "strip", z.ZodTypeAny, {
409
+ position: "none" | "top" | "bottom" | "right" | "inline";
410
+ boxed: boolean;
411
+ }, {
412
+ position?: "none" | "top" | "bottom" | "right" | "inline" | undefined;
413
+ boxed?: boolean | undefined;
414
+ }>>;
415
+ /**
416
+ * Grid configuration.
417
+ */
418
+ grid: z.ZodOptional<z.ZodObject<{
419
+ /**
420
+ * Show horizontal grid lines.
421
+ * @default false
422
+ */
423
+ horizontal: z.ZodDefault<z.ZodBoolean>;
424
+ /**
425
+ * Show vertical grid lines.
426
+ * @default false
427
+ */
428
+ vertical: z.ZodDefault<z.ZodBoolean>;
429
+ /**
430
+ * Grid character.
431
+ * @default "·"
432
+ */
433
+ char: z.ZodDefault<z.ZodString>;
434
+ }, "strip", z.ZodTypeAny, {
435
+ horizontal: boolean;
436
+ vertical: boolean;
437
+ char: string;
438
+ }, {
439
+ horizontal?: boolean | undefined;
440
+ vertical?: boolean | undefined;
441
+ char?: string | undefined;
442
+ }>>;
443
+ /**
444
+ * Chart width in characters.
445
+ * @default 40
446
+ */
447
+ width: z.ZodDefault<z.ZodNumber>;
448
+ /**
449
+ * Chart height in lines.
450
+ * @default 10
451
+ */
452
+ height: z.ZodDefault<z.ZodNumber>;
453
+ /**
454
+ * Show values on data points.
455
+ * @default false
456
+ */
457
+ showValues: z.ZodDefault<z.ZodBoolean>;
458
+ /**
459
+ * Show axes.
460
+ * @default true
461
+ */
462
+ showAxes: z.ZodDefault<z.ZodBoolean>;
463
+ /**
464
+ * Line/area rendering style.
465
+ * @default "blocks"
466
+ */
467
+ lineStyle: z.ZodDefault<z.ZodEnum<["blocks", "braille", "dots"]>>;
468
+ /**
469
+ * Default bar style for series without explicit style.
470
+ * @default "block"
471
+ */
472
+ barStyle: z.ZodDefault<z.ZodEnum<["block", "shaded", "light", "hash", "equals", "arrow"]>>;
473
+ /**
474
+ * Scatter plot rendering style.
475
+ * @default "dots"
476
+ */
477
+ scatterStyle: z.ZodDefault<z.ZodEnum<["dots", "braille"]>>;
478
+ /**
479
+ * Heatmap rendering style.
480
+ * @default "blocks"
481
+ */
482
+ heatmapStyle: z.ZodDefault<z.ZodEnum<["blocks", "ascii", "numeric"]>>;
483
+ /**
484
+ * Center label for donut charts.
485
+ * Displayed in the center of the donut.
486
+ */
487
+ centerLabel: z.ZodOptional<z.ZodString>;
488
+ /**
489
+ * Inner radius ratio for donut charts (0-0.9).
490
+ * 0 = pie chart, 0.5 = typical donut.
491
+ * @default 0.5
492
+ */
493
+ innerRadius: z.ZodDefault<z.ZodNumber>;
494
+ }, "strip", z.ZodTypeAny, {
495
+ type: "bar" | "bar-vertical" | "bar-stacked" | "bar-stacked-vertical" | "line" | "area" | "area-stacked" | "scatter" | "pie" | "donut" | "heatmap";
496
+ series: {
497
+ name: string;
498
+ data: {
499
+ x: string | number;
500
+ y: number;
501
+ label?: string | undefined;
502
+ }[];
503
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
504
+ }[];
505
+ width: number;
506
+ height: number;
507
+ showValues: boolean;
508
+ showAxes: boolean;
509
+ lineStyle: "blocks" | "braille" | "dots";
510
+ barStyle: "block" | "shaded" | "light" | "hash" | "equals" | "arrow";
511
+ scatterStyle: "braille" | "dots";
512
+ heatmapStyle: "blocks" | "ascii" | "numeric";
513
+ innerRadius: number;
514
+ title?: string | undefined;
515
+ xAxis?: {
516
+ tickCount: number;
517
+ showTicks: boolean;
518
+ format: "number" | "percent" | "compact" | "currency";
519
+ label?: string | undefined;
520
+ min?: number | undefined;
521
+ max?: number | undefined;
522
+ decimals?: number | undefined;
523
+ } | undefined;
524
+ yAxis?: {
525
+ tickCount: number;
526
+ showTicks: boolean;
527
+ format: "number" | "percent" | "compact" | "currency";
528
+ label?: string | undefined;
529
+ min?: number | undefined;
530
+ max?: number | undefined;
531
+ decimals?: number | undefined;
532
+ } | undefined;
533
+ legend?: {
534
+ position: "none" | "top" | "bottom" | "right" | "inline";
535
+ boxed: boolean;
536
+ } | undefined;
537
+ grid?: {
538
+ horizontal: boolean;
539
+ vertical: boolean;
540
+ char: string;
541
+ } | undefined;
542
+ centerLabel?: string | undefined;
543
+ }, {
544
+ type: "bar" | "bar-vertical" | "bar-stacked" | "bar-stacked-vertical" | "line" | "area" | "area-stacked" | "scatter" | "pie" | "donut" | "heatmap";
545
+ series: {
546
+ name: string;
547
+ data: {
548
+ x: string | number;
549
+ y: number;
550
+ label?: string | undefined;
551
+ }[];
552
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
553
+ }[];
554
+ title?: string | undefined;
555
+ xAxis?: {
556
+ label?: string | undefined;
557
+ min?: number | undefined;
558
+ max?: number | undefined;
559
+ tickCount?: number | undefined;
560
+ showTicks?: boolean | undefined;
561
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
562
+ decimals?: number | undefined;
563
+ } | undefined;
564
+ yAxis?: {
565
+ label?: string | undefined;
566
+ min?: number | undefined;
567
+ max?: number | undefined;
568
+ tickCount?: number | undefined;
569
+ showTicks?: boolean | undefined;
570
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
571
+ decimals?: number | undefined;
572
+ } | undefined;
573
+ legend?: {
574
+ position?: "none" | "top" | "bottom" | "right" | "inline" | undefined;
575
+ boxed?: boolean | undefined;
576
+ } | undefined;
577
+ grid?: {
578
+ horizontal?: boolean | undefined;
579
+ vertical?: boolean | undefined;
580
+ char?: string | undefined;
581
+ } | undefined;
582
+ width?: number | undefined;
583
+ height?: number | undefined;
584
+ showValues?: boolean | undefined;
585
+ showAxes?: boolean | undefined;
586
+ lineStyle?: "blocks" | "braille" | "dots" | undefined;
587
+ barStyle?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
588
+ scatterStyle?: "braille" | "dots" | undefined;
589
+ heatmapStyle?: "blocks" | "ascii" | "numeric" | undefined;
590
+ centerLabel?: string | undefined;
591
+ innerRadius?: number | undefined;
592
+ }>;
593
+
594
+ /**
595
+ * Shared TypeScript types for the chart system.
596
+ */
597
+
598
+ /**
599
+ * Chart type variants.
600
+ */
601
+ type ChartType = z.infer<typeof chartTypeSchema>;
602
+ /**
603
+ * Style options for bar fill characters.
604
+ */
605
+ type BarStyle = z.infer<typeof barStyleSchema>;
606
+ /**
607
+ * Style options for line rendering.
608
+ */
609
+ type LineStyle = z.infer<typeof lineStyleSchema>;
610
+ /**
611
+ * Value format options for axis labels.
612
+ */
613
+ type ValueFormat = z.infer<typeof valueFormatSchema>;
614
+ /**
615
+ * Style options for scatter plot rendering.
616
+ */
617
+ type ScatterStyle = z.infer<typeof scatterStyleSchema>;
618
+ /**
619
+ * Marker shapes for scatter plot series.
620
+ */
621
+ type ScatterMarker = z.infer<typeof scatterMarkerSchema>;
622
+ /**
623
+ * Style options for heatmap rendering.
624
+ */
625
+ type HeatmapStyle = z.infer<typeof heatmapStyleSchema>;
626
+ /**
627
+ * A single data point in a chart.
628
+ */
629
+ type DataPoint = z.infer<typeof dataPointSchema>;
630
+ /**
631
+ * A series of data points with styling.
632
+ */
633
+ type DataSeries = z.infer<typeof dataSeriesSchema>;
634
+ /**
635
+ * Axis configuration.
636
+ */
637
+ type AxisConfig = z.infer<typeof axisConfigSchema>;
638
+ /**
639
+ * Legend configuration.
640
+ */
641
+ type LegendConfig = z.infer<typeof legendConfigSchema>;
642
+ /**
643
+ * Grid configuration.
644
+ */
645
+ type GridConfig = z.infer<typeof gridConfigSchema>;
646
+ /**
647
+ * Chart input (before defaults applied).
648
+ */
649
+ type ChartInput = z.input<typeof chartInputSchema>;
650
+ /**
651
+ * Chart input with defaults applied.
652
+ */
653
+ type ChartInputWithDefaults = z.output<typeof chartInputSchema>;
654
+ /**
655
+ * Computed layout for a single bar.
656
+ */
657
+ interface BarLayout {
658
+ /** Series index */
659
+ seriesIndex: number;
660
+ /** Data point index within series */
661
+ pointIndex: number;
662
+ /** Category label or x value */
663
+ label: string;
664
+ /** Numeric value */
665
+ value: number;
666
+ /** Scaled bar length (in characters) */
667
+ length: number;
668
+ /** Formatted value string */
669
+ formattedValue: string;
670
+ /** Bar fill character */
671
+ barChar: string;
672
+ /** Whether to use backticks for markdown */
673
+ useBackticks: boolean;
674
+ /** Percentage of max (0-100) */
675
+ percentage: number;
676
+ }
677
+ /**
678
+ * Computed layout for stacked bars at a single category.
679
+ */
680
+ interface StackedBarLayout {
681
+ /** Category label */
682
+ label: string;
683
+ /** Segments from bottom to top */
684
+ segments: BarLayout[];
685
+ /** Total value */
686
+ total: number;
687
+ }
688
+ /**
689
+ * Computed layout for a line chart row.
690
+ */
691
+ interface LineRowLayout {
692
+ /** Y-axis label for this row (optional) */
693
+ yLabel?: string;
694
+ /** Characters for each column */
695
+ chars: string[];
696
+ /** Whether each column uses backticks */
697
+ useBackticks: boolean[];
698
+ }
699
+ /**
700
+ * Computed layout for the entire chart.
701
+ */
702
+ interface ChartLayout {
703
+ /** Chart type */
704
+ type: ChartType;
705
+ /** Width of chart area (characters) */
706
+ width: number;
707
+ /** Height of chart area (lines) */
708
+ height: number;
709
+ /** Y-axis label width (for alignment) */
710
+ yAxisWidth: number;
711
+ /** Whether to show axes */
712
+ showAxes: boolean;
713
+ /** Content rows (from top to bottom) */
714
+ rows: string[][];
715
+ /** Title line (if present) */
716
+ title?: string;
717
+ }
718
+
719
+ /**
720
+ * Chart component for rendering various chart types.
721
+ */
722
+ declare class ChartComponent extends BaseTuiComponent<ChartInput, typeof chartInputSchema> {
723
+ readonly metadata: ComponentMetadata<ChartInput>;
724
+ readonly schema: zod.ZodObject<{
725
+ type: zod.ZodEnum<["bar", "bar-vertical", "bar-stacked", "bar-stacked-vertical", "line", "area", "area-stacked", "scatter", "pie", "donut", "heatmap"]>;
726
+ series: zod.ZodArray<zod.ZodObject<{
727
+ name: zod.ZodString;
728
+ data: zod.ZodArray<zod.ZodObject<{
729
+ x: zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>;
730
+ y: zod.ZodNumber;
731
+ label: zod.ZodOptional<zod.ZodString>;
732
+ }, "strip", zod.ZodTypeAny, {
733
+ x: string | number;
734
+ y: number;
735
+ label?: string | undefined;
736
+ }, {
737
+ x: string | number;
738
+ y: number;
739
+ label?: string | undefined;
740
+ }>, "many">;
741
+ style: zod.ZodOptional<zod.ZodEnum<["block", "shaded", "light", "hash", "equals", "arrow"]>>;
742
+ }, "strip", zod.ZodTypeAny, {
743
+ name: string;
744
+ data: {
745
+ x: string | number;
746
+ y: number;
747
+ label?: string | undefined;
748
+ }[];
749
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
750
+ }, {
751
+ name: string;
752
+ data: {
753
+ x: string | number;
754
+ y: number;
755
+ label?: string | undefined;
756
+ }[];
757
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
758
+ }>, "many">;
759
+ title: zod.ZodOptional<zod.ZodString>;
760
+ xAxis: zod.ZodOptional<zod.ZodObject<{
761
+ label: zod.ZodOptional<zod.ZodString>;
762
+ min: zod.ZodOptional<zod.ZodNumber>;
763
+ max: zod.ZodOptional<zod.ZodNumber>;
764
+ tickCount: zod.ZodDefault<zod.ZodNumber>;
765
+ showTicks: zod.ZodDefault<zod.ZodBoolean>;
766
+ format: zod.ZodDefault<zod.ZodEnum<["number", "percent", "compact", "currency"]>>;
767
+ decimals: zod.ZodOptional<zod.ZodNumber>;
768
+ }, "strip", zod.ZodTypeAny, {
769
+ tickCount: number;
770
+ showTicks: boolean;
771
+ format: "number" | "percent" | "compact" | "currency";
772
+ label?: string | undefined;
773
+ min?: number | undefined;
774
+ max?: number | undefined;
775
+ decimals?: number | undefined;
776
+ }, {
777
+ label?: string | undefined;
778
+ min?: number | undefined;
779
+ max?: number | undefined;
780
+ tickCount?: number | undefined;
781
+ showTicks?: boolean | undefined;
782
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
783
+ decimals?: number | undefined;
784
+ }>>;
785
+ yAxis: zod.ZodOptional<zod.ZodObject<{
786
+ label: zod.ZodOptional<zod.ZodString>;
787
+ min: zod.ZodOptional<zod.ZodNumber>;
788
+ max: zod.ZodOptional<zod.ZodNumber>;
789
+ tickCount: zod.ZodDefault<zod.ZodNumber>;
790
+ showTicks: zod.ZodDefault<zod.ZodBoolean>;
791
+ format: zod.ZodDefault<zod.ZodEnum<["number", "percent", "compact", "currency"]>>;
792
+ decimals: zod.ZodOptional<zod.ZodNumber>;
793
+ }, "strip", zod.ZodTypeAny, {
794
+ tickCount: number;
795
+ showTicks: boolean;
796
+ format: "number" | "percent" | "compact" | "currency";
797
+ label?: string | undefined;
798
+ min?: number | undefined;
799
+ max?: number | undefined;
800
+ decimals?: number | undefined;
801
+ }, {
802
+ label?: string | undefined;
803
+ min?: number | undefined;
804
+ max?: number | undefined;
805
+ tickCount?: number | undefined;
806
+ showTicks?: boolean | undefined;
807
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
808
+ decimals?: number | undefined;
809
+ }>>;
810
+ legend: zod.ZodOptional<zod.ZodObject<{
811
+ position: zod.ZodDefault<zod.ZodEnum<["none", "top", "bottom", "right", "inline"]>>;
812
+ boxed: zod.ZodDefault<zod.ZodBoolean>;
813
+ }, "strip", zod.ZodTypeAny, {
814
+ position: "none" | "top" | "bottom" | "right" | "inline";
815
+ boxed: boolean;
816
+ }, {
817
+ position?: "none" | "top" | "bottom" | "right" | "inline" | undefined;
818
+ boxed?: boolean | undefined;
819
+ }>>;
820
+ grid: zod.ZodOptional<zod.ZodObject<{
821
+ horizontal: zod.ZodDefault<zod.ZodBoolean>;
822
+ vertical: zod.ZodDefault<zod.ZodBoolean>;
823
+ char: zod.ZodDefault<zod.ZodString>;
824
+ }, "strip", zod.ZodTypeAny, {
825
+ horizontal: boolean;
826
+ vertical: boolean;
827
+ char: string;
828
+ }, {
829
+ horizontal?: boolean | undefined;
830
+ vertical?: boolean | undefined;
831
+ char?: string | undefined;
832
+ }>>;
833
+ width: zod.ZodDefault<zod.ZodNumber>;
834
+ height: zod.ZodDefault<zod.ZodNumber>;
835
+ showValues: zod.ZodDefault<zod.ZodBoolean>;
836
+ showAxes: zod.ZodDefault<zod.ZodBoolean>;
837
+ lineStyle: zod.ZodDefault<zod.ZodEnum<["blocks", "braille", "dots"]>>;
838
+ barStyle: zod.ZodDefault<zod.ZodEnum<["block", "shaded", "light", "hash", "equals", "arrow"]>>;
839
+ scatterStyle: zod.ZodDefault<zod.ZodEnum<["dots", "braille"]>>;
840
+ heatmapStyle: zod.ZodDefault<zod.ZodEnum<["blocks", "ascii", "numeric"]>>;
841
+ centerLabel: zod.ZodOptional<zod.ZodString>;
842
+ innerRadius: zod.ZodDefault<zod.ZodNumber>;
843
+ }, "strip", zod.ZodTypeAny, {
844
+ type: "bar" | "bar-vertical" | "bar-stacked" | "bar-stacked-vertical" | "line" | "area" | "area-stacked" | "scatter" | "pie" | "donut" | "heatmap";
845
+ series: {
846
+ name: string;
847
+ data: {
848
+ x: string | number;
849
+ y: number;
850
+ label?: string | undefined;
851
+ }[];
852
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
853
+ }[];
854
+ width: number;
855
+ height: number;
856
+ showValues: boolean;
857
+ showAxes: boolean;
858
+ lineStyle: "blocks" | "braille" | "dots";
859
+ barStyle: "block" | "shaded" | "light" | "hash" | "equals" | "arrow";
860
+ scatterStyle: "braille" | "dots";
861
+ heatmapStyle: "blocks" | "ascii" | "numeric";
862
+ innerRadius: number;
863
+ title?: string | undefined;
864
+ xAxis?: {
865
+ tickCount: number;
866
+ showTicks: boolean;
867
+ format: "number" | "percent" | "compact" | "currency";
868
+ label?: string | undefined;
869
+ min?: number | undefined;
870
+ max?: number | undefined;
871
+ decimals?: number | undefined;
872
+ } | undefined;
873
+ yAxis?: {
874
+ tickCount: number;
875
+ showTicks: boolean;
876
+ format: "number" | "percent" | "compact" | "currency";
877
+ label?: string | undefined;
878
+ min?: number | undefined;
879
+ max?: number | undefined;
880
+ decimals?: number | undefined;
881
+ } | undefined;
882
+ legend?: {
883
+ position: "none" | "top" | "bottom" | "right" | "inline";
884
+ boxed: boolean;
885
+ } | undefined;
886
+ grid?: {
887
+ horizontal: boolean;
888
+ vertical: boolean;
889
+ char: string;
890
+ } | undefined;
891
+ centerLabel?: string | undefined;
892
+ }, {
893
+ type: "bar" | "bar-vertical" | "bar-stacked" | "bar-stacked-vertical" | "line" | "area" | "area-stacked" | "scatter" | "pie" | "donut" | "heatmap";
894
+ series: {
895
+ name: string;
896
+ data: {
897
+ x: string | number;
898
+ y: number;
899
+ label?: string | undefined;
900
+ }[];
901
+ style?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
902
+ }[];
903
+ title?: string | undefined;
904
+ xAxis?: {
905
+ label?: string | undefined;
906
+ min?: number | undefined;
907
+ max?: number | undefined;
908
+ tickCount?: number | undefined;
909
+ showTicks?: boolean | undefined;
910
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
911
+ decimals?: number | undefined;
912
+ } | undefined;
913
+ yAxis?: {
914
+ label?: string | undefined;
915
+ min?: number | undefined;
916
+ max?: number | undefined;
917
+ tickCount?: number | undefined;
918
+ showTicks?: boolean | undefined;
919
+ format?: "number" | "percent" | "compact" | "currency" | undefined;
920
+ decimals?: number | undefined;
921
+ } | undefined;
922
+ legend?: {
923
+ position?: "none" | "top" | "bottom" | "right" | "inline" | undefined;
924
+ boxed?: boolean | undefined;
925
+ } | undefined;
926
+ grid?: {
927
+ horizontal?: boolean | undefined;
928
+ vertical?: boolean | undefined;
929
+ char?: string | undefined;
930
+ } | undefined;
931
+ width?: number | undefined;
932
+ height?: number | undefined;
933
+ showValues?: boolean | undefined;
934
+ showAxes?: boolean | undefined;
935
+ lineStyle?: "blocks" | "braille" | "dots" | undefined;
936
+ barStyle?: "block" | "shaded" | "light" | "hash" | "equals" | "arrow" | undefined;
937
+ scatterStyle?: "braille" | "dots" | undefined;
938
+ heatmapStyle?: "blocks" | "ascii" | "numeric" | undefined;
939
+ centerLabel?: string | undefined;
940
+ innerRadius?: number | undefined;
941
+ }>;
942
+ getJsonSchema(): object;
943
+ render(input: ChartInput, context: RenderContext): RenderResult;
944
+ }
945
+ /**
946
+ * Factory function to create a chart component.
947
+ */
948
+ declare function createChart(): ChartComponent;
949
+
950
+ /**
951
+ * Auto-scaling and nice number algorithms for axis ticks.
952
+ *
953
+ * Implements the standard D3.js-style nice interval algorithm
954
+ * for producing human-readable axis tick values.
955
+ */
956
+ /**
957
+ * Configuration for nice number computation.
958
+ */
959
+ interface NiceTicksOptions {
960
+ /** Minimum data value */
961
+ dataMin: number;
962
+ /** Maximum data value */
963
+ dataMax: number;
964
+ /** Desired number of ticks (default: 5) */
965
+ tickCount?: number | undefined;
966
+ /** Whether to include zero if data is all positive (default: true) */
967
+ includeZero?: boolean | undefined;
968
+ /** Explicit minimum (overrides computed) */
969
+ forceMin?: number | undefined;
970
+ /** Explicit maximum (overrides computed) */
971
+ forceMax?: number | undefined;
972
+ }
973
+ /**
974
+ * Result from nice tick computation.
975
+ */
976
+ interface NiceTicksResult {
977
+ /** Computed nice minimum */
978
+ min: number;
979
+ /** Computed nice maximum */
980
+ max: number;
981
+ /** Tick step size */
982
+ step: number;
983
+ /** Array of tick values */
984
+ ticks: number[];
985
+ }
986
+ /**
987
+ * Compute nice axis ticks for a data range.
988
+ *
989
+ * This implements the standard algorithm for producing readable tick values:
990
+ * 1. Compute raw step from range and desired tick count
991
+ * 2. Round step to a nice interval (1, 2, 2.5, 5, 10 × 10^n)
992
+ * 3. Round min/max to nice boundaries
993
+ * 4. Generate evenly spaced tick values
994
+ *
995
+ * @param options - Configuration options
996
+ * @returns Computed ticks with nice min/max/step
997
+ *
998
+ * @example
999
+ * ```ts
1000
+ * computeNiceTicks({ dataMin: 3, dataMax: 97 })
1001
+ * // Returns { min: 0, max: 100, step: 20, ticks: [0, 20, 40, 60, 80, 100] }
1002
+ *
1003
+ * computeNiceTicks({ dataMin: 0.003, dataMax: 0.097, tickCount: 4 })
1004
+ * // Returns { min: 0, max: 0.1, step: 0.025, ticks: [0, 0.025, 0.05, 0.075, 0.1] }
1005
+ * ```
1006
+ */
1007
+ declare function computeNiceTicks(options: NiceTicksOptions): NiceTicksResult;
1008
+ /**
1009
+ * Format a tick value for display.
1010
+ *
1011
+ * @param value - Numeric value
1012
+ * @param format - Format type
1013
+ * @param decimals - Number of decimal places
1014
+ * @returns Formatted string
1015
+ */
1016
+ declare function formatTickValue(value: number, format?: "number" | "percent" | "compact" | "currency", decimals?: number): string;
1017
+ /**
1018
+ * Compute the scale factor to map a value to a pixel position.
1019
+ *
1020
+ * @param value - Data value
1021
+ * @param min - Scale minimum
1022
+ * @param max - Scale maximum
1023
+ * @param size - Available size (pixels/characters)
1024
+ * @returns Position in range [0, size]
1025
+ */
1026
+ declare function scaleValue(value: number, min: number, max: number, size: number): number;
1027
+ /**
1028
+ * Inverse of scaleValue - map a position back to data value.
1029
+ *
1030
+ * @param position - Position in range [0, size]
1031
+ * @param min - Scale minimum
1032
+ * @param max - Scale maximum
1033
+ * @param size - Available size (pixels/characters)
1034
+ * @returns Data value
1035
+ */
1036
+ declare function unscaleValue(position: number, min: number, max: number, size: number): number;
1037
+
1038
+ /**
1039
+ * Axis layout computation for chart rendering.
1040
+ */
1041
+
1042
+ /**
1043
+ * Axis orientation.
1044
+ */
1045
+ type AxisOrientation = "horizontal" | "vertical";
1046
+ /**
1047
+ * Axis position relative to the chart area.
1048
+ */
1049
+ type AxisPosition = "left" | "right" | "top" | "bottom";
1050
+ /**
1051
+ * Configuration for axis layout computation.
1052
+ */
1053
+ interface AxisLayoutOptions {
1054
+ /** Data minimum value */
1055
+ dataMin: number;
1056
+ /** Data maximum value */
1057
+ dataMax: number;
1058
+ /** Available space for the axis (characters) */
1059
+ size: number;
1060
+ /** Axis orientation */
1061
+ orientation: AxisOrientation;
1062
+ /** Axis position */
1063
+ position: AxisPosition;
1064
+ /** Desired number of ticks */
1065
+ tickCount?: number;
1066
+ /** Whether to show tick marks */
1067
+ showTicks?: boolean;
1068
+ /** Label format */
1069
+ format?: "number" | "percent" | "compact" | "currency";
1070
+ /** Decimal places for labels */
1071
+ decimals?: number;
1072
+ /** Axis title */
1073
+ label?: string;
1074
+ /** Force minimum value */
1075
+ forceMin?: number;
1076
+ /** Force maximum value */
1077
+ forceMax?: number;
1078
+ /** Include zero in range */
1079
+ includeZero?: boolean;
1080
+ }
1081
+ /**
1082
+ * A single tick mark on an axis.
1083
+ */
1084
+ interface AxisTick {
1085
+ /** Tick value */
1086
+ value: number;
1087
+ /** Formatted label string */
1088
+ label: string;
1089
+ /** Position along axis (0 to size) */
1090
+ position: number;
1091
+ }
1092
+ /**
1093
+ * Computed axis layout.
1094
+ */
1095
+ interface AxisLayout {
1096
+ /** Axis orientation */
1097
+ orientation: AxisOrientation;
1098
+ /** Axis position */
1099
+ position: AxisPosition;
1100
+ /** Nice scale information */
1101
+ scale: NiceTicksResult;
1102
+ /** Computed tick marks */
1103
+ ticks: AxisTick[];
1104
+ /** Maximum label width (for alignment) */
1105
+ maxLabelWidth: number;
1106
+ /** Axis title */
1107
+ title?: string | undefined;
1108
+ /** Total axis width (including labels and padding) */
1109
+ totalWidth: number;
1110
+ /** Total axis height (including labels and padding) */
1111
+ totalHeight: number;
1112
+ }
1113
+ /**
1114
+ * Compute the layout for an axis.
1115
+ *
1116
+ * @param options - Axis configuration
1117
+ * @returns Computed axis layout
1118
+ */
1119
+ declare function computeAxisLayout(options: AxisLayoutOptions): AxisLayout;
1120
+ /**
1121
+ * Compute layouts for both axes of a chart.
1122
+ */
1123
+ interface DualAxisLayoutOptions {
1124
+ /** X-axis data min */
1125
+ xMin: number;
1126
+ /** X-axis data max */
1127
+ xMax: number;
1128
+ /** Y-axis data min */
1129
+ yMin: number;
1130
+ /** Y-axis data max */
1131
+ yMax: number;
1132
+ /** Chart width (characters) */
1133
+ chartWidth: number;
1134
+ /** Chart height (characters) */
1135
+ chartHeight: number;
1136
+ /** X-axis configuration */
1137
+ xAxis?: Partial<AxisLayoutOptions>;
1138
+ /** Y-axis configuration */
1139
+ yAxis?: Partial<AxisLayoutOptions>;
1140
+ }
1141
+ /**
1142
+ * Result of dual axis computation.
1143
+ */
1144
+ interface DualAxisLayout {
1145
+ /** X-axis layout */
1146
+ xAxis: AxisLayout;
1147
+ /** Y-axis layout */
1148
+ yAxis: AxisLayout;
1149
+ /** Available chart area width after axis labels */
1150
+ chartAreaWidth: number;
1151
+ /** Available chart area height after axis labels */
1152
+ chartAreaHeight: number;
1153
+ /** X offset of chart area */
1154
+ chartAreaX: number;
1155
+ /** Y offset of chart area */
1156
+ chartAreaY: number;
1157
+ }
1158
+ /**
1159
+ * Compute layouts for both X and Y axes.
1160
+ *
1161
+ * @param options - Dual axis configuration
1162
+ * @returns Both axis layouts and chart area dimensions
1163
+ */
1164
+ declare function computeDualAxisLayout(options: DualAxisLayoutOptions): DualAxisLayout;
1165
+
1166
+ /**
1167
+ * Box-drawing and block characters for chart rendering.
1168
+ */
1169
+ /**
1170
+ * Axis line characters using Unicode box-drawing.
1171
+ */
1172
+ declare const AXIS_CHARS: {
1173
+ /** Y-axis line (│) */
1174
+ readonly vertical: "│";
1175
+ /** X-axis line (─) */
1176
+ readonly horizontal: "─";
1177
+ /** Origin corner (└) */
1178
+ readonly origin: "└";
1179
+ /** Y-axis tick (├) - points right */
1180
+ readonly yTick: "├";
1181
+ /** X-axis tick (┬) - points up */
1182
+ readonly xTick: "┬";
1183
+ /** Grid intersection (┼) */
1184
+ readonly cross: "┼";
1185
+ /** Y-axis with grid (┤) - points left */
1186
+ readonly yTickLeft: "┤";
1187
+ /** X-axis tick (┴) - points down */
1188
+ readonly xTickDown: "┴";
1189
+ };
1190
+ /**
1191
+ * Height blocks for line/area charts.
1192
+ * 8 levels of vertical fill from 1/8 to full.
1193
+ */
1194
+ declare const HEIGHT_BLOCKS: readonly ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"];
1195
+ /**
1196
+ * Bar fill characters for different visual styles.
1197
+ */
1198
+ declare const BAR_CHARS: {
1199
+ /** Solid block █ */
1200
+ readonly block: "█";
1201
+ /** Dark shade ▓ */
1202
+ readonly shaded: "▓";
1203
+ /** Light shade ░ */
1204
+ readonly light: "░";
1205
+ /** Hash # */
1206
+ readonly hash: "#";
1207
+ /** Equals = */
1208
+ readonly equals: "=";
1209
+ /** Arrow > */
1210
+ readonly arrow: ">";
1211
+ };
1212
+ /**
1213
+ * Braille base character for high-resolution rendering.
1214
+ * Unicode U+2800 (blank braille pattern).
1215
+ */
1216
+ declare const BRAILLE_BASE = 10240;
1217
+ /**
1218
+ * Dot positions in a braille cell (standard Unicode layout):
1219
+ * ```
1220
+ * 1 4
1221
+ * 2 5
1222
+ * 3 6
1223
+ * 7 8
1224
+ * ```
1225
+ * Each dot adds 2^(position-1) to the base.
1226
+ */
1227
+ declare const BRAILLE_DOTS: {
1228
+ readonly topLeft: 1;
1229
+ readonly upperLeft: 2;
1230
+ readonly lowerLeft: 3;
1231
+ readonly bottomLeft: 7;
1232
+ readonly topRight: 4;
1233
+ readonly upperRight: 5;
1234
+ readonly lowerRight: 6;
1235
+ readonly bottomRight: 8;
1236
+ };
1237
+ /**
1238
+ * Convert a value (0-1) to a height block character.
1239
+ *
1240
+ * @param normalized - Value between 0 and 1
1241
+ * @returns Appropriate height block character
1242
+ */
1243
+ declare function valueToBlock(normalized: number): string;
1244
+ /**
1245
+ * Get the bar fill character for a given style.
1246
+ *
1247
+ * @param style - Bar style name
1248
+ * @returns Corresponding fill character
1249
+ */
1250
+ declare function getBarChar(style: "block" | "shaded" | "light" | "hash" | "equals" | "arrow"): string;
1251
+ /**
1252
+ * Convert an array of dot positions to a braille character.
1253
+ *
1254
+ * @param dots - Array of dot positions (1-8)
1255
+ * @returns Unicode braille character
1256
+ */
1257
+ declare function toBrailleChar(dots: number[]): string;
1258
+ /**
1259
+ * Series visual distinction styles.
1260
+ * Uses combination of fill characters and markdown highlighting.
1261
+ */
1262
+ declare const SERIES_STYLES: readonly [{
1263
+ readonly char: "█";
1264
+ readonly useBackticks: false;
1265
+ }, {
1266
+ readonly char: "█";
1267
+ readonly useBackticks: true;
1268
+ }, {
1269
+ readonly char: "▓";
1270
+ readonly useBackticks: false;
1271
+ }, {
1272
+ readonly char: "░";
1273
+ readonly useBackticks: true;
1274
+ }];
1275
+ /**
1276
+ * Scatter plot marker characters for multi-series distinction.
1277
+ */
1278
+ declare const SCATTER_MARKERS: {
1279
+ readonly circle: "●";
1280
+ readonly square: "■";
1281
+ readonly triangle: "▲";
1282
+ readonly diamond: "◆";
1283
+ readonly plus: "+";
1284
+ };
1285
+ /**
1286
+ * Array of scatter markers for series rotation.
1287
+ */
1288
+ declare const SCATTER_MARKER_SEQUENCE: readonly ["●", "■", "▲", "◆", "+"];
1289
+ /**
1290
+ * Heatmap intensity characters (low to high).
1291
+ * 5 levels from empty to full.
1292
+ */
1293
+ declare const HEATMAP_BLOCKS: readonly [" ", "░", "▒", "▓", "█"];
1294
+ /**
1295
+ * ASCII-safe heatmap characters (low to high).
1296
+ * 5 levels for markdown-friendly output.
1297
+ */
1298
+ declare const HEATMAP_ASCII: readonly [" ", ".", ":", "*", "#"];
1299
+ /**
1300
+ * Convert a normalized value (0-1) to a heatmap character.
1301
+ *
1302
+ * @param normalized - Value between 0 and 1
1303
+ * @param style - "blocks" for Unicode blocks, "ascii" for ASCII chars
1304
+ * @returns Appropriate intensity character
1305
+ */
1306
+ declare function valueToHeatmapChar(normalized: number, style: "blocks" | "ascii"): string;
1307
+ /**
1308
+ * Line-drawing characters for connecting points.
1309
+ */
1310
+ declare const LINE_CHARS: {
1311
+ /** Point marker */
1312
+ readonly point: "●";
1313
+ /** Horizontal line */
1314
+ readonly horizontal: "─";
1315
+ /** Vertical line */
1316
+ readonly vertical: "│";
1317
+ /** Rising diagonal (approximation) */
1318
+ readonly rising: "╱";
1319
+ /** Falling diagonal (approximation) */
1320
+ readonly falling: "╲";
1321
+ };
1322
+ /**
1323
+ * A braille canvas for drawing high-resolution graphics.
1324
+ * Each character cell contains a 2x4 grid of dots.
1325
+ */
1326
+ declare class BrailleCanvas {
1327
+ /** Width in character cells */
1328
+ readonly width: number;
1329
+ /** Height in character cells */
1330
+ readonly height: number;
1331
+ /** Dot grid (width*2 x height*4) */
1332
+ private dots;
1333
+ /** Series index for each dot (for coloring) */
1334
+ private seriesIndices;
1335
+ constructor(width: number, height: number);
1336
+ /**
1337
+ * Set a dot at the given dot coordinates.
1338
+ */
1339
+ setDot(dotX: number, dotY: number, seriesIndex?: number): void;
1340
+ /**
1341
+ * Draw a line between two points using Bresenham's algorithm.
1342
+ * Coordinates are in dot space (width*2 x height*4).
1343
+ */
1344
+ drawLine(x0: number, y0: number, x1: number, y1: number, seriesIndex?: number): void;
1345
+ /**
1346
+ * Draw a point marker (fills more dots for visibility).
1347
+ */
1348
+ drawPoint(dotX: number, dotY: number, seriesIndex?: number): void;
1349
+ /**
1350
+ * Draw a circle outline using the midpoint circle algorithm.
1351
+ * Coordinates are in dot space (width*2 x height*4).
1352
+ *
1353
+ * @param centerX - Center X in dot coordinates
1354
+ * @param centerY - Center Y in dot coordinates
1355
+ * @param radius - Radius in dot units
1356
+ * @param seriesIndex - Series index for coloring
1357
+ */
1358
+ drawCircle(centerX: number, centerY: number, radius: number, seriesIndex?: number): void;
1359
+ /**
1360
+ * Draw an arc (portion of a circle).
1361
+ * Angles are in radians, 0 = top (12 o'clock), increasing clockwise.
1362
+ *
1363
+ * @param centerX - Center X in dot coordinates
1364
+ * @param centerY - Center Y in dot coordinates
1365
+ * @param radius - Radius in dot units
1366
+ * @param startAngle - Start angle in radians (0 = top)
1367
+ * @param endAngle - End angle in radians
1368
+ * @param seriesIndex - Series index for coloring
1369
+ */
1370
+ drawArc(centerX: number, centerY: number, radius: number, startAngle: number, endAngle: number, seriesIndex?: number): void;
1371
+ /**
1372
+ * Fill a wedge (pie slice) from center to edge.
1373
+ * Angles are in radians, 0 = top (12 o'clock), increasing clockwise.
1374
+ *
1375
+ * @param centerX - Center X in dot coordinates
1376
+ * @param centerY - Center Y in dot coordinates
1377
+ * @param radius - Outer radius in dot units
1378
+ * @param startAngle - Start angle in radians (0 = top)
1379
+ * @param endAngle - End angle in radians
1380
+ * @param seriesIndex - Series index for coloring
1381
+ * @param innerRadius - Inner radius for donut (0 for pie)
1382
+ */
1383
+ fillWedge(centerX: number, centerY: number, radius: number, startAngle: number, endAngle: number, seriesIndex?: number, innerRadius?: number): void;
1384
+ /**
1385
+ * Get the braille character at the given character cell.
1386
+ */
1387
+ getChar(charX: number, charY: number): string;
1388
+ /**
1389
+ * Get the dominant series index for a character cell.
1390
+ */
1391
+ getSeriesIndex(charX: number, charY: number): number | null;
1392
+ /**
1393
+ * Render the entire canvas to a 2D array of characters.
1394
+ */
1395
+ render(): {
1396
+ chars: string[][];
1397
+ seriesIndices: (number | null)[][];
1398
+ };
1399
+ }
1400
+
1401
+ /**
1402
+ * Grid line computation for chart backgrounds.
1403
+ */
1404
+
1405
+ /**
1406
+ * Configuration for grid computation.
1407
+ */
1408
+ interface GridOptions {
1409
+ /** Chart area width */
1410
+ width: number;
1411
+ /** Chart area height */
1412
+ height: number;
1413
+ /** X-axis layout (for vertical grid lines) */
1414
+ xAxis?: AxisLayout;
1415
+ /** Y-axis layout (for horizontal grid lines) */
1416
+ yAxis?: AxisLayout;
1417
+ /** Show horizontal grid lines */
1418
+ showHorizontal?: boolean;
1419
+ /** Show vertical grid lines */
1420
+ showVertical?: boolean;
1421
+ /** Grid character */
1422
+ char?: string;
1423
+ }
1424
+ /**
1425
+ * A single grid line.
1426
+ */
1427
+ interface GridLine {
1428
+ /** Line orientation */
1429
+ orientation: "horizontal" | "vertical";
1430
+ /** Position along perpendicular axis */
1431
+ position: number;
1432
+ /** Start position */
1433
+ start: number;
1434
+ /** End position */
1435
+ end: number;
1436
+ }
1437
+ /**
1438
+ * Computed grid layout.
1439
+ */
1440
+ interface GridLayout {
1441
+ /** Horizontal grid lines */
1442
+ horizontalLines: GridLine[];
1443
+ /** Vertical grid lines */
1444
+ verticalLines: GridLine[];
1445
+ /** Grid character */
1446
+ char: string;
1447
+ }
1448
+ /**
1449
+ * Default grid character (center dot).
1450
+ */
1451
+ declare const DEFAULT_GRID_CHAR = "\u00B7";
1452
+ /**
1453
+ * Compute grid lines for a chart.
1454
+ *
1455
+ * @param options - Grid configuration
1456
+ * @returns Computed grid layout
1457
+ */
1458
+ declare function computeGridLayout(options: GridOptions): GridLayout;
1459
+ /**
1460
+ * Create a 2D character grid with grid lines.
1461
+ *
1462
+ * @param width - Grid width
1463
+ * @param height - Grid height
1464
+ * @param grid - Grid layout
1465
+ * @returns 2D array of characters
1466
+ */
1467
+ declare function createGridBuffer(width: number, height: number, grid: GridLayout): string[][];
1468
+
1469
+ /**
1470
+ * Legend layout computation.
1471
+ */
1472
+ /**
1473
+ * Legend position options.
1474
+ */
1475
+ type LegendPosition = "none" | "top" | "bottom" | "right" | "inline";
1476
+ /**
1477
+ * A single legend item.
1478
+ */
1479
+ interface LegendItem {
1480
+ /** Series name */
1481
+ name: string;
1482
+ /** Symbol character */
1483
+ symbol: string;
1484
+ /** Whether to use inline code (backticks) for markdown */
1485
+ useBackticks: boolean;
1486
+ }
1487
+ /**
1488
+ * Configuration for legend layout.
1489
+ */
1490
+ interface LegendOptions {
1491
+ /** Legend items */
1492
+ items: LegendItem[];
1493
+ /** Legend position */
1494
+ position: LegendPosition;
1495
+ /** Whether to use boxed style */
1496
+ boxed?: boolean;
1497
+ /** Maximum width for wrapping */
1498
+ maxWidth?: number;
1499
+ }
1500
+ /**
1501
+ * A row of legend items.
1502
+ */
1503
+ interface LegendRow {
1504
+ /** Items in this row */
1505
+ items: LegendItem[];
1506
+ /** Total width of this row */
1507
+ width: number;
1508
+ }
1509
+ /**
1510
+ * Computed legend layout.
1511
+ */
1512
+ interface LegendLayout {
1513
+ /** Position of the legend */
1514
+ position: LegendPosition;
1515
+ /** Whether legend is boxed */
1516
+ boxed: boolean;
1517
+ /** Legend rows */
1518
+ rows: LegendRow[];
1519
+ /** Total width of legend */
1520
+ totalWidth: number;
1521
+ /** Total height of legend (rows) */
1522
+ totalHeight: number;
1523
+ }
1524
+ /**
1525
+ * Get the display width of a single legend item.
1526
+ *
1527
+ * Format: "█ Name" or "`█` Name" (with backticks)
1528
+ *
1529
+ * @param item - Legend item
1530
+ * @returns Display width in characters
1531
+ */
1532
+ declare function getLegendItemWidth(item: LegendItem): number;
1533
+ /**
1534
+ * Format a legend item as a string.
1535
+ *
1536
+ * @param item - Legend item
1537
+ * @param forMarkdown - Whether to format for markdown
1538
+ * @returns Formatted string
1539
+ */
1540
+ declare function formatLegendItem(item: LegendItem, forMarkdown: boolean): string;
1541
+ /**
1542
+ * Compute the layout for a legend.
1543
+ *
1544
+ * @param options - Legend configuration
1545
+ * @returns Computed legend layout
1546
+ */
1547
+ declare function computeLegendLayout(options: LegendOptions): LegendLayout;
1548
+ /**
1549
+ * Render a legend row as a string.
1550
+ *
1551
+ * @param row - Legend row
1552
+ * @param forMarkdown - Whether to render for markdown
1553
+ * @returns Rendered string
1554
+ */
1555
+ declare function renderLegendRow(row: LegendRow, forMarkdown: boolean): string;
1556
+
1557
+ /**
1558
+ * Shared axis rendering utilities for vertical charts.
1559
+ *
1560
+ * Provides consistent Y-axis and X-axis rendering with tick marks
1561
+ * across all chart types (bar, stacked bar, line, area).
1562
+ */
1563
+ /**
1564
+ * Y-axis scale information.
1565
+ */
1566
+ interface YAxisScale {
1567
+ min: number;
1568
+ max: number;
1569
+ ticks: number[];
1570
+ }
1571
+ /**
1572
+ * Configuration for Y-axis rendering.
1573
+ */
1574
+ interface YAxisConfig {
1575
+ /** Scale with min, max, and tick values */
1576
+ scale: YAxisScale;
1577
+ /** Total chart height in rows */
1578
+ chartHeight: number;
1579
+ /** Width reserved for Y-axis labels */
1580
+ labelWidth: number;
1581
+ /** Number format */
1582
+ format?: "number" | "percent" | "currency" | "compact" | undefined;
1583
+ /** Decimal places */
1584
+ decimals?: number | undefined;
1585
+ }
1586
+ /**
1587
+ * Result of Y-axis label computation for a single row.
1588
+ */
1589
+ interface YAxisRowResult {
1590
+ /** Formatted label (padded to labelWidth) or spaces if no tick */
1591
+ label: string;
1592
+ /** Whether this row has a tick mark */
1593
+ hasTick: boolean;
1594
+ /** The axis character to use (┤ for tick, │ otherwise) */
1595
+ axisChar: string;
1596
+ }
1597
+ /**
1598
+ * Compute Y-axis label and tick mark for a given row.
1599
+ *
1600
+ * @param row - Row index (0 = bottom, chartHeight-1 = top)
1601
+ * @param config - Y-axis configuration
1602
+ * @returns Label, tick status, and axis character for this row
1603
+ */
1604
+ declare function computeYAxisRow(row: number, config: YAxisConfig): YAxisRowResult;
1605
+ /**
1606
+ * Configuration for X-axis rendering.
1607
+ */
1608
+ interface XAxisConfig {
1609
+ /** Category labels */
1610
+ categories: string[];
1611
+ /** Width of each bar/category area */
1612
+ barWidth: number;
1613
+ /** Width reserved for Y-axis (for alignment) */
1614
+ yAxisWidth: number;
1615
+ /** Total chart width */
1616
+ chartWidth: number;
1617
+ /** Minimum value for zero label */
1618
+ minValue: number;
1619
+ /** Number format for zero label */
1620
+ format?: "number" | "percent" | "currency" | "compact" | undefined;
1621
+ /** Decimal places for zero label */
1622
+ decimals?: number | undefined;
1623
+ }
1624
+ /**
1625
+ * Result of X-axis rendering.
1626
+ */
1627
+ interface XAxisResult {
1628
+ /** The X-axis line with origin and tick marks */
1629
+ axisLine: string;
1630
+ /** The category labels line (centered under ticks) */
1631
+ labelLine: string;
1632
+ }
1633
+ /**
1634
+ * Render the X-axis with tick marks and centered labels.
1635
+ *
1636
+ * @param config - X-axis configuration
1637
+ * @returns Axis line and label line
1638
+ */
1639
+ declare function renderXAxis(config: XAxisConfig): XAxisResult;
1640
+ /**
1641
+ * Configuration for a complete chart area with axes.
1642
+ */
1643
+ interface ChartAreaConfig {
1644
+ /** Y-axis configuration */
1645
+ yAxis: YAxisConfig;
1646
+ /** X-axis configuration */
1647
+ xAxis: XAxisConfig;
1648
+ }
1649
+ /**
1650
+ * Helper to build a complete row with Y-axis and content.
1651
+ *
1652
+ * @param row - Row index
1653
+ * @param content - The chart content for this row
1654
+ * @param config - Y-axis configuration
1655
+ * @returns Complete row string with Y-axis label and content
1656
+ */
1657
+ declare function buildChartRow(row: number, content: string, config: YAxisConfig): string;
1658
+
1659
+ /**
1660
+ * Layout computation for horizontal and vertical bar charts.
1661
+ */
1662
+
1663
+ /**
1664
+ * Computed layout for a bar chart.
1665
+ */
1666
+ interface BarChartLayout {
1667
+ /** Chart type */
1668
+ type: "bar" | "bar-vertical";
1669
+ /** Individual bar layouts */
1670
+ bars: BarLayout[];
1671
+ /** Categories (x-axis labels) */
1672
+ categories: string[];
1673
+ /** Maximum label width */
1674
+ maxLabelWidth: number;
1675
+ /** Maximum value width */
1676
+ maxValueWidth: number;
1677
+ /** Bar area width (for horizontal) or height (for vertical) */
1678
+ barAreaSize: number;
1679
+ /** Y-axis scale info */
1680
+ yScale: ReturnType<typeof computeNiceTicks>;
1681
+ /** Y-axis layout */
1682
+ yAxis?: AxisLayout;
1683
+ /** Whether to show values */
1684
+ showValues: boolean;
1685
+ /** Chart dimensions */
1686
+ width: number;
1687
+ height: number;
1688
+ }
1689
+ /**
1690
+ * Compute layout for a horizontal or vertical bar chart.
1691
+ *
1692
+ * @param input - Chart input with defaults
1693
+ * @returns Computed bar chart layout
1694
+ */
1695
+ declare function computeBarLayout(input: ChartInputWithDefaults): BarChartLayout;
1696
+ /**
1697
+ * Group bars by category for multi-series charts.
1698
+ *
1699
+ * @param layout - Bar chart layout
1700
+ * @returns Map of category to bars
1701
+ */
1702
+ declare function groupBarsByCategory(layout: BarChartLayout): Map<string, BarLayout[]>;
1703
+
1704
+ /**
1705
+ * Layout computation for stacked bar charts.
1706
+ */
1707
+
1708
+ /**
1709
+ * Computed layout for a stacked bar chart.
1710
+ */
1711
+ interface StackedBarChartLayout {
1712
+ /** Chart type */
1713
+ type: "bar-stacked" | "bar-stacked-vertical";
1714
+ /** Stacked bars by category */
1715
+ stacks: StackedBarLayout[];
1716
+ /** Series names for legend */
1717
+ seriesNames: string[];
1718
+ /** Series styles for legend */
1719
+ seriesStyles: {
1720
+ char: string;
1721
+ useBackticks: boolean;
1722
+ }[];
1723
+ /** Maximum label width */
1724
+ maxLabelWidth: number;
1725
+ /** Maximum total value width */
1726
+ maxValueWidth: number;
1727
+ /** Bar area width/height */
1728
+ barAreaSize: number;
1729
+ /** Y-scale */
1730
+ yScale: ReturnType<typeof computeNiceTicks>;
1731
+ /** Whether to show values */
1732
+ showValues: boolean;
1733
+ /** Chart dimensions */
1734
+ width: number;
1735
+ height: number;
1736
+ }
1737
+ /**
1738
+ * Compute layout for a stacked bar chart.
1739
+ *
1740
+ * @param input - Chart input with defaults
1741
+ * @returns Computed stacked bar layout
1742
+ */
1743
+ declare function computeStackedBarLayout(input: ChartInputWithDefaults): StackedBarChartLayout;
1744
+
1745
+ /**
1746
+ * Layout computation for line charts.
1747
+ *
1748
+ * Supports multiple rendering styles:
1749
+ * - "blocks": Simple line-drawing characters (●, ╱, ╲, ─)
1750
+ * - "braille": High-resolution braille dot patterns
1751
+ * - "dots": Point markers only
1752
+ */
1753
+
1754
+ /**
1755
+ * A single point in the line chart.
1756
+ */
1757
+ interface LinePoint {
1758
+ /** X position (column index) */
1759
+ x: number;
1760
+ /** Y value (data value) */
1761
+ value: number;
1762
+ /** Normalized Y (0-1) */
1763
+ normalizedY: number;
1764
+ /** Series index */
1765
+ seriesIndex: number;
1766
+ }
1767
+ /**
1768
+ * A row in the line chart display.
1769
+ */
1770
+ interface LineRow {
1771
+ /** Y-axis label for this row */
1772
+ yLabel?: string | undefined;
1773
+ /** Y-axis value at this row */
1774
+ yValue: number;
1775
+ /** Characters for each column */
1776
+ chars: string[];
1777
+ /** Whether each char uses backticks (for multi-series distinction) */
1778
+ useBackticks: boolean[];
1779
+ /** Series index for each column (for ANSI coloring) */
1780
+ seriesIndices: (number | null)[];
1781
+ }
1782
+ /**
1783
+ * Computed layout for a line chart.
1784
+ */
1785
+ interface LineChartLayout {
1786
+ /** Chart type */
1787
+ type: "line";
1788
+ /** Line style */
1789
+ lineStyle: LineStyle;
1790
+ /** X-axis categories */
1791
+ categories: string[];
1792
+ /** Series names */
1793
+ seriesNames: string[];
1794
+ /** Points per series */
1795
+ points: LinePoint[][];
1796
+ /** Display rows (top to bottom) */
1797
+ rows: LineRow[];
1798
+ /** Y-scale */
1799
+ yScale: ReturnType<typeof computeNiceTicks>;
1800
+ /** X-axis label width */
1801
+ maxXLabelWidth: number;
1802
+ /** Y-axis label width */
1803
+ yAxisWidth: number;
1804
+ /** Chart dimensions */
1805
+ width: number;
1806
+ height: number;
1807
+ /** Whether to show values */
1808
+ showValues: boolean;
1809
+ }
1810
+ /**
1811
+ * Compute layout for a line chart.
1812
+ */
1813
+ declare function computeLineLayout(input: ChartInputWithDefaults): LineChartLayout;
1814
+
1815
+ /**
1816
+ * Layout computation for area and stacked area charts.
1817
+ */
1818
+
1819
+ /**
1820
+ * A column in the area chart with stacked values.
1821
+ */
1822
+ interface AreaColumn {
1823
+ /** X position */
1824
+ x: number;
1825
+ /** Category label */
1826
+ label: string;
1827
+ /** Cumulative values per series (bottom to top) */
1828
+ cumulativeValues: number[];
1829
+ /** Normalized cumulative heights (0-1) */
1830
+ normalizedHeights: number[];
1831
+ }
1832
+ /**
1833
+ * A row in the area chart display.
1834
+ */
1835
+ interface AreaRow {
1836
+ /** Y-axis label */
1837
+ yLabel?: string | undefined;
1838
+ /** Characters for each column */
1839
+ chars: string[];
1840
+ /** Whether each char uses backticks */
1841
+ useBackticks: boolean[];
1842
+ /** Fill character for each column */
1843
+ fillChars: string[];
1844
+ }
1845
+ /**
1846
+ * Computed layout for an area chart.
1847
+ */
1848
+ interface AreaChartLayout {
1849
+ /** Chart type */
1850
+ type: "area" | "area-stacked";
1851
+ /** Line style */
1852
+ lineStyle: LineStyle;
1853
+ /** X-axis categories */
1854
+ categories: string[];
1855
+ /** Series names */
1856
+ seriesNames: string[];
1857
+ /** Series styles */
1858
+ seriesStyles: {
1859
+ char: string;
1860
+ useBackticks: boolean;
1861
+ }[];
1862
+ /** Column data */
1863
+ columns: AreaColumn[];
1864
+ /** Display rows (top to bottom) */
1865
+ rows: AreaRow[];
1866
+ /** Y-scale */
1867
+ yScale: ReturnType<typeof computeNiceTicks>;
1868
+ /** Y-axis label width */
1869
+ yAxisWidth: number;
1870
+ /** Chart dimensions */
1871
+ width: number;
1872
+ height: number;
1873
+ /** Whether to show values */
1874
+ showValues: boolean;
1875
+ }
1876
+ /**
1877
+ * Compute layout for an area or stacked area chart.
1878
+ *
1879
+ * @param input - Chart input with defaults
1880
+ * @returns Computed area chart layout
1881
+ */
1882
+ declare function computeAreaLayout(input: ChartInputWithDefaults): AreaChartLayout;
1883
+
1884
+ /**
1885
+ * Layout computation for scatter plots.
1886
+ *
1887
+ * Supports multiple rendering styles:
1888
+ * - "dots": Simple character markers (●, ■, ▲, ◆, +)
1889
+ * - "braille": High-resolution braille dot patterns
1890
+ */
1891
+
1892
+ /**
1893
+ * A single point in the scatter plot.
1894
+ */
1895
+ interface ScatterPoint {
1896
+ /** Original X data value */
1897
+ dataX: number;
1898
+ /** Original Y data value */
1899
+ dataY: number;
1900
+ /** Character column position */
1901
+ charX: number;
1902
+ /** Character row position */
1903
+ charY: number;
1904
+ /** Series index for coloring/marker */
1905
+ seriesIndex: number;
1906
+ }
1907
+ /**
1908
+ * Computed layout for a scatter chart.
1909
+ */
1910
+ interface ScatterChartLayout {
1911
+ /** Chart type */
1912
+ type: "scatter";
1913
+ /** Scatter rendering style */
1914
+ scatterStyle: ScatterStyle;
1915
+ /** Series names */
1916
+ seriesNames: string[];
1917
+ /** All points across series */
1918
+ points: ScatterPoint[];
1919
+ /** X-axis scale */
1920
+ xScale: NiceTicksResult;
1921
+ /** Y-axis scale */
1922
+ yScale: NiceTicksResult;
1923
+ /** Y-axis label width */
1924
+ yAxisWidth: number;
1925
+ /** Chart area width (excluding Y-axis) */
1926
+ chartWidth: number;
1927
+ /** Chart area height (excluding X-axis) */
1928
+ chartHeight: number;
1929
+ /** Total width */
1930
+ width: number;
1931
+ /** Total height */
1932
+ height: number;
1933
+ /** Character grid for dots mode */
1934
+ grid?: string[][];
1935
+ /** Series indices for each grid cell */
1936
+ seriesIndices?: (number | null)[][];
1937
+ /** Braille canvas render result (for braille mode) */
1938
+ brailleChars?: string[][];
1939
+ /** Braille series indices */
1940
+ brailleSeriesIndices?: (number | null)[][];
1941
+ }
1942
+ /**
1943
+ * Compute layout for a scatter plot.
1944
+ */
1945
+ declare function computeScatterLayout(input: ChartInputWithDefaults): ScatterChartLayout;
1946
+
1947
+ /**
1948
+ * Layout computation for pie and donut charts.
1949
+ *
1950
+ * Uses braille characters to draw circular charts with filled wedges.
1951
+ */
1952
+
1953
+ /**
1954
+ * A single slice in a pie chart.
1955
+ */
1956
+ interface PieSlice {
1957
+ /** Slice label */
1958
+ label: string;
1959
+ /** Slice value */
1960
+ value: number;
1961
+ /** Percentage of total (0-100) */
1962
+ percentage: number;
1963
+ /** Start angle in radians (0 = top, clockwise) */
1964
+ startAngle: number;
1965
+ /** End angle in radians */
1966
+ endAngle: number;
1967
+ /** Display character for legend */
1968
+ barChar: string;
1969
+ /** Whether to use backticks in markdown */
1970
+ useBackticks: boolean;
1971
+ /** Series index */
1972
+ seriesIndex: number;
1973
+ }
1974
+ /**
1975
+ * Computed layout for a pie or donut chart.
1976
+ */
1977
+ interface PieChartLayout {
1978
+ /** Chart type */
1979
+ type: "pie" | "donut";
1980
+ /** Slices data */
1981
+ slices: PieSlice[];
1982
+ /** Total value */
1983
+ total: number;
1984
+ /** Radius in character cells */
1985
+ radius: number;
1986
+ /** Center X in character cells */
1987
+ centerX: number;
1988
+ /** Center Y in character cells */
1989
+ centerY: number;
1990
+ /** Inner radius (0 for pie, >0 for donut) */
1991
+ innerRadius: number;
1992
+ /** Center label for donut */
1993
+ centerLabel?: string;
1994
+ /** Chart width */
1995
+ width: number;
1996
+ /** Chart height */
1997
+ height: number;
1998
+ /** Braille canvas rendered characters */
1999
+ brailleChars: string[][];
2000
+ /** Series indices for each character */
2001
+ brailleSeriesIndices: (number | null)[][];
2002
+ /** Series styles */
2003
+ seriesStyles: readonly {
2004
+ char: string;
2005
+ useBackticks: boolean;
2006
+ }[];
2007
+ }
2008
+ /**
2009
+ * Compute layout for a pie or donut chart.
2010
+ */
2011
+ declare function computePieLayout(input: ChartInputWithDefaults): PieChartLayout;
2012
+
2013
+ /**
2014
+ * Layout computation for heatmap charts.
2015
+ *
2016
+ * Renders a 2D grid with intensity shading based on values.
2017
+ */
2018
+
2019
+ /**
2020
+ * A single cell in the heatmap.
2021
+ */
2022
+ interface HeatmapCell {
2023
+ /** Row index */
2024
+ row: number;
2025
+ /** Column index */
2026
+ col: number;
2027
+ /** Raw value */
2028
+ value: number;
2029
+ /** Normalized value (0-1) */
2030
+ normalizedValue: number;
2031
+ /** Display character */
2032
+ displayChar: string;
2033
+ }
2034
+ /**
2035
+ * Computed layout for a heatmap chart.
2036
+ */
2037
+ interface HeatmapChartLayout {
2038
+ /** Chart type */
2039
+ type: "heatmap";
2040
+ /** Heatmap rendering style */
2041
+ heatmapStyle: HeatmapStyle;
2042
+ /** Row labels */
2043
+ rowLabels: string[];
2044
+ /** Column labels */
2045
+ colLabels: string[];
2046
+ /** Cell data grid (rows x cols) */
2047
+ cells: HeatmapCell[][];
2048
+ /** Value range */
2049
+ valueRange: {
2050
+ min: number;
2051
+ max: number;
2052
+ };
2053
+ /** Width of each cell in characters */
2054
+ cellWidth: number;
2055
+ /** Width for column spacing (max of cellWidth and longest column label) */
2056
+ colLabelWidth: number;
2057
+ /** Width of row labels */
2058
+ rowLabelWidth: number;
2059
+ /** Total width */
2060
+ width: number;
2061
+ /** Total height */
2062
+ height: number;
2063
+ }
2064
+ /**
2065
+ * Compute layout for a heatmap chart.
2066
+ */
2067
+ declare function computeHeatmapLayout(input: ChartInputWithDefaults): HeatmapChartLayout;
2068
+
2069
+ /**
2070
+ * ANSI renderer for charts.
2071
+ *
2072
+ * Produces ANSI escape code output for rich terminal rendering.
2073
+ */
2074
+
2075
+ /**
2076
+ * Render options for ANSI output.
2077
+ */
2078
+ interface AnsiRenderOptions {
2079
+ /** Theme for colors */
2080
+ theme?: TuiTheme | undefined;
2081
+ /** Chart input for configuration */
2082
+ input: ChartInputWithDefaults;
2083
+ }
2084
+ /**
2085
+ * Render a horizontal bar chart to ANSI.
2086
+ */
2087
+ declare function renderBarChartAnsi(layout: BarChartLayout, options: AnsiRenderOptions): string;
2088
+ /**
2089
+ * Render a vertical bar chart to ANSI.
2090
+ */
2091
+ declare function renderVerticalBarChartAnsi(layout: BarChartLayout, options: AnsiRenderOptions): string;
2092
+ /**
2093
+ * Render a stacked bar chart to ANSI.
2094
+ */
2095
+ declare function renderStackedBarChartAnsi(layout: StackedBarChartLayout, options: AnsiRenderOptions): string;
2096
+ /**
2097
+ * Render a line chart to ANSI.
2098
+ */
2099
+ declare function renderLineChartAnsi(layout: LineChartLayout, options: AnsiRenderOptions): string;
2100
+ /**
2101
+ * Render an area chart to ANSI.
2102
+ */
2103
+ declare function renderAreaChartAnsi(layout: AreaChartLayout, options: AnsiRenderOptions): string;
2104
+ /**
2105
+ * Render a scatter chart to ANSI.
2106
+ */
2107
+ declare function renderScatterChartAnsi(layout: ScatterChartLayout, options: AnsiRenderOptions): string;
2108
+ /**
2109
+ * Render a pie or donut chart to ANSI.
2110
+ */
2111
+ declare function renderPieChartAnsi(layout: PieChartLayout, options: AnsiRenderOptions): string;
2112
+ /**
2113
+ * Render a heatmap chart to ANSI.
2114
+ */
2115
+ declare function renderHeatmapAnsi(layout: HeatmapChartLayout, options: AnsiRenderOptions): string;
2116
+
2117
+ /**
2118
+ * Markdown renderer for charts.
2119
+ *
2120
+ * Produces markdown-friendly output using a two-color system:
2121
+ * - Primary: Plain text
2122
+ * - Secondary: Inline code (backticks)
2123
+ */
2124
+
2125
+ /**
2126
+ * Render options for markdown output.
2127
+ */
2128
+ interface MarkdownRenderOptions {
2129
+ /** Chart input for configuration */
2130
+ input: ChartInputWithDefaults;
2131
+ }
2132
+ /**
2133
+ * Render a horizontal bar chart to markdown.
2134
+ */
2135
+ declare function renderBarChartMarkdown(layout: BarChartLayout, _options: MarkdownRenderOptions): string;
2136
+ /**
2137
+ * Render a vertical bar chart to markdown.
2138
+ */
2139
+ declare function renderVerticalBarChartMarkdown(layout: BarChartLayout, options: MarkdownRenderOptions): string;
2140
+ /**
2141
+ * Render a stacked bar chart to markdown.
2142
+ */
2143
+ declare function renderStackedBarChartMarkdown(layout: StackedBarChartLayout, options: MarkdownRenderOptions): string;
2144
+ /**
2145
+ * Render a line chart to markdown.
2146
+ */
2147
+ declare function renderLineChartMarkdown(layout: LineChartLayout, options: MarkdownRenderOptions): string;
2148
+ /**
2149
+ * Render an area chart to markdown.
2150
+ */
2151
+ declare function renderAreaChartMarkdown(layout: AreaChartLayout, options: MarkdownRenderOptions): string;
2152
+ /**
2153
+ * Render a scatter chart to markdown.
2154
+ */
2155
+ declare function renderScatterChartMarkdown(layout: ScatterChartLayout, options: MarkdownRenderOptions): string;
2156
+ /**
2157
+ * Render a pie or donut chart to markdown.
2158
+ */
2159
+ declare function renderPieChartMarkdown(layout: PieChartLayout, options: MarkdownRenderOptions): string;
2160
+ /**
2161
+ * Render a heatmap chart to markdown.
2162
+ */
2163
+ declare function renderHeatmapMarkdown(layout: HeatmapChartLayout, options: MarkdownRenderOptions): string;
2164
+
2165
+ export { AXIS_CHARS, type AnsiRenderOptions, type AreaChartLayout, type AreaColumn, type AreaRow, type AxisConfig, type AxisLayout, type AxisLayoutOptions, type AxisOrientation, type AxisPosition, type AxisTick, BAR_CHARS, BRAILLE_BASE, BRAILLE_DOTS, type BarChartLayout, type BarLayout, type BarStyle, BrailleCanvas, type ChartAreaConfig, ChartComponent, type ChartInput, type ChartInputWithDefaults, type ChartLayout, type ChartType, DEFAULT_GRID_CHAR, type DataPoint, type DataSeries, type DualAxisLayout, type DualAxisLayoutOptions, type GridConfig, type GridLayout, type GridLine, type GridOptions, HEATMAP_ASCII, HEATMAP_BLOCKS, HEIGHT_BLOCKS, type HeatmapCell, type HeatmapChartLayout, type HeatmapStyle, LINE_CHARS, type LegendConfig, type LegendItem, type LegendLayout, type LegendOptions, type LegendPosition, type LegendRow, type LineChartLayout, type LinePoint, type LineRow, type LineRowLayout, type LineStyle, type MarkdownRenderOptions, type NiceTicksOptions, type NiceTicksResult, type PieChartLayout, type PieSlice, SCATTER_MARKERS, SCATTER_MARKER_SEQUENCE, SERIES_STYLES, type ScatterChartLayout, type ScatterMarker, type ScatterPoint, type ScatterStyle, type StackedBarChartLayout, type StackedBarLayout, type ValueFormat, type XAxisConfig, type XAxisResult, type YAxisConfig, type YAxisRowResult, type YAxisScale, axisConfigSchema, barStyleSchema, buildChartRow, chartInputSchema, chartTypeSchema, computeAreaLayout, computeAxisLayout, computeBarLayout, computeDualAxisLayout, computeGridLayout, computeHeatmapLayout, computeLegendLayout, computeLineLayout, computeNiceTicks, computePieLayout, computeScatterLayout, computeStackedBarLayout, computeYAxisRow, createChart, createGridBuffer, dataPointSchema, dataSeriesSchema, formatLegendItem, formatTickValue, getBarChar, getLegendItemWidth, gridConfigSchema, groupBarsByCategory, heatmapStyleSchema, legendConfigSchema, legendPositionSchema, lineStyleSchema, renderAreaChartAnsi, renderAreaChartMarkdown, renderBarChartAnsi, renderBarChartMarkdown, renderHeatmapAnsi, renderHeatmapMarkdown, renderLegendRow, renderLineChartAnsi, renderLineChartMarkdown, renderPieChartAnsi, renderPieChartMarkdown, renderScatterChartAnsi, renderScatterChartMarkdown, renderStackedBarChartAnsi, renderStackedBarChartMarkdown, renderVerticalBarChartAnsi, renderVerticalBarChartMarkdown, renderXAxis, scaleValue, scatterMarkerSchema, scatterStyleSchema, toBrailleChar, unscaleValue, valueFormatSchema, valueToBlock, valueToHeatmapChar };