|
500 | 500 | ;; Missing features are deferred, not abandoned - the design should accommodate |
501 | 501 | ;; them without fundamental restructuring. |
502 | 502 |
|
| 503 | +;; # Rendering Targets |
| 504 | +;; |
| 505 | +;; This API is designed to work with multiple **rendering targets**—the actual |
| 506 | +;; visualization libraries that produce the final output. Each target has different |
| 507 | +;; strengths: |
| 508 | +;; |
| 509 | +;; - **`:geom`** ([thi.ng/geom](https://github.com/thi-ng/geom)) - Static SVG, easy to save to files |
| 510 | +;; - **`:vl`** ([Vega-Lite](https://vega.github.io/vega-lite/)) - Interactive web visualizations, some coordinate system limitations |
| 511 | +;; - **`:plotly`** ([Plotly.js](https://plotly.com/javascript/)) - Interactive with 3D support, static export is tricky |
| 512 | +;; |
| 513 | +;; The idea: you write your plot specification once using our API, and it can be |
| 514 | +;; rendered by different targets. This separates **what** you want to visualize from |
| 515 | +;; **how** it gets rendered. |
| 516 | + |
| 517 | +;; # The Delegation Strategy |
| 518 | +;; |
| 519 | +;; ### 📖 Core Principle |
| 520 | +;; |
| 521 | +;; **Statistical transforms require domain computation. Everything else delegates.** |
| 522 | +;; |
| 523 | +;; Transforms like histograms and regression need to know data extents before |
| 524 | +;; computing derived data. So we compute: |
| 525 | +;; - Statistical transforms (histogram bins, regression lines) |
| 526 | +;; - Domains when needed (always for `:geom`, only custom for `:vl`/`:plotly`) |
| 527 | +;; - Type information (from Tablecloth's `col/typeof`) |
| 528 | +;; |
| 529 | +;; We delegate to rendering targets: |
| 530 | +;; - Axis rendering, tick placement, "nice numbers" |
| 531 | +;; - Range computation (pixels/visual coordinates) |
| 532 | +;; - Scale merging across layers |
| 533 | +;; |
| 534 | +;; This gives us control where it matters (correctness, consistency) while |
| 535 | +;; leveraging mature tools where they excel (formatting, layout). |
| 536 | +;; |
| 537 | +;; **Why compute transforms ourselves?** Two reasons: |
| 538 | +;; 1. Consistency - visualizations match statistical computations in Clojure libs |
| 539 | +;; 2. Efficiency - compute summaries (20 histogram bars), not raw data (1M points) |
| 540 | + |
503 | 541 | ;; # Malli Schemas |
504 | 542 | ;; |
505 | 543 | ;; The following Malli schemas define the structure and valid values for plot specs, |
|
878 | 916 | ;; - No collision with data columns (`:=plottype` ≠ `:plottype`) |
879 | 917 | ;; - All standard library operations work: `assoc`, `update`, `mapv`, `filter`, `into` |
880 | 918 |
|
881 | | -;; # Rendering Targets |
882 | | -;; |
883 | | -;; This API is designed to work with multiple **rendering targets**—the actual |
884 | | -;; visualization libraries that produce the final output. Each target has different |
885 | | -;; strengths: |
886 | | -;; |
887 | | -;; - **`:geom`** ([thi.ng/geom](https://github.com/thi-ng/geom)) - Static SVG, easy to save to files |
888 | | -;; - **`:vl`** ([Vega-Lite](https://vega.github.io/vega-lite/)) - Interactive web visualizations, some coordinate system limitations |
889 | | -;; - **`:plotly`** ([Plotly.js](https://plotly.com/javascript/)) - Interactive with 3D support, static export is tricky |
890 | | -;; |
891 | | -;; The idea: you write your plot specification once using our API, and it can be |
892 | | -;; rendered by different targets. This separates **what** you want to visualize from |
893 | | -;; **how** it gets rendered. |
894 | | - |
895 | | -;; # The Delegation Strategy |
896 | | -;; |
897 | | -;; ### 📖 Core Principle |
898 | | -;; |
899 | | -;; **Statistical transforms require domain computation. Everything else delegates.** |
900 | | -;; |
901 | | -;; Transforms like histograms and regression need to know data extents before |
902 | | -;; computing derived data. So we compute: |
903 | | -;; - Statistical transforms (histogram bins, regression lines) |
904 | | -;; - Domains when needed (always for `:geom`, only custom for `:vl`/`:plotly`) |
905 | | -;; - Type information (from Tablecloth's `col/typeof`) |
906 | | -;; |
907 | | -;; We delegate to rendering targets: |
908 | | -;; - Axis rendering, tick placement, "nice numbers" |
909 | | -;; - Range computation (pixels/visual coordinates) |
910 | | -;; - Scale merging across layers |
911 | | -;; |
912 | | -;; This gives us control where it matters (correctness, consistency) while |
913 | | -;; leveraging mature tools where they excel (formatting, layout). |
914 | | -;; |
915 | | -;; **Why compute transforms ourselves?** Two reasons: |
916 | | -;; 1. Consistency - visualizations match statistical computations in Clojure libs |
917 | | -;; 2. Efficiency - compute summaries (20 histogram bars), not raw data (1M points) |
| 919 | +;; # API Implementation |
918 | 920 | ;; |
919 | | -;; # Proposed Design |
| 921 | +;; This section implements the core API: operators, constructors, and the rendering |
| 922 | +;; function. These are the building blocks users interact with directly. |
920 | 923 |
|
921 | 924 | ;; ### ⚙️ Helper Functions |
922 | 925 |
|
|
0 commit comments