@ggterm/core 0.2.10 → 0.2.12

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.
package/dist/cli-plot.js CHANGED
@@ -2309,6 +2309,521 @@ function parseColor(color) {
2309
2309
  }
2310
2310
  return { r: 128, g: 128, b: 128, a: 1 };
2311
2311
  }
2312
+ function renderGeomBeeswarm(data, geom, aes, scales, canvas) {
2313
+ const alpha = geom.params.alpha ?? 1;
2314
+ const fixedColor = geom.params.color;
2315
+ const shape = getPointShape(geom.params.shape);
2316
+ const plotLeft = Math.round(scales.x.range[0]);
2317
+ const plotRight = Math.round(scales.x.range[1]);
2318
+ const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
2319
+ const plotBottom = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
2320
+ const defaultColors = [
2321
+ { r: 79, g: 169, b: 238, a: 1 },
2322
+ { r: 238, g: 136, b: 102, a: 1 },
2323
+ { r: 102, g: 204, b: 153, a: 1 },
2324
+ { r: 204, g: 102, b: 204, a: 1 },
2325
+ { r: 255, g: 200, b: 87, a: 1 },
2326
+ { r: 138, g: 201, b: 222, a: 1 },
2327
+ { r: 255, g: 153, b: 153, a: 1 },
2328
+ { r: 170, g: 170, b: 170, a: 1 }
2329
+ ];
2330
+ const categories = new Set;
2331
+ for (const row of data) {
2332
+ categories.add(String(row.xOriginal ?? row[aes.x] ?? "default"));
2333
+ }
2334
+ const categoryList = [...categories];
2335
+ for (const row of data) {
2336
+ const xVal = row.x;
2337
+ const yVal = row.y;
2338
+ if (xVal === null || xVal === undefined || yVal === null || yVal === undefined) {
2339
+ continue;
2340
+ }
2341
+ const numGroups = categoryList.length;
2342
+ const xRange = plotRight - plotLeft;
2343
+ const xNormalized = (Number(xVal) + 0.5) / numGroups;
2344
+ const cx = Math.round(plotLeft + xNormalized * xRange);
2345
+ const cy = Math.round(scales.y.map(yVal));
2346
+ let color;
2347
+ if (fixedColor) {
2348
+ color = parseColorToRgba(fixedColor);
2349
+ } else if (scales.color && aes.color) {
2350
+ color = getPointColor(row, aes, scales.color);
2351
+ } else {
2352
+ const category = String(row.xOriginal ?? row[aes.x] ?? "default");
2353
+ const categoryIdx = categoryList.indexOf(category);
2354
+ color = defaultColors[categoryIdx % defaultColors.length];
2355
+ }
2356
+ if (alpha < 1) {
2357
+ color = { ...color, a: alpha };
2358
+ }
2359
+ if (cx >= plotLeft && cx <= plotRight && cy >= plotTop && cy <= plotBottom) {
2360
+ canvas.drawChar(cx, cy, shape, color);
2361
+ }
2362
+ }
2363
+ }
2364
+ function renderGeomDumbbell(data, geom, aes, scales, canvas) {
2365
+ const lineColor = parseColorToRgba(geom.params.lineColor ?? "#666666");
2366
+ const alpha = geom.params.alpha ?? 1;
2367
+ const shape = getPointShape(geom.params.shape);
2368
+ const plotLeft = Math.round(scales.x.range[0]);
2369
+ const plotRight = Math.round(scales.x.range[1]);
2370
+ const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
2371
+ const plotBottom = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
2372
+ const defaultColors = [
2373
+ { r: 79, g: 169, b: 238, a: 1 },
2374
+ { r: 238, g: 136, b: 102, a: 1 },
2375
+ { r: 102, g: 204, b: 153, a: 1 },
2376
+ { r: 204, g: 102, b: 204, a: 1 }
2377
+ ];
2378
+ for (let i = 0;i < data.length; i++) {
2379
+ const row = data[i];
2380
+ const xVal = row[aes.x];
2381
+ const xendVal = row["xend"] ?? row[aes.x];
2382
+ const yVal = row[aes.y];
2383
+ if (xVal === null || xVal === undefined || yVal === null || yVal === undefined) {
2384
+ continue;
2385
+ }
2386
+ const x1 = Math.round(scales.x.map(xVal));
2387
+ const x2 = Math.round(scales.x.map(xendVal));
2388
+ const cy = Math.round(scales.y.map(yVal));
2389
+ let startColor;
2390
+ let endColor;
2391
+ if (geom.params.color) {
2392
+ startColor = parseColorToRgba(geom.params.color);
2393
+ } else if (scales.color && aes.color) {
2394
+ startColor = getPointColor(row, aes, scales.color);
2395
+ } else {
2396
+ startColor = defaultColors[0];
2397
+ }
2398
+ if (geom.params.colorEnd) {
2399
+ endColor = parseColorToRgba(geom.params.colorEnd);
2400
+ } else {
2401
+ endColor = geom.params.color ? startColor : defaultColors[1];
2402
+ }
2403
+ if (alpha < 1) {
2404
+ startColor = { ...startColor, a: alpha };
2405
+ endColor = { ...endColor, a: alpha };
2406
+ }
2407
+ if (cy >= plotTop && cy <= plotBottom) {
2408
+ const left = Math.max(plotLeft, Math.min(x1, x2));
2409
+ const right = Math.min(plotRight, Math.max(x1, x2));
2410
+ for (let x = left;x <= right; x++) {
2411
+ canvas.drawChar(x, cy, "─", lineColor);
2412
+ }
2413
+ }
2414
+ if (x1 >= plotLeft && x1 <= plotRight && cy >= plotTop && cy <= plotBottom) {
2415
+ canvas.drawChar(x1, cy, shape, startColor);
2416
+ }
2417
+ if (x2 >= plotLeft && x2 <= plotRight && cy >= plotTop && cy <= plotBottom) {
2418
+ canvas.drawChar(x2, cy, shape, endColor);
2419
+ }
2420
+ }
2421
+ }
2422
+ function renderGeomLollipop(data, geom, aes, scales, canvas) {
2423
+ const alpha = geom.params.alpha ?? 1;
2424
+ const baseline = geom.params.baseline ?? 0;
2425
+ const direction = geom.params.direction ?? "vertical";
2426
+ const shape = getPointShape(geom.params.shape);
2427
+ const plotLeft = Math.round(scales.x.range[0]);
2428
+ const plotRight = Math.round(scales.x.range[1]);
2429
+ const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
2430
+ const plotBottom = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
2431
+ const defaultColors = [
2432
+ { r: 79, g: 169, b: 238, a: 1 },
2433
+ { r: 238, g: 136, b: 102, a: 1 },
2434
+ { r: 102, g: 204, b: 153, a: 1 },
2435
+ { r: 204, g: 102, b: 204, a: 1 },
2436
+ { r: 255, g: 200, b: 87, a: 1 },
2437
+ { r: 138, g: 201, b: 222, a: 1 }
2438
+ ];
2439
+ const xValues = [...new Set(data.map((row) => row[aes.x]))];
2440
+ for (let i = 0;i < data.length; i++) {
2441
+ const row = data[i];
2442
+ const xVal = row[aes.x];
2443
+ const yVal = row[aes.y];
2444
+ if (xVal === null || xVal === undefined || yVal === null || yVal === undefined) {
2445
+ continue;
2446
+ }
2447
+ const cx = Math.round(scales.x.map(xVal));
2448
+ const cy = Math.round(scales.y.map(yVal));
2449
+ let color;
2450
+ if (geom.params.color) {
2451
+ color = parseColorToRgba(geom.params.color);
2452
+ } else if (scales.color && aes.color) {
2453
+ color = getPointColor(row, aes, scales.color);
2454
+ } else {
2455
+ const categoryIdx = xValues.indexOf(xVal);
2456
+ color = defaultColors[categoryIdx % defaultColors.length];
2457
+ }
2458
+ let lineColor;
2459
+ if (geom.params.lineColor) {
2460
+ lineColor = parseColorToRgba(geom.params.lineColor);
2461
+ } else {
2462
+ lineColor = {
2463
+ r: Math.round(color.r * 0.7),
2464
+ g: Math.round(color.g * 0.7),
2465
+ b: Math.round(color.b * 0.7),
2466
+ a: color.a
2467
+ };
2468
+ }
2469
+ if (alpha < 1) {
2470
+ color = { ...color, a: alpha };
2471
+ lineColor = { ...lineColor, a: alpha };
2472
+ }
2473
+ if (direction === "vertical") {
2474
+ let baselineY = Math.round(scales.y.map(baseline));
2475
+ baselineY = Math.max(plotTop, Math.min(plotBottom, baselineY));
2476
+ if (cx >= plotLeft && cx <= plotRight) {
2477
+ const top = Math.min(cy, baselineY);
2478
+ const bottom = Math.max(cy, baselineY);
2479
+ for (let y = top;y <= bottom; y++) {
2480
+ if (y >= plotTop && y <= plotBottom) {
2481
+ canvas.drawChar(cx, y, "│", lineColor);
2482
+ }
2483
+ }
2484
+ }
2485
+ if (cx >= plotLeft && cx <= plotRight && cy >= plotTop && cy <= plotBottom) {
2486
+ canvas.drawChar(cx, cy, shape, color);
2487
+ }
2488
+ } else {
2489
+ let baselineX = Math.round(scales.x.map(baseline));
2490
+ baselineX = Math.max(plotLeft, Math.min(plotRight, baselineX));
2491
+ if (cy >= plotTop && cy <= plotBottom) {
2492
+ const left = Math.min(cx, baselineX);
2493
+ const right = Math.max(cx, baselineX);
2494
+ for (let x = left;x <= right; x++) {
2495
+ if (x >= plotLeft && x <= plotRight) {
2496
+ canvas.drawChar(x, cy, "─", lineColor);
2497
+ }
2498
+ }
2499
+ }
2500
+ if (cx >= plotLeft && cx <= plotRight && cy >= plotTop && cy <= plotBottom) {
2501
+ canvas.drawChar(cx, cy, shape, color);
2502
+ }
2503
+ }
2504
+ }
2505
+ }
2506
+ function renderGeomWaffle(data, geom, aes, scales, canvas) {
2507
+ const rows = geom.params.rows ?? 10;
2508
+ const cols = geom.params.cols ?? 10;
2509
+ const fillChar = geom.params.fill_char ?? "█";
2510
+ const emptyChar = geom.params.empty_char ?? "░";
2511
+ const showLegend = geom.params.show_legend ?? true;
2512
+ const flip = geom.params.flip ?? false;
2513
+ const gap = geom.params.gap ?? 0;
2514
+ const plotLeft = Math.round(scales.x.range[0]);
2515
+ const plotRight = Math.round(scales.x.range[1]);
2516
+ const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
2517
+ const plotBottom = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
2518
+ const defaultColors = [
2519
+ { r: 79, g: 169, b: 238, a: 1 },
2520
+ { r: 238, g: 136, b: 102, a: 1 },
2521
+ { r: 102, g: 204, b: 153, a: 1 },
2522
+ { r: 204, g: 102, b: 204, a: 1 },
2523
+ { r: 255, g: 200, b: 87, a: 1 },
2524
+ { r: 138, g: 201, b: 222, a: 1 },
2525
+ { r: 255, g: 153, b: 153, a: 1 },
2526
+ { r: 170, g: 170, b: 170, a: 1 }
2527
+ ];
2528
+ const fillField = aes.fill || aes.color || "category";
2529
+ const valueField = aes.y || "value";
2530
+ const categories = new Map;
2531
+ let totalValue = 0;
2532
+ for (const row of data) {
2533
+ const cat = String(row[fillField] ?? "default");
2534
+ const val = Number(row[valueField]) || 1;
2535
+ categories.set(cat, (categories.get(cat) ?? 0) + val);
2536
+ totalValue += val;
2537
+ }
2538
+ const cellsPerCategory = [];
2539
+ const categoryList = [...categories.keys()];
2540
+ let cellsAssigned = 0;
2541
+ for (let i = 0;i < categoryList.length; i++) {
2542
+ const cat = categoryList[i];
2543
+ const val = categories.get(cat);
2544
+ const proportion = val / totalValue;
2545
+ const cells = Math.round(proportion * rows * cols);
2546
+ const color = scales.color?.map(cat) ?? defaultColors[i % defaultColors.length];
2547
+ cellsPerCategory.push({ category: cat, cells, color });
2548
+ cellsAssigned += cells;
2549
+ }
2550
+ if (cellsAssigned < rows * cols && cellsPerCategory.length > 0) {
2551
+ cellsPerCategory[0].cells += rows * cols - cellsAssigned;
2552
+ }
2553
+ const grid = [];
2554
+ for (const { cells, color } of cellsPerCategory) {
2555
+ for (let i = 0;i < cells; i++) {
2556
+ grid.push({ char: fillChar, color });
2557
+ }
2558
+ }
2559
+ const emptyColor = { r: 80, g: 80, b: 80, a: 0.3 };
2560
+ while (grid.length < rows * cols) {
2561
+ grid.push({ char: emptyChar, color: emptyColor });
2562
+ }
2563
+ const availableWidth = plotRight - plotLeft - (showLegend ? 15 : 0);
2564
+ const availableHeight = plotBottom - plotTop;
2565
+ const cellWidth = Math.max(1, Math.floor(availableWidth / cols)) + gap;
2566
+ const cellHeight = Math.max(1, Math.floor(availableHeight / rows)) + gap;
2567
+ for (let row = 0;row < rows; row++) {
2568
+ for (let col = 0;col < cols; col++) {
2569
+ let idx;
2570
+ if (flip) {
2571
+ idx = row * cols + col;
2572
+ } else {
2573
+ idx = col * rows + (rows - 1 - row);
2574
+ }
2575
+ if (idx >= grid.length)
2576
+ continue;
2577
+ const cell = grid[idx];
2578
+ const x = plotLeft + col * cellWidth;
2579
+ const y = plotTop + row * cellHeight;
2580
+ if (x >= plotLeft && x < plotRight - (showLegend ? 15 : 0) && y >= plotTop && y <= plotBottom) {
2581
+ canvas.drawChar(x, y, cell.char, cell.color);
2582
+ }
2583
+ }
2584
+ }
2585
+ if (showLegend) {
2586
+ const legendX = plotRight - 12;
2587
+ let legendY = plotTop;
2588
+ for (let i = 0;i < cellsPerCategory.length && legendY < plotBottom; i++) {
2589
+ const { category, cells, color } = cellsPerCategory[i];
2590
+ const pct = Math.round(cells / (rows * cols) * 100);
2591
+ const label = `${category.slice(0, 6)} ${pct}%`;
2592
+ canvas.drawChar(legendX, legendY, "█", color);
2593
+ canvas.drawString(legendX + 2, legendY, label, { r: 180, g: 180, b: 180, a: 1 });
2594
+ legendY += 2;
2595
+ }
2596
+ }
2597
+ }
2598
+ function renderGeomSparkline(data, geom, aes, scales, canvas) {
2599
+ const sparkType = geom.params.sparkType ?? "bar";
2600
+ const width = geom.params.width ?? 20;
2601
+ const showMinmax = geom.params.show_minmax ?? false;
2602
+ const normalize = geom.params.normalize ?? true;
2603
+ const minColor = parseColorToRgba(geom.params.min_color ?? "#e74c3c");
2604
+ const maxColor = parseColorToRgba(geom.params.max_color ?? "#2ecc71");
2605
+ const plotLeft = Math.round(scales.x.range[0]);
2606
+ const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
2607
+ const plotBottom = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
2608
+ const SPARK_CHARS = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"];
2609
+ const defaultColor = { r: 79, g: 169, b: 238, a: 1 };
2610
+ const groupField = aes.group || aes.color;
2611
+ const groups = new Map;
2612
+ if (groupField) {
2613
+ for (const row of data) {
2614
+ const key = String(row[groupField] ?? "default");
2615
+ if (!groups.has(key))
2616
+ groups.set(key, []);
2617
+ groups.get(key).push(row);
2618
+ }
2619
+ } else {
2620
+ groups.set("default", [...data]);
2621
+ }
2622
+ let currentY = plotTop;
2623
+ for (const [groupKey, groupData] of groups) {
2624
+ const sorted = aes.x ? [...groupData].sort((a, b) => Number(a[aes.x]) - Number(b[aes.x])) : groupData;
2625
+ const values = sorted.map((row) => Number(row[aes.y]) || 0);
2626
+ if (values.length === 0)
2627
+ continue;
2628
+ const minVal = Math.min(...values);
2629
+ const maxVal = Math.max(...values);
2630
+ const minIdx = values.indexOf(minVal);
2631
+ const maxIdx = values.indexOf(maxVal);
2632
+ const range = maxVal - minVal || 1;
2633
+ const color = scales.color?.map(groupKey) ?? defaultColor;
2634
+ const sparkValues = [];
2635
+ if (values.length <= width) {
2636
+ sparkValues.push(...values);
2637
+ } else {
2638
+ for (let i = 0;i < width; i++) {
2639
+ const idx = Math.floor(i * values.length / width);
2640
+ sparkValues.push(values[idx]);
2641
+ }
2642
+ }
2643
+ for (let i = 0;i < sparkValues.length; i++) {
2644
+ const val = sparkValues[i];
2645
+ const normalized = normalize ? (val - minVal) / range : val / (maxVal || 1);
2646
+ const charIdx = Math.min(7, Math.max(0, Math.floor(normalized * 8)));
2647
+ const char = sparkType === "dot" ? "•" : SPARK_CHARS[charIdx];
2648
+ const x = plotLeft + i;
2649
+ const y = currentY;
2650
+ let pointColor = color;
2651
+ if (showMinmax) {
2652
+ const origIdx = Math.floor(i * values.length / sparkValues.length);
2653
+ if (origIdx === minIdx)
2654
+ pointColor = minColor;
2655
+ else if (origIdx === maxIdx)
2656
+ pointColor = maxColor;
2657
+ }
2658
+ if (x < plotLeft + width && y >= plotTop && y <= plotBottom) {
2659
+ canvas.drawChar(x, y, char, pointColor);
2660
+ }
2661
+ }
2662
+ if (groupField && groups.size > 1) {
2663
+ const labelX = plotLeft + width + 1;
2664
+ canvas.drawString(labelX, currentY, groupKey.slice(0, 8), { r: 180, g: 180, b: 180, a: 1 });
2665
+ }
2666
+ currentY += 2;
2667
+ }
2668
+ }
2669
+ function renderGeomBullet(data, geom, aes, scales, canvas) {
2670
+ const width = geom.params.width ?? 40;
2671
+ const targetChar = geom.params.target_char ?? "│";
2672
+ const barChar = geom.params.bar_char ?? "█";
2673
+ const rangeChars = geom.params.range_chars ?? ["░", "▒", "▓"];
2674
+ const showValues = geom.params.show_values ?? true;
2675
+ const targetColor = parseColorToRgba(geom.params.target_color ?? "#e74c3c");
2676
+ const plotLeft = Math.round(scales.x.range[0]);
2677
+ const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
2678
+ const plotBottom = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
2679
+ const defaultColors = [
2680
+ { r: 79, g: 169, b: 238, a: 1 },
2681
+ { r: 238, g: 136, b: 102, a: 1 },
2682
+ { r: 102, g: 204, b: 153, a: 1 }
2683
+ ];
2684
+ const rangeColors = [
2685
+ { r: 60, g: 60, b: 60, a: 1 },
2686
+ { r: 90, g: 90, b: 90, a: 1 },
2687
+ { r: 120, g: 120, b: 120, a: 1 }
2688
+ ];
2689
+ let currentY = plotTop;
2690
+ for (let i = 0;i < data.length; i++) {
2691
+ const row = data[i];
2692
+ const label = aes.x ? String(row[aes.x]).slice(0, 10) : `Item ${i + 1}`;
2693
+ const value = Number(row[aes.y]) || 0;
2694
+ const target = Number(row["target"]) || null;
2695
+ const maxValue = Number(row["max"]) || Math.max(value, target || 0) * 1.2;
2696
+ const ranges = row["ranges"] ?? [maxValue * 0.6, maxValue * 0.8, maxValue];
2697
+ const color = scales.color?.map(label) ?? defaultColors[i % defaultColors.length];
2698
+ const labelWidth = 12;
2699
+ canvas.drawString(plotLeft, currentY, label.padEnd(labelWidth), { r: 180, g: 180, b: 180, a: 1 });
2700
+ const barStart = plotLeft + labelWidth;
2701
+ const barWidth = Math.min(width, scales.x.range[1] - barStart - (showValues ? 8 : 0));
2702
+ for (let r = ranges.length - 1;r >= 0; r--) {
2703
+ const rangeWidth = Math.round(ranges[r] / maxValue * barWidth);
2704
+ for (let x = 0;x < rangeWidth; x++) {
2705
+ if (barStart + x <= scales.x.range[1]) {
2706
+ canvas.drawChar(barStart + x, currentY, rangeChars[r], rangeColors[r]);
2707
+ }
2708
+ }
2709
+ }
2710
+ const valueWidth = Math.round(value / maxValue * barWidth);
2711
+ for (let x = 0;x < valueWidth; x++) {
2712
+ if (barStart + x <= scales.x.range[1]) {
2713
+ canvas.drawChar(barStart + x, currentY, barChar, color);
2714
+ }
2715
+ }
2716
+ if (target !== null) {
2717
+ const targetX = barStart + Math.round(target / maxValue * barWidth);
2718
+ if (targetX >= barStart && targetX <= barStart + barWidth) {
2719
+ canvas.drawChar(targetX, currentY, targetChar, targetColor);
2720
+ }
2721
+ }
2722
+ if (showValues) {
2723
+ const valueStr = value.toFixed(0);
2724
+ canvas.drawString(barStart + barWidth + 2, currentY, valueStr, { r: 180, g: 180, b: 180, a: 1 });
2725
+ }
2726
+ currentY += 2;
2727
+ if (currentY > plotBottom)
2728
+ break;
2729
+ }
2730
+ }
2731
+ function renderGeomBraille(data, geom, aes, scales, canvas) {
2732
+ const brailleType = geom.params.brailleType ?? "point";
2733
+ const fill = geom.params.fill ?? false;
2734
+ const alpha = geom.params.alpha ?? 1;
2735
+ const BRAILLE_BASE = 10240;
2736
+ const DOTS = [
2737
+ [1, 2, 4, 64],
2738
+ [8, 16, 32, 128]
2739
+ ];
2740
+ const plotLeft = Math.round(scales.x.range[0]);
2741
+ const plotRight = Math.round(scales.x.range[1]);
2742
+ const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
2743
+ const plotBottom = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
2744
+ const plotWidth = plotRight - plotLeft;
2745
+ const plotHeight = plotBottom - plotTop;
2746
+ const brailleWidth = plotWidth;
2747
+ const brailleHeight = plotHeight;
2748
+ const buffer = [];
2749
+ for (let y = 0;y < brailleHeight; y++) {
2750
+ buffer[y] = new Array(brailleWidth).fill(0);
2751
+ }
2752
+ const defaultColor = { r: 79, g: 169, b: 238, a: 1 };
2753
+ const color = geom.params.color ? parseColorToRgba(geom.params.color) : defaultColor;
2754
+ const finalColor = alpha < 1 ? { ...color, a: alpha } : color;
2755
+ const sorted = aes.x ? [...data].sort((a, b) => Number(a[aes.x]) - Number(b[aes.x])) : data;
2756
+ const setDot = (canvasX, canvasY) => {
2757
+ const subX = (canvasX - plotLeft) * 2;
2758
+ const subY = (canvasY - plotTop) * 4;
2759
+ const cellX = Math.floor(subX / 2);
2760
+ const cellY = Math.floor(subY / 4);
2761
+ const dotCol = subX % 2;
2762
+ const dotRow = subY % 4;
2763
+ if (cellX >= 0 && cellX < brailleWidth && cellY >= 0 && cellY < brailleHeight) {
2764
+ if (dotCol >= 0 && dotCol < 2 && dotRow >= 0 && dotRow < 4) {
2765
+ buffer[cellY][cellX] |= DOTS[dotCol][dotRow];
2766
+ }
2767
+ }
2768
+ };
2769
+ let prevCx = null;
2770
+ let prevCy = null;
2771
+ for (const row of sorted) {
2772
+ const xVal = row[aes.x];
2773
+ const yVal = row[aes.y];
2774
+ if (xVal === null || xVal === undefined || yVal === null || yVal === undefined) {
2775
+ prevCx = null;
2776
+ prevCy = null;
2777
+ continue;
2778
+ }
2779
+ const cx = Math.round(scales.x.map(xVal));
2780
+ const cy = Math.round(scales.y.map(yVal));
2781
+ if (brailleType === "line" && prevCx !== null && prevCy !== null) {
2782
+ const dx = Math.abs(cx - prevCx);
2783
+ const dy = Math.abs(cy - prevCy);
2784
+ const sx = prevCx < cx ? 1 : -1;
2785
+ const sy = prevCy < cy ? 1 : -1;
2786
+ let err = dx - dy;
2787
+ let x = prevCx;
2788
+ let y = prevCy;
2789
+ while (true) {
2790
+ if (x >= plotLeft && x < plotRight && y >= plotTop && y < plotBottom) {
2791
+ setDot(x, y);
2792
+ if (fill) {
2793
+ for (let fy = y;fy < plotBottom; fy++) {
2794
+ setDot(x, fy);
2795
+ }
2796
+ }
2797
+ }
2798
+ if (x === cx && y === cy)
2799
+ break;
2800
+ const e2 = 2 * err;
2801
+ if (e2 > -dy) {
2802
+ err -= dy;
2803
+ x += sx;
2804
+ }
2805
+ if (e2 < dx) {
2806
+ err += dx;
2807
+ y += sy;
2808
+ }
2809
+ }
2810
+ } else {
2811
+ if (cx >= plotLeft && cx < plotRight && cy >= plotTop && cy < plotBottom) {
2812
+ setDot(cx, cy);
2813
+ }
2814
+ }
2815
+ prevCx = cx;
2816
+ prevCy = cy;
2817
+ }
2818
+ for (let y = 0;y < brailleHeight; y++) {
2819
+ for (let x = 0;x < brailleWidth; x++) {
2820
+ if (buffer[y][x] > 0) {
2821
+ const char = String.fromCharCode(BRAILLE_BASE + buffer[y][x]);
2822
+ canvas.drawChar(plotLeft + x, plotTop + y, char, finalColor);
2823
+ }
2824
+ }
2825
+ }
2826
+ }
2312
2827
  function renderGeom(data, geom, aes, scales, canvas, coordType) {
2313
2828
  switch (geom.type) {
2314
2829
  case "point":
@@ -2390,6 +2905,28 @@ function renderGeom(data, geom, aes, scales, canvas, coordType) {
2390
2905
  case "smooth":
2391
2906
  renderGeomSmooth(data, geom, aes, scales, canvas);
2392
2907
  break;
2908
+ case "beeswarm":
2909
+ case "quasirandom":
2910
+ renderGeomBeeswarm(data, geom, aes, scales, canvas);
2911
+ break;
2912
+ case "dumbbell":
2913
+ renderGeomDumbbell(data, geom, aes, scales, canvas);
2914
+ break;
2915
+ case "lollipop":
2916
+ renderGeomLollipop(data, geom, aes, scales, canvas);
2917
+ break;
2918
+ case "waffle":
2919
+ renderGeomWaffle(data, geom, aes, scales, canvas);
2920
+ break;
2921
+ case "sparkline":
2922
+ renderGeomSparkline(data, geom, aes, scales, canvas);
2923
+ break;
2924
+ case "bullet":
2925
+ renderGeomBullet(data, geom, aes, scales, canvas);
2926
+ break;
2927
+ case "braille":
2928
+ renderGeomBraille(data, geom, aes, scales, canvas);
2929
+ break;
2393
2930
  default:
2394
2931
  break;
2395
2932
  }
@@ -3517,6 +4054,224 @@ function stat_xdensity(params = {}) {
3517
4054
  };
3518
4055
  }
3519
4056
 
4057
+ // src/stats/beeswarm.ts
4058
+ function swarmArrange(yValues, params) {
4059
+ const n = yValues.length;
4060
+ if (n === 0)
4061
+ return { offsets: [], indices: [] };
4062
+ const cex = params.cex ?? 1;
4063
+ const spacing = params.spacing ?? 1;
4064
+ const side = params.side ?? 0;
4065
+ const yRange = Math.max(...yValues) - Math.min(...yValues);
4066
+ const pointSize = yRange / Math.max(n, 10) * cex * spacing;
4067
+ let indices = yValues.map((_, i) => i);
4068
+ const priority = params.priority ?? "ascending";
4069
+ switch (priority) {
4070
+ case "ascending":
4071
+ indices.sort((a, b) => yValues[a] - yValues[b]);
4072
+ break;
4073
+ case "descending":
4074
+ indices.sort((a, b) => yValues[b] - yValues[a]);
4075
+ break;
4076
+ case "random":
4077
+ for (let i = indices.length - 1;i > 0; i--) {
4078
+ const j = Math.floor(Math.random() * (i + 1));
4079
+ [indices[i], indices[j]] = [indices[j], indices[i]];
4080
+ }
4081
+ break;
4082
+ case "density":
4083
+ const median = yValues.slice().sort((a, b) => a - b)[Math.floor(n / 2)];
4084
+ indices.sort((a, b) => Math.abs(yValues[a] - median) - Math.abs(yValues[b] - median));
4085
+ break;
4086
+ }
4087
+ const placed = [];
4088
+ const offsets = new Array(n).fill(0);
4089
+ for (const idx of indices) {
4090
+ const y = yValues[idx];
4091
+ let bestOffset = 0;
4092
+ if (placed.length > 0) {
4093
+ const nearby = placed.filter((p) => Math.abs(p.y - y) < pointSize * 2);
4094
+ if (nearby.length > 0) {
4095
+ const maxOffset = nearby.length * pointSize;
4096
+ let foundSpot = false;
4097
+ for (let tryOffset = 0;tryOffset <= maxOffset && !foundSpot; tryOffset += pointSize * 0.5) {
4098
+ if (side >= 0) {
4099
+ let collision = false;
4100
+ for (const p of nearby) {
4101
+ const dx = tryOffset - p.x;
4102
+ const dy = y - p.y;
4103
+ const dist = Math.sqrt(dx * dx + dy * dy);
4104
+ if (dist < pointSize) {
4105
+ collision = true;
4106
+ break;
4107
+ }
4108
+ }
4109
+ if (!collision) {
4110
+ bestOffset = tryOffset;
4111
+ foundSpot = true;
4112
+ break;
4113
+ }
4114
+ }
4115
+ if (side <= 0 && tryOffset > 0 && !foundSpot) {
4116
+ let collision = false;
4117
+ for (const p of nearby) {
4118
+ const dx = -tryOffset - p.x;
4119
+ const dy = y - p.y;
4120
+ const dist = Math.sqrt(dx * dx + dy * dy);
4121
+ if (dist < pointSize) {
4122
+ collision = true;
4123
+ break;
4124
+ }
4125
+ }
4126
+ if (!collision) {
4127
+ bestOffset = -tryOffset;
4128
+ foundSpot = true;
4129
+ break;
4130
+ }
4131
+ }
4132
+ }
4133
+ }
4134
+ }
4135
+ offsets[idx] = bestOffset;
4136
+ placed.push({ y, x: bestOffset });
4137
+ }
4138
+ const maxAbsOffset = Math.max(...offsets.map(Math.abs), 0.001);
4139
+ const dodge = params.dodge ?? 0.8;
4140
+ const scale = dodge * 0.5 / maxAbsOffset;
4141
+ for (let i = 0;i < offsets.length; i++) {
4142
+ offsets[i] *= scale;
4143
+ }
4144
+ return { offsets, indices };
4145
+ }
4146
+ function centerArrange(yValues, params) {
4147
+ const n = yValues.length;
4148
+ if (n === 0)
4149
+ return { offsets: [], indices: [] };
4150
+ const dodge = params.dodge ?? 0.8;
4151
+ const side = params.side ?? 0;
4152
+ const indices = yValues.map((_, i) => i);
4153
+ indices.sort((a, b) => yValues[a] - yValues[b]);
4154
+ const offsets = new Array(n).fill(0);
4155
+ const maxOffset = dodge * 0.4;
4156
+ for (let i = 0;i < indices.length; i++) {
4157
+ const idx = indices[i];
4158
+ const layer = Math.floor(i / 2) + 1;
4159
+ const offset = layer / Math.ceil(n / 2) * maxOffset;
4160
+ if (side === 0) {
4161
+ offsets[idx] = i % 2 === 0 ? offset : -offset;
4162
+ } else {
4163
+ offsets[idx] = side * offset;
4164
+ }
4165
+ }
4166
+ return { offsets, indices };
4167
+ }
4168
+ function squareArrange(yValues, params) {
4169
+ const n = yValues.length;
4170
+ if (n === 0)
4171
+ return { offsets: [], indices: [] };
4172
+ const dodge = params.dodge ?? 0.8;
4173
+ const side = params.side ?? 0;
4174
+ const indices = yValues.map((_, i) => i);
4175
+ indices.sort((a, b) => yValues[a] - yValues[b]);
4176
+ const offsets = new Array(n).fill(0);
4177
+ const yRange = Math.max(...yValues) - Math.min(...yValues);
4178
+ const binSize = yRange / Math.max(Math.sqrt(n), 3);
4179
+ const bins = new Map;
4180
+ for (let i = 0;i < indices.length; i++) {
4181
+ const idx = indices[i];
4182
+ const y = yValues[idx];
4183
+ const binKey = Math.floor(y / binSize);
4184
+ if (!bins.has(binKey)) {
4185
+ bins.set(binKey, []);
4186
+ }
4187
+ bins.get(binKey).push(idx);
4188
+ }
4189
+ for (const binIndices of bins.values()) {
4190
+ const binN = binIndices.length;
4191
+ const maxOffset = dodge * 0.4;
4192
+ for (let i = 0;i < binN; i++) {
4193
+ const idx = binIndices[i];
4194
+ const offset = (i - (binN - 1) / 2) * (maxOffset * 2 / Math.max(binN - 1, 1));
4195
+ if (side === 0) {
4196
+ offsets[idx] = offset;
4197
+ } else if (side > 0) {
4198
+ offsets[idx] = Math.abs(offset);
4199
+ } else {
4200
+ offsets[idx] = -Math.abs(offset);
4201
+ }
4202
+ }
4203
+ }
4204
+ return { offsets, indices };
4205
+ }
4206
+ function computeBeeswarm(data, _xField, yField, groupKey, groupIndex, params = {}) {
4207
+ const yValues = [];
4208
+ const originalRows = [];
4209
+ for (const row of data) {
4210
+ const yVal = row[yField];
4211
+ if (yVal === null || yVal === undefined)
4212
+ continue;
4213
+ const numY = Number(yVal);
4214
+ if (isNaN(numY))
4215
+ continue;
4216
+ yValues.push(numY);
4217
+ originalRows.push(row);
4218
+ }
4219
+ if (yValues.length === 0)
4220
+ return [];
4221
+ const method = params.method ?? "swarm";
4222
+ let result;
4223
+ switch (method) {
4224
+ case "center":
4225
+ result = centerArrange(yValues, params);
4226
+ break;
4227
+ case "square":
4228
+ result = squareArrange(yValues, params);
4229
+ break;
4230
+ case "swarm":
4231
+ default:
4232
+ result = swarmArrange(yValues, params);
4233
+ }
4234
+ const output = [];
4235
+ for (let i = 0;i < yValues.length; i++) {
4236
+ const originalRow = originalRows[i];
4237
+ output.push({
4238
+ x: groupIndex + result.offsets[i],
4239
+ y: yValues[i],
4240
+ xOriginal: groupKey,
4241
+ yOriginal: yValues[i],
4242
+ xOffset: result.offsets[i],
4243
+ ...originalRow
4244
+ });
4245
+ }
4246
+ return output;
4247
+ }
4248
+ function stat_beeswarm(params = {}) {
4249
+ return {
4250
+ type: "beeswarm",
4251
+ compute(data, aes) {
4252
+ const groups = new Map;
4253
+ const groupOrder = [];
4254
+ for (const row of data) {
4255
+ const groupKey = String(row[aes.x] ?? "default");
4256
+ if (!groups.has(groupKey)) {
4257
+ groups.set(groupKey, []);
4258
+ groupOrder.push(groupKey);
4259
+ }
4260
+ groups.get(groupKey).push(row);
4261
+ }
4262
+ const result = [];
4263
+ let groupIndex = 0;
4264
+ for (const groupKey of groupOrder) {
4265
+ const groupData = groups.get(groupKey);
4266
+ const swarmResult = computeBeeswarm(groupData, aes.x, aes.y, groupKey, groupIndex, params);
4267
+ result.push(...swarmResult);
4268
+ groupIndex++;
4269
+ }
4270
+ return result;
4271
+ }
4272
+ };
4273
+ }
4274
+
3520
4275
  // src/stats/smooth.ts
3521
4276
  function linearRegression(xs, ys) {
3522
4277
  const n = xs.length;
@@ -4396,6 +5151,15 @@ function applyStatTransform(data, geom, aes) {
4396
5151
  adjust: geom.params.adjust
4397
5152
  });
4398
5153
  return xdensityStat.compute(data, aes);
5154
+ } else if (geom.stat === "beeswarm") {
5155
+ const beeswarmStat = stat_beeswarm({
5156
+ method: geom.params.method,
5157
+ cex: geom.params.cex,
5158
+ side: geom.params.side,
5159
+ priority: geom.params.priority,
5160
+ dodge: geom.params.dodge
5161
+ });
5162
+ return beeswarmStat.compute(data, aes);
4399
5163
  } else if (geom.stat === "smooth") {
4400
5164
  const smoothStat = stat_smooth({
4401
5165
  method: geom.params.method,
@@ -4522,6 +5286,10 @@ function renderToCanvas(spec, options) {
4522
5286
  scaleData = applyStatTransform(spec.data, geom, spec.aes);
4523
5287
  scaleAes = { ...spec.aes, x: "x", y: "y" };
4524
5288
  break;
5289
+ } else if (geom.stat === "beeswarm") {
5290
+ scaleData = spec.data;
5291
+ scaleAes = spec.aes;
5292
+ break;
4525
5293
  }
4526
5294
  }
4527
5295
  scaleData = applyCoordTransform(scaleData, scaleAes, spec.coord);
@@ -4562,6 +5330,8 @@ function renderToCanvas(spec, options) {
4562
5330
  geomAes = { ...spec.aes, x: "x", y: "y" };
4563
5331
  } else if (geom.stat === "xdensity") {
4564
5332
  geomAes = { ...spec.aes, x: "x", y: "y" };
5333
+ } else if (geom.stat === "beeswarm") {
5334
+ geomAes = { ...spec.aes, x: "x", y: "y" };
4565
5335
  }
4566
5336
  geomData = applyCoordTransform(geomData, geomAes, spec.coord);
4567
5337
  }
@@ -5506,9 +6276,159 @@ var init_ridgeline = __esm(() => {
5506
6276
  geom_joy = geom_ridgeline;
5507
6277
  });
5508
6278
 
6279
+ // src/geoms/beeswarm.ts
6280
+ function geom_beeswarm(options = {}) {
6281
+ return {
6282
+ type: "beeswarm",
6283
+ stat: "beeswarm",
6284
+ position: "identity",
6285
+ params: {
6286
+ method: options.method ?? "swarm",
6287
+ size: options.size ?? 1,
6288
+ cex: options.cex ?? 1,
6289
+ alpha: options.alpha ?? 1,
6290
+ color: options.color,
6291
+ shape: options.shape ?? "circle",
6292
+ side: options.side ?? 0,
6293
+ priority: options.priority ?? "ascending",
6294
+ dodge: options.dodge ?? 0.8
6295
+ }
6296
+ };
6297
+ }
6298
+ function geom_quasirandom(options = {}) {
6299
+ return geom_beeswarm({ ...options, method: "center" });
6300
+ }
6301
+
6302
+ // src/geoms/dumbbell.ts
6303
+ function geom_dumbbell(options = {}) {
6304
+ return {
6305
+ type: "dumbbell",
6306
+ stat: "identity",
6307
+ position: "identity",
6308
+ params: {
6309
+ size: options.size ?? 2,
6310
+ sizeEnd: options.sizeEnd ?? options.size ?? 2,
6311
+ color: options.color,
6312
+ colorEnd: options.colorEnd ?? options.color,
6313
+ lineColor: options.lineColor ?? "#666666",
6314
+ lineWidth: options.lineWidth ?? 1,
6315
+ alpha: options.alpha ?? 1,
6316
+ shape: options.shape ?? "circle"
6317
+ }
6318
+ };
6319
+ }
6320
+
6321
+ // src/geoms/lollipop.ts
6322
+ function geom_lollipop(options = {}) {
6323
+ return {
6324
+ type: "lollipop",
6325
+ stat: "identity",
6326
+ position: "identity",
6327
+ params: {
6328
+ size: options.size ?? 2,
6329
+ color: options.color,
6330
+ lineColor: options.lineColor,
6331
+ lineWidth: options.lineWidth ?? 1,
6332
+ alpha: options.alpha ?? 1,
6333
+ shape: options.shape ?? "circle",
6334
+ direction: options.direction ?? "vertical",
6335
+ baseline: options.baseline ?? 0
6336
+ }
6337
+ };
6338
+ }
6339
+
6340
+ // src/geoms/waffle.ts
6341
+ function geom_waffle(options = {}) {
6342
+ return {
6343
+ type: "waffle",
6344
+ stat: "identity",
6345
+ position: "identity",
6346
+ params: {
6347
+ rows: options.rows ?? 10,
6348
+ cols: options.cols ?? 10,
6349
+ n_total: options.n_total ?? 100,
6350
+ fill_char: options.fill_char ?? "█",
6351
+ empty_char: options.empty_char ?? "░",
6352
+ alpha: options.alpha ?? 1,
6353
+ show_legend: options.show_legend ?? true,
6354
+ flip: options.flip ?? false,
6355
+ gap: options.gap ?? 0
6356
+ }
6357
+ };
6358
+ }
6359
+
6360
+ // src/geoms/sparkline.ts
6361
+ function geom_sparkline(options = {}) {
6362
+ return {
6363
+ type: "sparkline",
6364
+ stat: "identity",
6365
+ position: "identity",
6366
+ params: {
6367
+ sparkType: options.type ?? "bar",
6368
+ width: options.width ?? 20,
6369
+ height: options.height ?? 1,
6370
+ show_minmax: options.show_minmax ?? false,
6371
+ color: options.color,
6372
+ min_color: options.min_color ?? "#e74c3c",
6373
+ max_color: options.max_color ?? "#2ecc71",
6374
+ normalize: options.normalize ?? true
6375
+ }
6376
+ };
6377
+ }
6378
+ var SPARK_BARS, SPARK_DOTS;
6379
+ var init_sparkline = __esm(() => {
6380
+ SPARK_BARS = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"];
6381
+ SPARK_DOTS = ["⠀", "⢀", "⢠", "⢰", "⢸", "⣸", "⣾", "⣿"];
6382
+ });
6383
+
6384
+ // src/geoms/bullet.ts
6385
+ function geom_bullet(options = {}) {
6386
+ return {
6387
+ type: "bullet",
6388
+ stat: "identity",
6389
+ position: "identity",
6390
+ params: {
6391
+ width: options.width ?? 40,
6392
+ height: options.height ?? 1,
6393
+ target_char: options.target_char ?? "│",
6394
+ bar_char: options.bar_char ?? "█",
6395
+ range_chars: options.range_chars ?? ["░", "▒", "▓"],
6396
+ show_values: options.show_values ?? true,
6397
+ color: options.color,
6398
+ target_color: options.target_color ?? "#e74c3c",
6399
+ orientation: options.orientation ?? "horizontal"
6400
+ }
6401
+ };
6402
+ }
6403
+
6404
+ // src/geoms/braille.ts
6405
+ function geom_braille(options = {}) {
6406
+ return {
6407
+ type: "braille",
6408
+ stat: "identity",
6409
+ position: "identity",
6410
+ params: {
6411
+ brailleType: options.type ?? "point",
6412
+ color: options.color,
6413
+ fill: options.fill ?? false,
6414
+ alpha: options.alpha ?? 1,
6415
+ dot_size: options.dot_size ?? 1
6416
+ }
6417
+ };
6418
+ }
6419
+ var BRAILLE_BASE = 10240, BRAILLE_DOTS;
6420
+ var init_braille = __esm(() => {
6421
+ BRAILLE_DOTS = [
6422
+ [1, 2, 4, 64],
6423
+ [8, 16, 32, 128]
6424
+ ];
6425
+ });
6426
+
5509
6427
  // src/geoms/index.ts
5510
6428
  var init_geoms = __esm(() => {
5511
6429
  init_ridgeline();
6430
+ init_sparkline();
6431
+ init_braille();
5512
6432
  });
5513
6433
 
5514
6434
  // src/stats/index.ts
@@ -9914,6 +10834,7 @@ __export(exports_src, {
9914
10834
  stat_boxplot: () => stat_boxplot,
9915
10835
  stat_bin2d: () => stat_bin2d,
9916
10836
  stat_bin: () => stat_bin,
10837
+ stat_beeswarm: () => stat_beeswarm,
9917
10838
  startREPL: () => startREPL,
9918
10839
  selectRenderer: () => selectRenderer,
9919
10840
  selectColorMode: () => selectColorMode,
@@ -10010,11 +10931,13 @@ __export(exports_src, {
10010
10931
  getColorEscape: () => getColorEscape,
10011
10932
  getCapabilities: () => getCapabilities,
10012
10933
  getAvailablePalettes: () => getAvailablePalettes,
10934
+ geom_waffle: () => geom_waffle,
10013
10935
  geom_vline: () => geom_vline,
10014
10936
  geom_violin: () => geom_violin,
10015
10937
  geom_tile: () => geom_tile,
10016
10938
  geom_text: () => geom_text,
10017
10939
  geom_step: () => geom_step,
10940
+ geom_sparkline: () => geom_sparkline,
10018
10941
  geom_smooth: () => geom_smooth,
10019
10942
  geom_segment: () => geom_segment,
10020
10943
  geom_rug: () => geom_rug,
@@ -10022,11 +10945,13 @@ __export(exports_src, {
10022
10945
  geom_ribbon: () => geom_ribbon,
10023
10946
  geom_rect: () => geom_rect,
10024
10947
  geom_raster: () => geom_raster,
10948
+ geom_quasirandom: () => geom_quasirandom,
10025
10949
  geom_qq_line: () => geom_qq_line,
10026
10950
  geom_qq: () => geom_qq,
10027
10951
  geom_pointrange: () => geom_pointrange,
10028
10952
  geom_point: () => geom_point,
10029
10953
  geom_path: () => geom_path,
10954
+ geom_lollipop: () => geom_lollipop,
10030
10955
  geom_linerange: () => geom_linerange,
10031
10956
  geom_line: () => geom_line,
10032
10957
  geom_label: () => geom_label,
@@ -10036,14 +10961,18 @@ __export(exports_src, {
10036
10961
  geom_freqpoly: () => geom_freqpoly,
10037
10962
  geom_errorbarh: () => geom_errorbarh,
10038
10963
  geom_errorbar: () => geom_errorbar,
10964
+ geom_dumbbell: () => geom_dumbbell,
10039
10965
  geom_density_2d: () => geom_density_2d,
10040
10966
  geom_curve: () => geom_curve,
10041
10967
  geom_crossbar: () => geom_crossbar,
10042
10968
  geom_contour_filled: () => geom_contour_filled,
10043
10969
  geom_contour: () => geom_contour,
10044
10970
  geom_col: () => geom_col,
10971
+ geom_bullet: () => geom_bullet,
10972
+ geom_braille: () => geom_braille,
10045
10973
  geom_boxplot: () => geom_boxplot,
10046
10974
  geom_bin2d: () => geom_bin2d,
10975
+ geom_beeswarm: () => geom_beeswarm,
10047
10976
  geom_bar: () => geom_bar,
10048
10977
  geom_area: () => geom_area,
10049
10978
  geom_abline: () => geom_abline,
@@ -10090,6 +11019,7 @@ __export(exports_src, {
10090
11019
  computeBoxplotStats: () => computeBoxplotStats,
10091
11020
  computeBins2d: () => computeBins2d,
10092
11021
  computeBins: () => computeBins,
11022
+ computeBeeswarm: () => computeBeeswarm,
10093
11023
  colorDistance: () => colorDistance,
10094
11024
  clearCapabilityCache: () => clearCapabilityCache,
10095
11025
  calculatePanelLayouts: () => calculatePanelLayouts,
@@ -10111,6 +11041,8 @@ __export(exports_src, {
10111
11041
  annotate: () => annotate,
10112
11042
  TerminalCanvas: () => TerminalCanvas,
10113
11043
  StreamingPlot: () => StreamingPlot,
11044
+ SPARK_DOTS: () => SPARK_DOTS,
11045
+ SPARK_BARS: () => SPARK_BARS,
10114
11046
  SHAPE_CHARS: () => SHAPE_CHARS,
10115
11047
  RollingAggregator: () => RollingAggregator,
10116
11048
  RendererChain: () => RendererChain,
@@ -10130,6 +11062,8 @@ __export(exports_src, {
10130
11062
  DEFAULT_BG: () => DEFAULT_BG,
10131
11063
  CanvasDiff: () => CanvasDiff,
10132
11064
  Binner: () => Binner,
11065
+ BRAILLE_DOTS: () => BRAILLE_DOTS,
11066
+ BRAILLE_BASE: () => BRAILLE_BASE,
10133
11067
  ANSI_16_COLORS: () => ANSI_16_COLORS
10134
11068
  });
10135
11069
  var init_src = __esm(() => {
@@ -10941,6 +11875,14 @@ var GEOM_TYPES = [
10941
11875
  "violin",
10942
11876
  "ridgeline",
10943
11877
  "joy",
11878
+ "beeswarm",
11879
+ "quasirandom",
11880
+ "dumbbell",
11881
+ "lollipop",
11882
+ "waffle",
11883
+ "sparkline",
11884
+ "bullet",
11885
+ "braille",
10944
11886
  "area",
10945
11887
  "ribbon",
10946
11888
  "rug",
@@ -11335,7 +12277,7 @@ Error: Unknown geometry type "${geomType}"`);
11335
12277
  Available geom types:`);
11336
12278
  console.error(` Points/Lines: point, line, path, step, smooth, segment`);
11337
12279
  console.error(` Bars/Areas: bar, col, histogram, freqpoly, area, ribbon`);
11338
- console.error(` Distributions: boxplot, violin, ridgeline, joy, qq, density_2d`);
12280
+ console.error(` Distributions: boxplot, violin, ridgeline, joy, beeswarm, quasirandom, qq, density_2d`);
11339
12281
  console.error(` Uncertainty: errorbar, errorbarh, crossbar, linerange, pointrange`);
11340
12282
  console.error(` 2D: tile, rect, raster, bin2d, contour, contour_filled`);
11341
12283
  console.error(` Text: text, label`);
@@ -11484,6 +12426,28 @@ If you want a univariate plot, try: histogram, bar, qq, or freqpoly`);
11484
12426
  case "joy":
11485
12427
  plot = plot.geom(geom_ridgeline());
11486
12428
  break;
12429
+ case "beeswarm":
12430
+ case "quasirandom":
12431
+ plot = plot.geom(geom_beeswarm());
12432
+ break;
12433
+ case "dumbbell":
12434
+ plot = plot.geom(geom_dumbbell());
12435
+ break;
12436
+ case "lollipop":
12437
+ plot = plot.geom(geom_lollipop());
12438
+ break;
12439
+ case "waffle":
12440
+ plot = plot.geom(geom_waffle());
12441
+ break;
12442
+ case "sparkline":
12443
+ plot = plot.geom(geom_sparkline());
12444
+ break;
12445
+ case "bullet":
12446
+ plot = plot.geom(geom_bullet());
12447
+ break;
12448
+ case "braille":
12449
+ plot = plot.geom(geom_braille());
12450
+ break;
11487
12451
  case "bar":
11488
12452
  plot = plot.geom(geom_bar());
11489
12453
  break;