derive-dashboards 0.7.1 → 0.9.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.
- package/CHANGELOG.md +513 -0
- package/README.md +8 -2
- package/dist/adapter/statement.mjs +9 -7
- package/dist/authorize.mjs +27 -6
- package/dist/body.mjs +28 -25
- package/dist/cache.d.mts +2 -2
- package/dist/charts/data/buckets.d.mts +25 -7
- package/dist/charts/data/buckets.mjs +92 -15
- package/dist/charts/data/clean.mjs +254 -12
- package/dist/charts/data/format.d.mts +7 -2
- package/dist/charts/data/format.mjs +68 -70
- package/dist/charts/data/input-error.d.mts +2 -0
- package/dist/charts/data/input-error.mjs +2 -0
- package/dist/charts/data/rows.d.mts +3 -1
- package/dist/charts/data/rows.mjs +4 -2
- package/dist/charts/data/types.d.mts +50 -7
- package/dist/charts/data/words.d.mts +13 -0
- package/dist/charts/data/words.mjs +8 -1
- package/dist/charts/describe.mjs +6 -6
- package/dist/charts/index.d.mts +14 -14
- package/dist/charts/index.mjs +4 -1
- package/dist/charts/kinds/area-marks.mjs +86 -44
- package/dist/charts/kinds/area.d.mts +3 -3
- package/dist/charts/kinds/area.mjs +32 -11
- package/dist/charts/kinds/bars-data.d.mts +3 -3
- package/dist/charts/kinds/bars-data.mjs +12 -6
- package/dist/charts/kinds/bars-layout.mjs +60 -6
- package/dist/charts/kinds/bars-marks.mjs +6 -6
- package/dist/charts/kinds/bars.d.mts +5 -3
- package/dist/charts/kinds/bars.mjs +39 -6
- package/dist/charts/kinds/columns-data.mjs +14 -5
- package/dist/charts/kinds/columns-marks.mjs +52 -23
- package/dist/charts/kinds/columns.d.mts +2 -2
- package/dist/charts/kinds/columns.mjs +36 -10
- package/dist/charts/kinds/course-data.mjs +44 -0
- package/dist/charts/kinds/course-layout.mjs +77 -0
- package/dist/charts/kinds/course-marks.mjs +52 -0
- package/dist/charts/kinds/course-words.mjs +64 -0
- package/dist/charts/kinds/course.d.mts +10 -0
- package/dist/charts/kinds/course.mjs +55 -0
- package/dist/charts/kinds/dumbbell-data.d.mts +4 -4
- package/dist/charts/kinds/dumbbell-data.mjs +3 -3
- package/dist/charts/kinds/dumbbell-layout.mjs +17 -8
- package/dist/charts/kinds/dumbbell.d.mts +5 -3
- package/dist/charts/kinds/dumbbell.mjs +35 -4
- package/dist/charts/kinds/funnel-data.d.mts +3 -3
- package/dist/charts/kinds/funnel-data.mjs +11 -16
- package/dist/charts/kinds/funnel-layout.mjs +7 -6
- package/dist/charts/kinds/funnel.d.mts +5 -4
- package/dist/charts/kinds/funnel.mjs +33 -6
- package/dist/charts/kinds/grid-data.d.mts +3 -3
- package/dist/charts/kinds/grid-data.mjs +55 -13
- package/dist/charts/kinds/grid-layout.mjs +88 -13
- package/dist/charts/kinds/grid-legend.mjs +60 -0
- package/dist/charts/kinds/grid-marks.mjs +81 -32
- package/dist/charts/kinds/grid-time.mjs +19 -5
- package/dist/charts/kinds/grid-words.mjs +57 -35
- package/dist/charts/kinds/grid.d.mts +7 -4
- package/dist/charts/kinds/grid.mjs +51 -9
- package/dist/charts/kinds/histogram-data.mjs +68 -26
- package/dist/charts/kinds/histogram-layout.mjs +4 -3
- package/dist/charts/kinds/histogram-words.mjs +2 -3
- package/dist/charts/kinds/histogram.d.mts +2 -2
- package/dist/charts/kinds/histogram.mjs +17 -1
- package/dist/charts/kinds/line-marks.mjs +19 -11
- package/dist/charts/kinds/line.d.mts +2 -2
- package/dist/charts/kinds/line.mjs +21 -3
- package/dist/charts/kinds/multiples-grid.mjs +57 -27
- package/dist/charts/kinds/multiples-head.mjs +52 -22
- package/dist/charts/kinds/multiples-layout.mjs +106 -52
- package/dist/charts/kinds/multiples-marks.mjs +6 -5
- package/dist/charts/kinds/multiples-words.mjs +53 -38
- package/dist/charts/kinds/multiples.d.mts +2 -2
- package/dist/charts/kinds/multiples.mjs +35 -7
- package/dist/charts/kinds/row-chart.d.mts +7 -0
- package/dist/charts/kinds/row-chart.mjs +47 -10
- package/dist/charts/kinds/row-marks.mjs +5 -5
- package/dist/charts/kinds/scatter-data.d.mts +5 -5
- package/dist/charts/kinds/scatter-data.mjs +6 -6
- package/dist/charts/kinds/scatter-marks.mjs +46 -19
- package/dist/charts/kinds/scatter-words.mjs +8 -8
- package/dist/charts/kinds/scatter.d.mts +5 -3
- package/dist/charts/kinds/scatter.mjs +18 -0
- package/dist/charts/kinds/stat-data.mjs +7 -7
- package/dist/charts/kinds/stat-marks.mjs +2 -2
- package/dist/charts/kinds/stat.d.mts +4 -4
- package/dist/charts/kinds/stat.mjs +19 -0
- package/dist/charts/kinds/time-chart.mjs +13 -4
- package/dist/charts/kinds/time-frame.mjs +50 -19
- package/dist/charts/kinds/time-plan.mjs +29 -2
- package/dist/charts/kinds/time-plot.mjs +1 -1
- package/dist/charts/kinds/time-stops.mjs +58 -29
- package/dist/charts/kinds/waterfall-data.d.mts +3 -3
- package/dist/charts/kinds/waterfall-data.mjs +2 -2
- package/dist/charts/kinds/waterfall.d.mts +5 -4
- package/dist/charts/kinds/waterfall.mjs +29 -2
- package/dist/charts/layout/frame.mjs +5 -3
- package/dist/charts/layout/stack.mjs +43 -22
- package/dist/charts/marks/axes.mjs +12 -6
- package/dist/charts/marks/budget.mjs +14 -0
- package/dist/charts/marks/end-labels.mjs +24 -10
- package/dist/charts/marks/legend.mjs +19 -8
- package/dist/charts/marks/lines.mjs +3 -3
- package/dist/charts/marks/more.mjs +79 -13
- package/dist/charts/marks/notes.mjs +12 -6
- package/dist/charts/marks/series-line.mjs +14 -10
- package/dist/charts/marks/thin.mjs +16 -33
- package/dist/charts/marks/x-axis.mjs +3 -2
- package/dist/charts/scale/calendar.mjs +41 -26
- package/dist/charts/scale/linear.mjs +58 -0
- package/dist/charts/scale/value.d.mts +21 -0
- package/dist/charts/scale/value.mjs +67 -9
- package/dist/charts/scene/lazy.mjs +27 -0
- package/dist/charts/scene/markup.mjs +2 -1
- package/dist/charts/scene/svg.mjs +20 -8
- package/dist/charts/scene/types.d.mts +34 -0
- package/dist/charts/text/measure.mjs +33 -3
- package/dist/charts/theme.d.mts +25 -25
- package/dist/charts/theme.mjs +47 -30
- package/dist/charts-react/Chart.d.mts +20 -0
- package/dist/charts-react/Chart.mjs +9 -67
- package/dist/charts-react/Reader.mjs +50 -96
- package/dist/charts-react/box.mjs +106 -0
- package/dist/charts-react/bucket-names.mjs +9 -24
- package/dist/charts-react/columns-picture.mjs +12 -0
- package/dist/charts-react/exact-sum.mjs +4 -7
- package/dist/charts-react/from-answer.mjs +9 -4
- package/dist/charts-react/index.d.mts +9 -2
- package/dist/charts-react/index.mjs +9 -2
- package/dist/charts-react/kinds/area.d.mts +4 -0
- package/dist/charts-react/kinds/area.mjs +38 -0
- package/dist/charts-react/kinds/bar.d.mts +4 -0
- package/dist/charts-react/kinds/bar.mjs +15 -0
- package/dist/charts-react/kinds/funnel.d.mts +4 -0
- package/dist/charts-react/kinds/funnel.mjs +13 -0
- package/dist/charts-react/kinds/heatmap.d.mts +4 -0
- package/dist/charts-react/kinds/heatmap.mjs +13 -0
- package/dist/charts-react/kinds/line.d.mts +4 -0
- package/dist/charts-react/kinds/line.mjs +20 -0
- package/dist/charts-react/kinds/multiples.d.mts +4 -0
- package/dist/charts-react/kinds/multiples.mjs +33 -0
- package/dist/charts-react/kinds/number.d.mts +5 -0
- package/dist/charts-react/kinds/number.mjs +86 -0
- package/dist/charts-react/plan-bars.mjs +15 -8
- package/dist/charts-react/plan-funnel.mjs +3 -1
- package/dist/charts-react/plan-grid.mjs +14 -5
- package/dist/charts-react/plan-of.mjs +17 -0
- package/dist/charts-react/plan-parts.mjs +16 -5
- package/dist/charts-react/plan-time.mjs +4 -53
- package/dist/charts-react/reader-page.d.mts +1 -1
- package/dist/charts-react/reader-page.mjs +19 -9
- package/dist/charts-react/renderers.d.mts +14 -0
- package/dist/charts-react/renderers.mjs +22 -0
- package/dist/charts-react/table.d.mts +1 -0
- package/dist/charts-react/table.mjs +108 -0
- package/dist/charts-react/tiles.mjs +21 -49
- package/dist/charts-react/useScene.mjs +45 -17
- package/dist/charts-react/words.mjs +19 -0
- package/dist/checks.mjs +97 -19
- package/dist/cli/add.mjs +4 -3
- package/dist/cli/doctor.mjs +2 -2
- package/dist/core/conformance/index.d.mts +5 -2
- package/dist/core/conformance/index.mjs +5 -2
- package/dist/core/conformance/memory/aggregate.mjs +11 -6
- package/dist/core/conformance/memory/rows.d.mts +7 -3
- package/dist/core/conformance/memory/rows.mjs +19 -13
- package/dist/core/conformance/memory/source.mjs +4 -4
- package/dist/core/document/control-fields.d.mts +20 -0
- package/dist/core/document/control-fields.mjs +117 -0
- package/dist/core/document/display-comparisons.d.mts +17 -0
- package/dist/core/document/display-comparisons.mjs +15 -4
- package/dist/core/document/display-entries.d.mts +14 -0
- package/dist/core/document/display-entries.mjs +25 -9
- package/dist/core/document/display-validation.d.mts +5 -1
- package/dist/core/document/display-validation.mjs +14 -7
- package/dist/core/document/display.d.mts +11 -8
- package/dist/core/document/display.mjs +26 -3
- package/dist/core/document/layout.d.mts +8 -9
- package/dist/core/document/layout.mjs +23 -6
- package/dist/core/document/stacked.d.mts +0 -7
- package/dist/core/document/types.mjs +8 -6
- package/dist/core/document/upgrade.d.mts +1 -0
- package/dist/core/document/upgrade.mjs +4 -2
- package/dist/core/engine/access.mjs +3 -3
- package/dist/core/engine/assert.mjs +4 -2
- package/dist/core/engine/bucket.mjs +2 -2
- package/dist/core/engine/checks.mjs +6 -7
- package/dist/core/engine/custom/ask.mjs +22 -2
- package/dist/core/engine/custom/cells.mjs +22 -22
- package/dist/core/engine/custom/level.mjs +12 -13
- package/dist/core/engine/custom/measures.mjs +12 -9
- package/dist/core/engine/custom/reader.mjs +3 -1
- package/dist/core/engine/custom/records.mjs +8 -7
- package/dist/core/engine/custom/unread.mjs +78 -0
- package/dist/core/engine/custom/where.mjs +15 -10
- package/dist/core/engine/index.d.mts +2 -13
- package/dist/core/engine/index.mjs +2 -12
- package/dist/core/engine/measure.mjs +1 -0
- package/dist/core/engine/members.mjs +7 -3
- package/dist/core/engine/nan.mjs +10 -1
- package/dist/core/engine/native.mjs +2 -20
- package/dist/core/engine/numbers.mjs +26 -14
- package/dist/core/engine/postgres.mjs +9 -5
- package/dist/core/engine/prepare.mjs +4 -4
- package/dist/core/engine/rank-sets.mjs +1 -1
- package/dist/core/engine/read.mjs +5 -4
- package/dist/core/engine/reader.d.mts +6 -0
- package/dist/core/engine/record-layout.mjs +3 -3
- package/dist/core/engine/run.mjs +77 -20
- package/dist/core/engine/segmented.d.mts +2 -1
- package/dist/core/engine/segmented.mjs +19 -12
- package/dist/core/engine/series.mjs +1 -1
- package/dist/core/engine/shape.mjs +8 -8
- package/dist/core/engine/sql-partition.mjs +2 -2
- package/dist/core/engine/sql-pass.mjs +3 -2
- package/dist/core/engine/sql-reader.mjs +13 -5
- package/dist/core/engine/sql-reads.mjs +2 -1
- package/dist/core/engine/sql-records.mjs +2 -2
- package/dist/core/engine/sql-split.mjs +1 -1
- package/dist/core/engine/sql-unread.mjs +70 -0
- package/dist/core/engine/time.mjs +2 -1
- package/dist/core/engine/types.d.mts +17 -0
- package/dist/core/engine/version.d.mts +1 -1
- package/dist/core/engine/version.mjs +1 -1
- package/dist/core/error/codes.d.mts +24 -1
- package/dist/core/error/codes.mjs +23 -3
- package/dist/core/error/refusal.d.mts +8 -3
- package/dist/core/error/refusal.mjs +6 -1
- package/dist/core/exact/decimal.d.mts +1 -14
- package/dist/core/exact/decimal.mjs +9 -19
- package/dist/core/exact/stored.d.mts +9 -0
- package/dist/core/exact/stored.mjs +38 -0
- package/dist/core/exact/text.d.mts +16 -1
- package/dist/core/exact/text.mjs +50 -1
- package/dist/core/format/digits.mjs +55 -0
- package/dist/core/format/index.d.mts +16 -0
- package/dist/core/format/index.mjs +27 -0
- package/dist/core/format/number.d.mts +27 -0
- package/dist/core/format/number.mjs +158 -0
- package/dist/core/format/write.d.mts +6 -0
- package/dist/core/format/write.mjs +57 -0
- package/dist/core/index.d.mts +43 -33
- package/dist/core/index.mjs +31 -28
- package/dist/core/model/defaults.d.mts +18 -1
- package/dist/core/model/defaults.mjs +19 -1
- package/dist/core/model/define.d.mts +17 -8
- package/dist/core/model/define.mjs +2 -0
- package/dist/core/model/member.d.mts +5 -3
- package/dist/core/model/member.mjs +33 -6
- package/dist/core/model/storage.mjs +40 -12
- package/dist/core/model/types.d.mts +17 -1
- package/dist/core/model/types.mjs +5 -0
- package/dist/core/model/validate/expr.d.mts +1 -7
- package/dist/core/model/validate/fields.d.mts +2 -0
- package/dist/core/model/validate/fields.mjs +14 -7
- package/dist/core/model/validate/issues.mjs +5 -1
- package/dist/core/model/validate/known-members.mjs +6 -5
- package/dist/core/model/validate/shape.mjs +36 -3
- package/dist/core/model/validate/source.mjs +2 -2
- package/dist/core/oracle/data.d.mts +4 -2
- package/dist/core/oracle/evaluate.d.mts +19 -1
- package/dist/core/oracle/evaluate.mjs +56 -10
- package/dist/core/oracle/expr.mjs +1 -1
- package/dist/core/oracle/facts.mjs +12 -5
- package/dist/core/oracle/measure.mjs +1 -1
- package/dist/core/oracle/request.mjs +39 -4
- package/dist/core/oracle/segmented.d.mts +3 -1
- package/dist/core/oracle/segmented.mjs +19 -13
- package/dist/core/oracle/unread.mjs +32 -0
- package/dist/core/oracle/visibility.mjs +4 -3
- package/dist/core/policy/bind.d.mts +2 -11
- package/dist/core/policy/bind.mjs +1 -1
- package/dist/core/policy/match.mjs +1 -1
- package/dist/core/query/closure.d.mts +7 -2
- package/dist/core/query/closure.mjs +29 -12
- package/dist/core/query/compose-tile.d.mts +3 -2
- package/dist/core/query/compose-tile.mjs +32 -13
- package/dist/core/query/compose.d.mts +0 -5
- package/dist/core/query/drill/internal.d.mts +5 -5
- package/dist/core/query/drill/internal.mjs +11 -0
- package/dist/core/query/drill/links.d.mts +2 -3
- package/dist/core/query/drill/links.mjs +18 -4
- package/dist/core/query/drill/selection.d.mts +8 -2
- package/dist/core/query/drill/selection.mjs +14 -3
- package/dist/core/query/drill/synthetic.mjs +1 -1
- package/dist/core/query/drill/time.mjs +11 -10
- package/dist/core/query/filter.d.mts +1 -6
- package/dist/core/query/filter.mjs +1 -4
- package/dist/core/query/fold.mjs +23 -0
- package/dist/core/query/segments.mjs +42 -3
- package/dist/core/query/to-wire.d.mts +7 -0
- package/dist/core/query/to-wire.mjs +14 -2
- package/dist/core/query/types.d.mts +30 -13
- package/dist/core/result/columns.mjs +23 -13
- package/dist/core/result/number.mjs +3 -3
- package/dist/core/result/status.d.mts +13 -0
- package/dist/core/result/status.mjs +18 -0
- package/dist/core/result/time-axis.d.mts +14 -13
- package/dist/core/result/time-axis.mjs +20 -2
- package/dist/core/result/types.d.mts +33 -3
- package/dist/core/result/whole.d.mts +23 -0
- package/dist/core/result/whole.mjs +27 -0
- package/dist/core/schema/agent-query.d.mts +89 -0
- package/dist/core/schema/agent-query.mjs +115 -0
- package/dist/core/schema/aliases.mjs +1 -52
- package/dist/core/schema/answer-parts.mjs +17 -13
- package/dist/core/schema/answers.d.mts +787 -319
- package/dist/core/schema/commands.d.mts +33 -23
- package/dist/core/schema/commands.mjs +26 -18
- package/dist/core/schema/custom.mjs +46 -45
- package/dist/core/schema/document.d.mts +32 -27
- package/dist/core/schema/document.mjs +61 -81
- package/dist/core/schema/drill-answers.mjs +4 -1
- package/dist/core/schema/drill.d.mts +14 -9
- package/dist/core/schema/drill.mjs +23 -22
- package/dist/core/schema/index.d.mts +5 -3
- package/dist/core/schema/index.mjs +5 -3
- package/dist/core/schema/options.d.mts +92 -0
- package/dist/core/schema/options.mjs +104 -0
- package/dist/core/schema/picks.d.mts +2 -2
- package/dist/core/schema/picks.mjs +7 -6
- package/dist/core/schema/query.d.mts +9 -83
- package/dist/core/schema/query.mjs +49 -73
- package/dist/core/schema/strict.d.mts +3 -0
- package/dist/core/schema/strict.mjs +91 -0
- package/dist/core/schema/union-error.mjs +30 -7
- package/dist/core/schema/view.d.mts +4 -3
- package/dist/core/schema/view.mjs +16 -11
- package/dist/core/store/ddl.d.mts +0 -2
- package/dist/core/store/ddl.mjs +1 -5
- package/dist/core/time/bucket.d.mts +1 -18
- package/dist/core/time/bucket.mjs +12 -8
- package/dist/core/time/compare.mjs +3 -2
- package/dist/core/time/index.d.mts +7 -8
- package/dist/core/time/instant.d.mts +15 -9
- package/dist/core/time/instant.mjs +23 -9
- package/dist/core/time/range.d.mts +3 -15
- package/dist/core/time/range.mjs +17 -7
- package/dist/core/time/stored.d.mts +8 -5
- package/dist/core/time/stored.mjs +51 -15
- package/dist/core/time/temporal.d.mts +1 -5
- package/dist/core/time/temporal.mjs +9 -4
- package/dist/core/time/text-time.d.mts +31 -2
- package/dist/core/time/text-time.mjs +139 -22
- package/dist/core/time/zone.d.mts +6 -1
- package/dist/core/time/zone.mjs +13 -4
- package/dist/core/types/api.d.mts +1 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/core/types/dashboard.d.mts +185 -0
- package/dist/core/types/dashboard.mjs +26 -0
- package/dist/core/types/drill-api.d.mts +14 -2
- package/dist/core/types/infer.d.mts +0 -4
- package/dist/core/types/options-check.d.mts +42 -0
- package/dist/core/types/options-check.mjs +90 -0
- package/dist/core/types/options.d.mts +14 -8
- package/dist/core/value/casefold.d.mts +1 -3
- package/dist/core/value/stored.d.mts +26 -0
- package/dist/core/value/stored.mjs +28 -0
- package/dist/cursor-seal.mjs +37 -9
- package/dist/dashboard-documents.d.mts +14 -6
- package/dist/dashboard-documents.mjs +32 -12
- package/dist/dashboards.mjs +10 -9
- package/dist/drill-access.mjs +6 -6
- package/dist/drill-change.mjs +18 -20
- package/dist/drill-comparison.mjs +2 -1
- package/dist/drill-crumbs.mjs +63 -28
- package/dist/drill-distinct.mjs +2 -1
- package/dist/drill-explain.mjs +1 -1
- package/dist/drill-items.mjs +1 -1
- package/dist/drill-open.mjs +39 -23
- package/dist/drill-seal.mjs +41 -13
- package/dist/drill-share.mjs +1 -1
- package/dist/drill-summary.mjs +2 -1
- package/dist/drill-targets.mjs +4 -4
- package/dist/drill-views.mjs +4 -3
- package/dist/drill.mjs +1 -1
- package/dist/editing.mjs +5 -3
- package/dist/endpoints/index.d.mts +29 -8
- package/dist/endpoints/index.mjs +4 -1
- package/dist/endpoints/meta.mjs +4 -3
- package/dist/endpoints/query.mjs +5 -2
- package/dist/endpoints/read.mjs +7 -6
- package/dist/endpoints/versions.mjs +2 -1
- package/dist/execute.d.mts +3 -0
- package/dist/execute.mjs +23 -12
- package/dist/grant.d.mts +9 -0
- package/dist/grant.mjs +43 -0
- package/dist/handler.mjs +8 -13
- package/dist/http.d.mts +6 -2
- package/dist/http.mjs +6 -2
- package/dist/index.d.mts +25 -4
- package/dist/index.mjs +91 -40
- package/dist/llms.txt +3 -3
- package/dist/mcp/api.mjs +2 -1
- package/dist/mcp/query.mjs +3 -8
- package/dist/mcp/resolve.mjs +9 -2
- package/dist/node/index.d.mts +36 -0
- package/dist/node/index.mjs +89 -0
- package/dist/node/request.d.mts +12 -0
- package/dist/node/request.mjs +119 -0
- package/dist/node/response.mjs +58 -0
- package/dist/principal.mjs +15 -7
- package/dist/react/Canvas.mjs +90 -69
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +15 -1
- package/dist/react/Dashboard.mjs +43 -42
- package/dist/react/DashboardList.mjs +9 -4
- package/dist/react/Editing.d.mts +9 -0
- package/dist/react/Editing.mjs +8 -3
- package/dist/react/Grid.mjs +1 -1
- package/dist/react/Header.mjs +25 -52
- package/dist/react/History.mjs +3 -2
- package/dist/react/LoadFailed.mjs +59 -0
- package/dist/react/Panel.d.mts +1 -1
- package/dist/react/Panel.mjs +1 -1
- package/dist/react/Parts.d.mts +34 -0
- package/dist/react/Parts.mjs +9 -6
- package/dist/react/ReviewPanel.mjs +1 -1
- package/dist/react/RowBody.d.mts +2 -0
- package/dist/react/RowBody.mjs +5 -1
- package/dist/react/Share.mjs +153 -0
- package/dist/react/TabStrip.mjs +37 -0
- package/dist/react/Tile.d.mts +3 -1
- package/dist/react/Tile.mjs +89 -92
- package/dist/react/TileState.mjs +117 -0
- package/dist/react/ago.mjs +45 -0
- package/dist/react/arrange.mjs +1 -1
- package/dist/react/board.mjs +2 -2
- package/dist/react/bucket-name.d.mts +8 -0
- package/dist/react/bucket-name.mjs +13 -0
- package/dist/react/builder/DisplayOptions.mjs +219 -0
- package/dist/react/builder/Preview.mjs +13 -13
- package/dist/react/builder/RangeEditor.mjs +4 -3
- package/dist/react/builder/WidgetBuilder.d.mts +1 -7
- package/dist/react/builder/WidgetBuilder.mjs +12 -3
- package/dist/react/builder/base.d.mts +13 -2
- package/dist/react/builder/base.mjs +70 -12
- package/dist/react/builder/display.d.mts +3 -0
- package/dist/react/builder/display.mjs +256 -0
- package/dist/react/builder/labels.mjs +19 -5
- package/dist/react/builder/options.mjs +11 -6
- package/dist/react/builder/state.mjs +25 -3
- package/dist/react/builder/useBuilder.d.mts +7 -1
- package/dist/react/builder/useBuilder.mjs +6 -9
- package/dist/react/builder/usePreview.mjs +3 -2
- package/dist/react/builder/words.d.mts +16 -1
- package/dist/react/builder/words.mjs +41 -1
- package/dist/react/change-text.mjs +149 -0
- package/dist/react/client.d.mts +9 -0
- package/dist/react/client.mjs +105 -14
- package/dist/react/columns.mjs +9 -1
- package/dist/react/context.d.mts +24 -3
- package/dist/react/context.mjs +23 -7
- package/dist/react/dates-shown.mjs +76 -0
- package/dist/react/draft.mjs +3 -2
- package/dist/react/drill/Bars.mjs +12 -16
- package/dist/react/drill/Comparison.mjs +1 -1
- package/dist/react/drill/DrillPanel.d.mts +1 -1
- package/dist/react/drill/DrillPanel.mjs +2 -1
- package/dist/react/drill/Header.mjs +65 -12
- package/dist/react/drill/Items.d.mts +1 -1
- package/dist/react/drill/Notes.mjs +10 -7
- package/dist/react/drill/PanelStates.mjs +8 -1
- package/dist/react/drill/Trend.mjs +10 -5
- package/dist/react/drill/board.d.mts +1 -1
- package/dist/react/drill/board.mjs +1 -0
- package/dist/react/drill/host.mjs +4 -1
- package/dist/react/drill/lazy.mjs +2 -27
- package/dist/react/drill/props.d.mts +19 -8
- package/dist/react/drill/props.mjs +62 -18
- package/dist/react/drill/state.d.mts +15 -5
- package/dist/react/drill/state.mjs +12 -3
- package/dist/react/drill/words.d.mts +46 -3
- package/dist/react/drill/words.mjs +30 -5
- package/dist/react/english.mjs +33 -8
- package/dist/react/export/ExportButton.mjs +4 -1
- package/dist/react/export/csv.d.mts +7 -2
- package/dist/react/export/csv.mjs +24 -7
- package/dist/react/failure-words.mjs +60 -0
- package/dist/react/filters/bar.d.mts +1 -1
- package/dist/react/filters/bar.mjs +4 -1
- package/dist/react/filters/calendar.mjs +23 -8
- package/dist/react/filters/chip.mjs +7 -3
- package/dist/react/filters/context.d.mts +13 -1
- package/dist/react/filters/context.mjs +1 -1
- package/dist/react/filters/dates-said.mjs +57 -0
- package/dist/react/filters/days.d.mts +3 -4
- package/dist/react/filters/days.mjs +10 -17
- package/dist/react/filters/hooks.d.mts +11 -0
- package/dist/react/filters/hooks.mjs +10 -6
- package/dist/react/filters/menu-search.mjs +17 -9
- package/dist/react/filters/menu.mjs +10 -8
- package/dist/react/filters/phone.mjs +41 -16
- package/dist/react/filters/place.mjs +40 -0
- package/dist/react/filters/popover.mjs +18 -13
- package/dist/react/filters/rules.d.mts +4 -3
- package/dist/react/filters/rules.mjs +3 -3
- package/dist/react/filters/sheet.mjs +7 -3
- package/dist/react/filters/state.mjs +6 -1
- package/dist/react/filters/values.mjs +24 -7
- package/dist/react/filters/words.d.mts +13 -0
- package/dist/react/filters/words.mjs +5 -0
- package/dist/react/format-time.d.mts +17 -6
- package/dist/react/format-time.mjs +152 -33
- package/dist/react/format.d.mts +3 -3
- package/dist/react/format.mjs +35 -122
- package/dist/react/headline.d.mts +12 -0
- package/dist/react/headline.mjs +107 -0
- package/dist/react/index.d.mts +20 -17
- package/dist/react/index.mjs +13 -10
- package/dist/react/lazy.mjs +38 -0
- package/dist/react/messages.d.mts +78 -2
- package/dist/react/now.mjs +38 -0
- package/dist/react/place.mjs +4 -2
- package/dist/react/read.d.mts +1 -0
- package/dist/react/read.mjs +140 -9
- package/dist/react/renderers/exact.mjs +31 -59
- package/dist/react/renderers/index.d.mts +27 -6
- package/dist/react/renderers/index.mjs +154 -92
- package/dist/react/renderers/list-parts.mjs +24 -0
- package/dist/react/renderers/list.d.mts +1 -0
- package/dist/react/renderers/list.mjs +99 -43
- package/dist/react/renderers/more-rows.mjs +75 -0
- package/dist/react/renderers/number-before.mjs +320 -0
- package/dist/react/renderers/number-period.mjs +54 -0
- package/dist/react/renderers/number-whole.mjs +29 -0
- package/dist/react/renderers/props.d.mts +24 -1
- package/dist/react/renderers/props.mjs +8 -0
- package/dist/react/renderers/table-cells.mjs +137 -31
- package/dist/react/renderers/table-fit.mjs +55 -10
- package/dist/react/renderers/table-measure.mjs +29 -9
- package/dist/react/renderers/table-row.mjs +14 -9
- package/dist/react/renderers/table-scale.mjs +2 -3
- package/dist/react/renderers/table-sort.mjs +3 -2
- package/dist/react/renderers/table-whole.mjs +37 -0
- package/dist/react/renderers/table.mjs +73 -53
- package/dist/react/review.d.mts +7 -0
- package/dist/react/review.mjs +35 -8
- package/dist/react/roving.d.mts +6 -0
- package/dist/react/roving.mjs +123 -0
- package/dist/react/says-dates.d.mts +7 -0
- package/dist/react/says-dates.mjs +51 -0
- package/dist/react/series.mjs +5 -6
- package/dist/react/stable.mjs +1 -1
- package/dist/react/tabs/EditTabs.mjs +125 -0
- package/dist/react/tabs/NameField.mjs +72 -0
- package/dist/react/tabs/TabMenu.mjs +175 -0
- package/dist/react/tabs/actions.mjs +37 -0
- package/dist/react/tabs/commands.mjs +76 -0
- package/dist/react/tabs/focus.mjs +22 -0
- package/dist/react/tabs/keys.mjs +28 -0
- package/dist/react/theme-unlayered.css +1 -1
- package/dist/react/theme.css +1 -1
- package/dist/react/tile-store.d.mts +4 -0
- package/dist/react/tile-store.mjs +93 -13
- package/dist/react/touch.d.mts +16 -0
- package/dist/react/touch.mjs +39 -0
- package/dist/react/useBoard.d.mts +6 -0
- package/dist/react/useBoard.mjs +1 -0
- package/dist/react/useDashboard.d.mts +2 -0
- package/dist/react/useDashboard.mjs +5 -2
- package/dist/react/useTiles.d.mts +3 -0
- package/dist/react/useTiles.mjs +73 -17
- package/dist/react/view-grid.mjs +2 -2
- package/dist/react/view.mjs +1 -1
- package/dist/recharts/axes.mjs +1 -1
- package/dist/recharts/axis.mjs +23 -73
- package/dist/recharts/bar.d.mts +2 -1
- package/dist/recharts/bar.mjs +140 -64
- package/dist/recharts/fit.mjs +33 -0
- package/dist/recharts/line.mjs +23 -17
- package/dist/recharts/marks.mjs +2 -1
- package/dist/recharts/parts.mjs +19 -14
- package/dist/recharts/table.mjs +8 -3
- package/dist/refusal.mjs +46 -0
- package/dist/registry/filter-bar.json +1 -1
- package/dist/skills/derive-dashboards/SKILL.md +25 -9
- package/dist/tile-doc.mjs +1 -1
- package/package.json +21 -6
- package/dist/charts-react/plan.d.mts +0 -3
- package/dist/charts-react/plan.mjs +0 -37
- package/dist/charts-react/tiles.d.mts +0 -24
- package/dist/core/policy/match.d.mts +0 -16
- package/dist/core/schema/aliases.d.mts +0 -7
- package/dist/core/time/compare.d.mts +0 -30
- package/dist/react/EditBar.d.mts +0 -16
- package/dist/react/History.d.mts +0 -30
- package/dist/react/ReviewPanel.d.mts +0 -15
- package/dist/react/digits.mjs +0 -46
- package/dist/react/drill/trend-touch.mjs +0 -33
- package/dist/react/renderers/exact.d.mts +0 -6
|
@@ -10,6 +10,14 @@ export type Words = {
|
|
|
10
10
|
partial: string;
|
|
11
11
|
/** Says how many rows, panels or series there was no room to draw. */
|
|
12
12
|
more: (count: number) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Names what there was no room to draw, where it would have been: the first few by name
|
|
15
|
+
* (`named`), the rest counted (`more`, the count). English when left out. A chart finds how
|
|
16
|
+
* many names fit by search, not by trying every count, so write it so the line grows as it
|
|
17
|
+
* names more: part two names by something wider than a digit (", ", " · "), as every
|
|
18
|
+
* language's list does. Whatever it writes, the line drawn fits.
|
|
19
|
+
*/
|
|
20
|
+
notShown?: (named: readonly string[], more: number) => string;
|
|
13
21
|
/**
|
|
14
22
|
* Beside a period drawn in one column with others, in a chart of more periods than pixels:
|
|
15
23
|
* how many periods the column is the average of. English when left out.
|
|
@@ -17,6 +25,11 @@ export type Words = {
|
|
|
17
25
|
averaged?: (count: number) => string;
|
|
18
26
|
/** Visible explanation when the plotted columns average several periods. */
|
|
19
27
|
merged?: (count: number, grain: Grain, approximate: boolean) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Under ranked bars, names what the line on each bar marks (`againstLabel`): "The line on
|
|
30
|
+
* each bar: 90th percentile". English when left out.
|
|
31
|
+
*/
|
|
32
|
+
against?: (what: string) => string;
|
|
20
33
|
funnel: {
|
|
21
34
|
/** Between two steps: the share of the step above that went on, written as a percent. */
|
|
22
35
|
continues: (percent: string) => string;
|
|
@@ -5,8 +5,10 @@ const ENGLISH = {
|
|
|
5
5
|
versus: (what) => `vs ${what}`,
|
|
6
6
|
partial: "part of the period",
|
|
7
7
|
more: (count) => `and ${String(count)} more`,
|
|
8
|
+
notShown: (named, more) => `Not shown: ${[...named, ...more > 0 ? [`${String(more)} more`] : []].join(", ")}`,
|
|
8
9
|
averaged: (count) => `drawn as an average of ${String(count)}`,
|
|
9
10
|
merged: (count, grain, approximate) => "Each column is the average of " + (approximate ? "about " : "") + String(count) + " " + grain + (count === 1 ? "" : "s"),
|
|
11
|
+
against: (what) => `The line on each bar: ${what}`,
|
|
10
12
|
funnel: {
|
|
11
13
|
continues: (percent) => `${percent} continue`,
|
|
12
14
|
largestDrop: "largest drop",
|
|
@@ -28,4 +30,9 @@ const wordsOf = (env) => ({
|
|
|
28
30
|
...ENGLISH,
|
|
29
31
|
...env.words
|
|
30
32
|
});
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* What is said beside a bucket the data covers only part of, wherever its name is written: a
|
|
35
|
+
* stop's, a heatmap's column, a table's row.
|
|
36
|
+
*/
|
|
37
|
+
const periodNote = (bucket, words) => bucket?.partial === void 0 ? void 0 : bucket.partial === "start" ? words.partial : words.soFar;
|
|
38
|
+
export { ENGLISH, periodNote, wordsOf };
|
package/dist/charts/describe.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { betterWay, textAt } from "./data/format.mjs";
|
|
1
|
+
import { betterWay, textAt, writerIn } from "./data/format.mjs";
|
|
3
2
|
import { lastAt } from "./data/rows.mjs";
|
|
3
|
+
import { isRunning } from "derive-dashboards/core";
|
|
4
4
|
// src/describe.ts
|
|
5
5
|
/**
|
|
6
6
|
* How a count is written in a summary: the sentences are English, so its grouping is too. A
|
|
7
7
|
* value the data gave is written by its measure, in the host's locale, as it is in the picture.
|
|
8
8
|
*/
|
|
9
|
-
const COUNT =
|
|
9
|
+
const COUNT = writerIn("en-US");
|
|
10
10
|
/** A count with its noun: "1 row", "4 rows", "300,000 values". */
|
|
11
|
-
const counted = (count, one, many = `${one}s`) => `${COUNT.
|
|
11
|
+
const counted = (count, one, many = `${one}s`) => `${COUNT.text(count)} ${count === 1 ? one : many}`;
|
|
12
12
|
/**
|
|
13
13
|
* How many series a chart over time has, said only of several: one series is the chart itself,
|
|
14
14
|
* and what has no value says so of none.
|
|
@@ -19,7 +19,7 @@ const seriesSaid = (count) => count > 1 ? counted(count, "series", "series") : v
|
|
|
19
19
|
* chart that drew none says only what it was given: a summary describes the data, and does not
|
|
20
20
|
* add that there was no room for the picture.
|
|
21
21
|
*/
|
|
22
|
-
const shownOf = (all, shown, one, many) => shown >= all || shown === 0 ? counted(all, one, many) : `${counted(all, one, many)}, ${COUNT.
|
|
22
|
+
const shownOf = (all, shown, one, many) => shown >= all || shown === 0 ? counted(all, one, many) : `${counted(all, one, many)}, ${COUNT.text(shown)} shown`;
|
|
23
23
|
/**
|
|
24
24
|
* A summary: its opening ("Bar chart of Revenue", then what it is over and how much of it there
|
|
25
25
|
* is, each after a comma), and the sentences after it. Every sentence ends in a full stop.
|
|
@@ -32,7 +32,7 @@ const noValue = (count, one, many) => count > 0 ? `No value: ${counted(count, on
|
|
|
32
32
|
/** What the chart keeps in colour while the rest is grey context; nothing to say for none. */
|
|
33
33
|
const focusSaid = (labels) => labels.length > 0 ? `In focus: ${labels.join(", ")}` : void 0;
|
|
34
34
|
/** Said after a value whose period is still running; nothing after one that is final. */
|
|
35
|
-
const soFar = (bucket) =>
|
|
35
|
+
const soFar = (bucket) => isRunning(bucket) ? " so far" : "";
|
|
36
36
|
/** What a time axis runs over: its first bucket to its last, or its one bucket. */
|
|
37
37
|
function periodOf(titles) {
|
|
38
38
|
const first = titles[0];
|
package/dist/charts/index.d.mts
CHANGED
|
@@ -2,33 +2,33 @@ import { timeBuckets } from "./data/buckets.mjs";
|
|
|
2
2
|
import { MeasureStyle, Points, measure } from "./data/format.mjs";
|
|
3
3
|
import { ChartInputError } from "./data/input-error.mjs";
|
|
4
4
|
import { Named, keyOf, pairKey } from "./data/rows.mjs";
|
|
5
|
-
import { Bucket, Env, EventMark, Grain, Header, Measure, Reference, Series, TimeTable, TimeX, Tint, Toned, Value } from "./data/types.mjs";
|
|
5
|
+
import { Bucket, Env, EventMark, Grain, Header, Measure, Reference, Series, TimeTable, TimeX, Tint, Toned, Value, ValueIn } from "./data/types.mjs";
|
|
6
6
|
import { ENGLISH, Words } from "./data/words.mjs";
|
|
7
7
|
import { AreaOptions, areaChart, areaDraws } from "./kinds/area.mjs";
|
|
8
|
-
import { BarOptions, barChart } from "./kinds/bars.mjs";
|
|
8
|
+
import { BarOptions, BarRow, barChart } from "./kinds/bars.mjs";
|
|
9
9
|
import { ColumnOptions, columnChart } from "./kinds/columns.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { CourseOptions, courseChart } from "./kinds/course.mjs";
|
|
11
|
+
import { DumbbellOptions, DumbbellRow, dumbbellChart } from "./kinds/dumbbell.mjs";
|
|
12
|
+
import { FunnelOptions, FunnelStep, funnelChart } from "./kinds/funnel.mjs";
|
|
13
|
+
import { BarSort } from "./kinds/bars-data.mjs";
|
|
14
|
+
import { GridData, GridOptions, gridChart } from "./kinds/grid.mjs";
|
|
14
15
|
import { HistogramOptions, histogramChart } from "./kinds/histogram.mjs";
|
|
15
|
-
import { DumbbellRow, DumbbellSort } from "./kinds/dumbbell-data.mjs";
|
|
16
16
|
import { LineOptions, lineChart } from "./kinds/line.mjs";
|
|
17
|
+
import { DumbbellSort } from "./kinds/dumbbell-data.mjs";
|
|
17
18
|
import { MultiplesOptions, multiplesChart } from "./kinds/multiples.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { ROW } from "./kinds/row-chart.mjs";
|
|
20
|
+
import { ScatterOptions, ScatterPoint, scatterChart } from "./kinds/scatter.mjs";
|
|
20
21
|
import { StatOptions, statChart } from "./kinds/stat.mjs";
|
|
21
|
-
import { GridData } from "./kinds/grid-data.mjs";
|
|
22
22
|
import { Naming, TimeNotes } from "./kinds/time-plan.mjs";
|
|
23
|
-
import { WaterfallOptions, waterfallChart } from "./kinds/waterfall.mjs";
|
|
23
|
+
import { WaterfallOptions, WaterfallStep, waterfallChart } from "./kinds/waterfall.mjs";
|
|
24
24
|
import { Curve } from "./marks/lines.mjs";
|
|
25
25
|
import { litNodes } from "./marks/lit.mjs";
|
|
26
|
-
import {
|
|
26
|
+
import { valueAxis } from "./scale/value.mjs";
|
|
27
|
+
import { ScatterNamed } from "./kinds/scatter-data.mjs";
|
|
27
28
|
import { nearestItem, nearestStop } from "./scene/nearest.mjs";
|
|
28
29
|
import { BAD, GOOD, INK, MUTED, OTHER, RULE, SURFACE, paintCss } from "./scene/paint.mjs";
|
|
29
|
-
import { WaterfallStep } from "./kinds/waterfall-data.mjs";
|
|
30
30
|
import { SvgOptions, renderNodes, renderSvg } from "./scene/svg.mjs";
|
|
31
31
|
import { Box, CircleNode, Corners, Fade, Fill, GroupNode, Hover, HoverColumn, HoverItem, HoverStop, LineNode, Paint, Part, PathNode, RectNode, Scene, SceneNode, TextNode, TextRun } from "./scene/types.mjs";
|
|
32
32
|
import { Font, TextMeasurer, tableMeasure } from "./text/measure.mjs";
|
|
33
33
|
import { PALETTE, THEMES, paintsOf, seriesPaint } from "./theme.mjs";
|
|
34
|
-
export { type AreaOptions, BAD, type BarOptions, type BarRow, type BarSort, type Box, type Bucket, ChartInputError, type CircleNode, type ColumnOptions, type Corners, type Curve, type DumbbellOptions, type DumbbellRow, type DumbbellSort, ENGLISH, type Env, type EventMark, type Fade, type Fill, type Font, type FunnelOptions, type FunnelStep, GOOD, type Grain, type GridData, type GridOptions, type GroupNode, type Header, type HistogramOptions, type Hover, type HoverColumn, type HoverItem, type HoverStop, INK, type LineNode, type LineOptions, MUTED, type Measure, type MeasureStyle, type MultiplesOptions, type Named, type Naming, OTHER, PALETTE, type Paint, type Part, type PathNode, type Points, RULE, type RectNode, type Reference, SURFACE, type ScatterNamed, type ScatterOptions, type ScatterPoint, type Scene, type SceneNode, type Series, type StatOptions, type SvgOptions, THEMES, type TextMeasurer, type TextNode, type TextRun, type TimeNotes, type TimeTable, type TimeX, type Tint, type Toned, type Value, type WaterfallOptions, type WaterfallStep, type Words, areaChart, areaDraws, barChart, columnChart, dumbbellChart, funnelChart, gridChart, histogramChart, keyOf, lineChart, litNodes, measure, multiplesChart, nearestItem, nearestStop, paintCss, paintsOf, pairKey, renderNodes, renderSvg, scatterChart, seriesPaint, statChart, tableMeasure, timeBuckets, waterfallChart };
|
|
34
|
+
export { type AreaOptions, BAD, type BarOptions, type BarRow, type BarSort, type Box, type Bucket, ChartInputError, type CircleNode, type ColumnOptions, type Corners, type CourseOptions, type Curve, type DumbbellOptions, type DumbbellRow, type DumbbellSort, ENGLISH, type Env, type EventMark, type Fade, type Fill, type Font, type FunnelOptions, type FunnelStep, GOOD, type Grain, type GridData, type GridOptions, type GroupNode, type Header, type HistogramOptions, type Hover, type HoverColumn, type HoverItem, type HoverStop, INK, type LineNode, type LineOptions, MUTED, type Measure, type MeasureStyle, type MultiplesOptions, type Named, type Naming, OTHER, PALETTE, type Paint, type Part, type PathNode, type Points, ROW as ROW_SIZES, RULE, type RectNode, type Reference, SURFACE, type ScatterNamed, type ScatterOptions, type ScatterPoint, type Scene, type SceneNode, type Series, type StatOptions, type SvgOptions, THEMES, type TextMeasurer, type TextNode, type TextRun, type TimeNotes, type TimeTable, type TimeX, type Tint, type Toned, type Value, type ValueIn, type WaterfallOptions, type WaterfallStep, type Words, areaChart, areaDraws, barChart, columnChart, courseChart, dumbbellChart, funnelChart, gridChart, histogramChart, keyOf, lineChart, litNodes, measure, multiplesChart, nearestItem, nearestStop, paintCss, paintsOf, pairKey, renderNodes, renderSvg, scatterChart, seriesPaint, statChart, tableMeasure, timeBuckets, valueAxis, waterfallChart };
|
package/dist/charts/index.mjs
CHANGED
|
@@ -6,19 +6,22 @@ import { ENGLISH } from "./data/words.mjs";
|
|
|
6
6
|
import { areaChart, areaDraws } from "./kinds/area.mjs";
|
|
7
7
|
import { barChart } from "./kinds/bars.mjs";
|
|
8
8
|
import { columnChart } from "./kinds/columns.mjs";
|
|
9
|
+
import { courseChart } from "./kinds/course.mjs";
|
|
9
10
|
import { dumbbellChart } from "./kinds/dumbbell.mjs";
|
|
10
11
|
import { funnelChart } from "./kinds/funnel.mjs";
|
|
11
12
|
import { gridChart } from "./kinds/grid.mjs";
|
|
12
13
|
import { histogramChart } from "./kinds/histogram.mjs";
|
|
13
14
|
import { lineChart } from "./kinds/line.mjs";
|
|
14
15
|
import { multiplesChart } from "./kinds/multiples.mjs";
|
|
16
|
+
import { ROW } from "./kinds/row-chart.mjs";
|
|
15
17
|
import { scatterChart } from "./kinds/scatter.mjs";
|
|
16
18
|
import { statChart } from "./kinds/stat.mjs";
|
|
17
19
|
import { waterfallChart } from "./kinds/waterfall.mjs";
|
|
18
20
|
import { litNodes } from "./marks/lit.mjs";
|
|
21
|
+
import { valueAxis } from "./scale/value.mjs";
|
|
19
22
|
import { nearestItem, nearestStop } from "./scene/nearest.mjs";
|
|
20
23
|
import { BAD, GOOD, INK, MUTED, OTHER, RULE, SURFACE, paintCss } from "./scene/paint.mjs";
|
|
21
24
|
import { renderNodes, renderSvg } from "./scene/svg.mjs";
|
|
22
25
|
import { tableMeasure } from "./text/measure.mjs";
|
|
23
26
|
import { PALETTE, THEMES, paintsOf, seriesPaint } from "./theme.mjs";
|
|
24
|
-
export { BAD, ChartInputError, ENGLISH, GOOD, INK, MUTED, OTHER, PALETTE, RULE, SURFACE, THEMES, areaChart, areaDraws, barChart, columnChart, dumbbellChart, funnelChart, gridChart, histogramChart, keyOf, lineChart, litNodes, measure, multiplesChart, nearestItem, nearestStop, paintCss, paintsOf, pairKey, renderNodes, renderSvg, scatterChart, seriesPaint, statChart, tableMeasure, timeBuckets, waterfallChart };
|
|
27
|
+
export { BAD, ChartInputError, ENGLISH, GOOD, INK, MUTED, OTHER, PALETTE, ROW as ROW_SIZES, RULE, SURFACE, THEMES, areaChart, areaDraws, barChart, columnChart, courseChart, dumbbellChart, funnelChart, gridChart, histogramChart, keyOf, lineChart, litNodes, measure, multiplesChart, nearestItem, nearestStop, paintCss, paintsOf, pairKey, renderNodes, renderSvg, scatterChart, seriesPaint, statChart, tableMeasure, timeBuckets, valueAxis, waterfallChart };
|
|
@@ -1,41 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { MUTED
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { follows } from "../data/buckets.mjs";
|
|
2
|
+
import { stackedAt } from "../layout/stack.mjs";
|
|
3
|
+
import { MUTED } from "../scene/paint.mjs";
|
|
4
|
+
import { thinningStep } from "../marks/budget.mjs";
|
|
5
|
+
import { bandPath, linePath } from "../marks/lines.mjs";
|
|
6
|
+
import { thin } from "../marks/thin.mjs";
|
|
7
|
+
import { MARK, paintAt, repeatsOf } from "../theme.mjs";
|
|
8
|
+
import { isRunning, isStarting } from "derive-dashboards/core";
|
|
7
9
|
// src/kinds/area-marks.ts
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* A series' places along its band, a break (nothing) wherever it has no value or the data skips
|
|
12
|
+
* a bucket, so a band stops there as a line does.
|
|
13
|
+
*/
|
|
14
|
+
function placesOf(stack, s, buckets) {
|
|
15
|
+
const places = [];
|
|
16
|
+
for (let i = 0; i < stack.places; i++) {
|
|
17
|
+
if (i > 0 && !follows(buckets, i)) places.push(void 0);
|
|
18
|
+
places.push(stackedAt(stack, s, i) ? i : void 0);
|
|
19
|
+
}
|
|
20
|
+
return places;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A series' band thinned as a line is (`marks/thin.ts`): its two edges together, so a long
|
|
24
|
+
* series draws a few places to a thinning column; then each kept place made into its two points.
|
|
25
|
+
*/
|
|
26
|
+
function edgesOf(stack, s, at) {
|
|
27
|
+
const { frame, step } = at;
|
|
28
|
+
const [from, to] = [stack.from[s], stack.to[s]];
|
|
29
|
+
if (from === void 0 || to === void 0) return {
|
|
30
|
+
top: [],
|
|
31
|
+
bottom: []
|
|
32
|
+
};
|
|
33
|
+
const top = (i) => frame.place(to[i] ?? 0);
|
|
34
|
+
const bottom = (i) => frame.place(from[i] ?? 0);
|
|
35
|
+
const kept = thin(placesOf(stack, s, frame.buckets), {
|
|
36
|
+
x: (i) => frame.time.center(i),
|
|
37
|
+
ys: [top, bottom],
|
|
38
|
+
step
|
|
39
|
+
});
|
|
40
|
+
const point = (i, y) => i === void 0 ? void 0 : {
|
|
11
41
|
x: frame.time.center(i),
|
|
12
|
-
y:
|
|
13
|
-
}
|
|
42
|
+
y: y(i)
|
|
43
|
+
};
|
|
14
44
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
45
|
+
top: kept.map((i) => point(i, top)),
|
|
46
|
+
bottom: kept.map((i) => point(i, bottom))
|
|
17
47
|
};
|
|
18
48
|
}
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The bands, each a tint, then their upper edges over all of them, each in its band's own
|
|
51
|
+
* colour: drawn last, no edge lies under the tint of the band above it.
|
|
52
|
+
*/
|
|
53
|
+
function bandNodes(drawn, look) {
|
|
54
|
+
const repeats = repeatsOf(drawn.map((_edges, s) => paintAt(look.paints, s)));
|
|
55
|
+
return [...drawn.map((edges, s) => ({
|
|
56
|
+
kind: "path",
|
|
57
|
+
part: "band",
|
|
58
|
+
...look.keys[s] === void 0 ? {} : { key: look.keys[s] },
|
|
59
|
+
d: bandPath(edges.top, edges.bottom, look.curve),
|
|
60
|
+
fill: paintAt(look.paints, s),
|
|
61
|
+
opacity: MARK.areaFill
|
|
62
|
+
})), ...drawn.map((edges, s) => ({
|
|
63
|
+
kind: "path",
|
|
64
|
+
part: "edge",
|
|
65
|
+
...look.keys[s] === void 0 ? {} : { key: look.keys[s] },
|
|
66
|
+
d: linePath(edges.top, look.curve),
|
|
67
|
+
...repeats[s] === true ? { dash: MARK.repeat } : {},
|
|
68
|
+
stroke: paintAt(look.paints, s),
|
|
69
|
+
strokeWidth: look.dense ? MARK.hair : MARK.context
|
|
70
|
+
}))];
|
|
39
71
|
}
|
|
40
72
|
/**
|
|
41
73
|
* How far past the plot a clip of the bands reaches, across (twice that up and down): past the
|
|
@@ -51,8 +83,8 @@ const partialEdges = (late, from, open, to) => [.../* @__PURE__ */ new Set([...l
|
|
|
51
83
|
*/
|
|
52
84
|
function settledAndOpen(nodes, frame) {
|
|
53
85
|
const last = frame.buckets.length - 1;
|
|
54
|
-
const late = last >= 1 &&
|
|
55
|
-
const open = last >= 1 &&
|
|
86
|
+
const late = last >= 1 && isStarting(frame.buckets[0]);
|
|
87
|
+
const open = last >= 1 && isRunning(frame.buckets[last]);
|
|
56
88
|
if (!late && !open) return nodes;
|
|
57
89
|
const { plot } = frame;
|
|
58
90
|
const from = late ? frame.time.center(1) : plot.x - CLIP_PAD;
|
|
@@ -100,21 +132,31 @@ function settledAndOpen(nodes, frame) {
|
|
|
100
132
|
];
|
|
101
133
|
}
|
|
102
134
|
/** The stacked bands, each named at the middle of its right end. */
|
|
103
|
-
function bandsIn(frame,
|
|
104
|
-
const
|
|
135
|
+
function bandsIn(frame, stacked, look) {
|
|
136
|
+
const { series, stack } = stacked;
|
|
137
|
+
const step = thinningStep(3 * series.length, 6, stack.places / Math.max(1, frame.plot.width));
|
|
138
|
+
const drawn = series.map((_one, s) => edgesOf(stack, s, {
|
|
139
|
+
frame,
|
|
140
|
+
step
|
|
141
|
+
}));
|
|
142
|
+
const at = (s, i) => {
|
|
143
|
+
const [from, to] = [stack.from[s]?.[i], stack.to[s]?.[i]];
|
|
144
|
+
return from === void 0 || to === void 0 || !stackedAt(stack, s, i) ? void 0 : {
|
|
145
|
+
top: frame.place(to),
|
|
146
|
+
bottom: frame.place(from)
|
|
147
|
+
};
|
|
148
|
+
};
|
|
105
149
|
return {
|
|
106
|
-
nodes: settledAndOpen(bandNodes(
|
|
150
|
+
nodes: settledAndOpen(bandNodes(drawn, {
|
|
107
151
|
...look,
|
|
108
152
|
dense: frame.time.band < 1,
|
|
109
|
-
keys: series.map((s) => s.key)
|
|
110
|
-
buckets: frame.buckets
|
|
153
|
+
keys: series.map((s) => s.key)
|
|
111
154
|
}), frame),
|
|
112
155
|
labelY: (s) => {
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
return top === void 0 || bottom === void 0 ? void 0 : (top.y + bottom.y) / 2;
|
|
156
|
+
const end = at(s, stack.places - 1);
|
|
157
|
+
return end === void 0 ? void 0 : (end.top + end.bottom) / 2;
|
|
116
158
|
},
|
|
117
|
-
dotY: (one, i) =>
|
|
159
|
+
dotY: (one, i) => at(series.indexOf(one), i)?.top
|
|
118
160
|
};
|
|
119
161
|
}
|
|
120
162
|
export { bandsIn };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Env, Header, TimeTable } from "../data/types.mjs";
|
|
1
|
+
import { Env, Header, TimeTable, ValueIn } from "../data/types.mjs";
|
|
2
2
|
import { Scene } from "../scene/types.mjs";
|
|
3
3
|
import { Curve } from "../marks/lines.mjs";
|
|
4
4
|
import { Naming, TimeNotes } from "./time-plan.mjs";
|
|
@@ -18,6 +18,6 @@ export type AreaOptions = Header & TimeNotes & {
|
|
|
18
18
|
* the others, and no band's height would be its value. A host that names the picture (a
|
|
19
19
|
* caption, a legend) asks this, so it names what is drawn.
|
|
20
20
|
*/
|
|
21
|
-
export declare function areaDraws(given: TimeTable): "area" | "lines" | "columns";
|
|
21
|
+
export declare function areaDraws(given: TimeTable<ValueIn>): "area" | "lines" | "columns";
|
|
22
22
|
/** A stacked area chart of series over time. */
|
|
23
|
-
export declare function areaChart(given: TimeTable
|
|
23
|
+
export declare function areaChart(given: TimeTable<ValueIn>, options: AreaOptions, env: Env): Scene;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cleanTable } from "../data/clean.mjs";
|
|
1
|
+
import { HEADER, NOTES, checkInput, cleanTable, keysOf } from "../data/clean.mjs";
|
|
2
2
|
import { addsUp, asShares, levelsOfShares, stackOrder } from "../data/shares.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { stackOf } from "../layout/stack.mjs";
|
|
4
4
|
import { paintsOf } from "../theme.mjs";
|
|
5
5
|
import { bandsIn } from "./area-marks.mjs";
|
|
6
|
-
import { namingOf, reachEnd } from "./time-plan.mjs";
|
|
6
|
+
import { inFirstUnit, namingOf, reachEnd } from "./time-plan.mjs";
|
|
7
7
|
import { columnChart } from "./columns.mjs";
|
|
8
8
|
import { lineChart } from "./line.mjs";
|
|
9
9
|
import { timeChart } from "./time-chart.mjs";
|
|
@@ -13,6 +13,11 @@ function asLines(options) {
|
|
|
13
13
|
const { arrange: _arrange, ...rest } = options;
|
|
14
14
|
return rest;
|
|
15
15
|
}
|
|
16
|
+
/** The options a column chart shares with this one: columns have no curve. */
|
|
17
|
+
function asColumns(options) {
|
|
18
|
+
const { curve: _curve, ...rest } = options;
|
|
19
|
+
return rest;
|
|
20
|
+
}
|
|
16
21
|
/** Whether some values lie above zero and some below. */
|
|
17
22
|
const crossesZero = (values) => values.some((v) => v !== null && v > 0) && values.some((v) => v !== null && v < 0);
|
|
18
23
|
/**
|
|
@@ -27,22 +32,34 @@ function areaDraws(given) {
|
|
|
27
32
|
if (!addsUp(table.series)) return "lines";
|
|
28
33
|
return table.x.buckets.length < 2 || table.series.some((s) => crossesZero(s.values)) ? "columns" : "area";
|
|
29
34
|
}
|
|
35
|
+
/** The keys areaChart takes: any other is refused, with the one it most likely meant. */
|
|
36
|
+
const KEYS = keysOf({
|
|
37
|
+
...HEADER,
|
|
38
|
+
...NOTES,
|
|
39
|
+
arrange: true,
|
|
40
|
+
curve: true,
|
|
41
|
+
naming: true
|
|
42
|
+
});
|
|
30
43
|
/** A stacked area chart of series over time. */
|
|
31
44
|
function areaChart(given, options, env) {
|
|
45
|
+
checkInput({
|
|
46
|
+
what: "table",
|
|
47
|
+
data: given
|
|
48
|
+
}, options, env, { known: KEYS });
|
|
32
49
|
const table = cleanTable(given);
|
|
33
50
|
const draws = areaDraws(table);
|
|
34
51
|
if (draws === "lines") return lineChart(table, asLines(options), env);
|
|
35
|
-
if (draws === "columns") return columnChart(table,
|
|
36
|
-
|
|
37
|
-
...options.arrange === void 0 ? {} : { arrange: options.arrange }
|
|
38
|
-
}, env);
|
|
52
|
+
if (draws === "columns") return columnChart(table, asColumns(options), env);
|
|
53
|
+
const { left, ...inUnit } = inFirstUnit(table);
|
|
39
54
|
const places = table.x.buckets.length;
|
|
40
|
-
const ordered = stackOrder(table.series);
|
|
55
|
+
const ordered = stackOrder(inUnit.table.series);
|
|
41
56
|
const share = options.arrange === "share";
|
|
42
57
|
const series = share ? asShares(ordered, places, env.locale) : ordered;
|
|
43
58
|
const paints = paintsOf(series);
|
|
59
|
+
const stack = stackOf(series.map((one) => one.values), places, "zero");
|
|
44
60
|
return timeChart({
|
|
45
61
|
what: "Stacked area chart",
|
|
62
|
+
left,
|
|
46
63
|
table: {
|
|
47
64
|
x: table.x,
|
|
48
65
|
series
|
|
@@ -60,10 +77,14 @@ function areaChart(given, options, env) {
|
|
|
60
77
|
header: options,
|
|
61
78
|
env
|
|
62
79
|
}),
|
|
63
|
-
values:
|
|
80
|
+
values: stack.reach,
|
|
64
81
|
zero: "always",
|
|
65
|
-
bands: false
|
|
66
|
-
|
|
82
|
+
bands: false,
|
|
83
|
+
stacked: true
|
|
84
|
+
}, env, (frame) => bandsIn(frame, {
|
|
85
|
+
series,
|
|
86
|
+
stack
|
|
87
|
+
}, {
|
|
67
88
|
paints,
|
|
68
89
|
curve: options.curve ?? "straight"
|
|
69
90
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Named } from "../data/rows.mjs";
|
|
2
|
-
import { Toned, Value } from "../data/types.mjs";
|
|
3
|
-
export type BarRow = Named & Toned & {
|
|
4
|
-
value:
|
|
2
|
+
import { Toned, Value, ValueIn } from "../data/types.mjs";
|
|
3
|
+
export type BarRow<V extends ValueIn = Value> = Named & Toned & {
|
|
4
|
+
value: V;
|
|
5
5
|
/** The value as the host writes it, when it has a more exact way than the measure's. */
|
|
6
6
|
text?: string;
|
|
7
7
|
/** What this row is read against: drawn as a tick on its bar. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { drawable } from "../data/clean.mjs";
|
|
1
|
+
import { drawable, writtenOf } from "../data/clean.mjs";
|
|
2
2
|
import { said } from "../data/format.mjs";
|
|
3
3
|
import { keyOf, ranked } from "../data/rows.mjs";
|
|
4
4
|
// src/kinds/bars-data.ts
|
|
@@ -15,14 +15,20 @@ const ordered = (rows, sort) => ranked(rows, {
|
|
|
15
15
|
});
|
|
16
16
|
/** Whether a row is one the chart is about: every row, or with a focus only the rows in it. */
|
|
17
17
|
const inFocus = (row, focus) => focus === void 0 || focus.includes(keyOf(row));
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The rows as they can be drawn: a value or a tick that is not a finite number is none, and a
|
|
20
|
+
* value given as decimal text is written with every digit.
|
|
21
|
+
*/
|
|
22
|
+
function cleaned(rows, measure) {
|
|
23
|
+
return rows.map((row, i) => {
|
|
21
24
|
const { against, ...rest } = row;
|
|
22
|
-
const mark = against === void 0 ? null : drawable(against);
|
|
25
|
+
const mark = against === void 0 ? null : drawable(against, "rows[#].against", i);
|
|
26
|
+
const value = drawable(row.value, "rows[#].value", i);
|
|
27
|
+
const text = row.text ?? writtenOf(row.value, measure);
|
|
23
28
|
return {
|
|
24
29
|
...rest,
|
|
25
|
-
value
|
|
30
|
+
value,
|
|
31
|
+
...text === void 0 ? {} : { text },
|
|
26
32
|
...mark === null ? {} : { against: mark }
|
|
27
33
|
};
|
|
28
34
|
});
|
|
@@ -1,20 +1,74 @@
|
|
|
1
1
|
import { lengthsOn } from "../scale/value.mjs";
|
|
2
|
+
import { TEXT } from "../theme.mjs";
|
|
2
3
|
import { inFocus, textOf } from "./bars-data.mjs";
|
|
3
4
|
import { keptRows, reachOf, rowFrame, rowPlot, slotsOf, slotted } from "./row-chart.mjs";
|
|
4
5
|
// src/kinds/bars-layout.ts
|
|
6
|
+
/** The least width a cut name is given: a letter or two and its ellipsis. Narrower, it is left out. */
|
|
7
|
+
const LEAST_NAME = 2 * TEXT.name.size;
|
|
8
|
+
/**
|
|
9
|
+
* How the rows' numbers are written, the frame they are written in, and where the bars run
|
|
10
|
+
* between them: in full when the widest has room; else short; else short beside shorter bars;
|
|
11
|
+
* else short beside the names cut to the room the numbers and the shortest bars leave them;
|
|
12
|
+
* else, when that is too little for a cut name, short with the names left to the tooltip and
|
|
13
|
+
* the table; else not at all.
|
|
14
|
+
*/
|
|
15
|
+
function writing(rows, frame, at) {
|
|
16
|
+
const bothSides = rows.some((row) => (row.value ?? 0) < 0 || (row.against ?? 0) < 0);
|
|
17
|
+
const full = (row, v) => textOf(row, v, at.measure);
|
|
18
|
+
const short = (_row, v) => at.measure.tick(v);
|
|
19
|
+
const tried = (write, framed, least) => {
|
|
20
|
+
const texts = rows.flatMap((row) => row.value === null ? [] : [write(row, row.value)]);
|
|
21
|
+
const room = {
|
|
22
|
+
env: at.env,
|
|
23
|
+
bothSides,
|
|
24
|
+
...least === void 0 ? {} : { least }
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
write,
|
|
28
|
+
frame: framed,
|
|
29
|
+
reach: reachOf(framed, texts, room)
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const fits = [
|
|
33
|
+
tried(full, frame),
|
|
34
|
+
tried(short, frame),
|
|
35
|
+
tried(short, frame, 24)
|
|
36
|
+
].find(({ reach }) => reach.fits);
|
|
37
|
+
if (fits !== void 0) return fits;
|
|
38
|
+
const bare = tried(short, {
|
|
39
|
+
...frame,
|
|
40
|
+
names: 0,
|
|
41
|
+
left: 0
|
|
42
|
+
}, 24);
|
|
43
|
+
if (!bare.reach.fits) return {
|
|
44
|
+
write: void 0,
|
|
45
|
+
frame,
|
|
46
|
+
reach: reachOf(frame, [], {
|
|
47
|
+
env: at.env,
|
|
48
|
+
bothSides
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
const gap = frame.left - frame.names;
|
|
52
|
+
const names = Math.min(frame.names, Math.floor(bare.reach.to - bare.reach.from - 24 - gap));
|
|
53
|
+
if (names < LEAST_NAME) return bare;
|
|
54
|
+
return tried(short, {
|
|
55
|
+
...frame,
|
|
56
|
+
names,
|
|
57
|
+
left: names + gap
|
|
58
|
+
}, 24);
|
|
59
|
+
}
|
|
5
60
|
/** Where the rows go and which of them are drawn. */
|
|
6
61
|
function layoutOf(rows, options, env) {
|
|
7
62
|
const { measure, focus } = options;
|
|
8
63
|
const matters = (row) => focus !== void 0 && inFocus(row, focus);
|
|
9
|
-
const
|
|
64
|
+
const named = rowFrame(rows.map((row) => row.label), {
|
|
10
65
|
header: options,
|
|
11
66
|
labelsOf: (shown) => keptRows(rows, shown, matters).map((row) => row.label)
|
|
12
67
|
}, env);
|
|
13
68
|
const lengths = rows.flatMap((row) => [row.value ?? 0, row.against ?? 0]);
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
env
|
|
17
|
-
bothSides: lengths.some((v) => v < 0)
|
|
69
|
+
const { write, reach, frame } = writing(rows, named, {
|
|
70
|
+
measure,
|
|
71
|
+
env
|
|
18
72
|
});
|
|
19
73
|
const slots = slotted(rows, keptRows(rows, frame.shown, matters));
|
|
20
74
|
return {
|
|
@@ -23,7 +77,7 @@ function layoutOf(rows, options, env) {
|
|
|
23
77
|
x: lengthsOn(lengths, reach.from, reach.to),
|
|
24
78
|
...slots,
|
|
25
79
|
drawn: rows.some((row) => row.value !== null),
|
|
26
|
-
|
|
80
|
+
write,
|
|
27
81
|
plot: rowPlot(frame, reach, slotsOf(slots.kept))
|
|
28
82
|
};
|
|
29
83
|
}
|
|
@@ -53,20 +53,20 @@ function barNodes(row, value, slot, at) {
|
|
|
53
53
|
const end = at.x(value);
|
|
54
54
|
const up = value >= 0;
|
|
55
55
|
const mark = row.against === void 0 ? end : at.x(row.against);
|
|
56
|
-
const text = textOf(row, value, at.measure);
|
|
56
|
+
const text = at.write?.(row, value) ?? textOf(row, value, at.measure);
|
|
57
57
|
const from = numberFrom(text, {
|
|
58
58
|
end,
|
|
59
59
|
mark,
|
|
60
60
|
up
|
|
61
61
|
}, at);
|
|
62
|
-
const number = at.
|
|
62
|
+
const number = at.write === void 0 ? [] : rowValue(text, {
|
|
63
63
|
left: Math.min(zero, from),
|
|
64
64
|
right: Math.max(zero, from),
|
|
65
65
|
toRight: up,
|
|
66
66
|
y: mid,
|
|
67
67
|
frame,
|
|
68
68
|
env: at.env
|
|
69
|
-
})
|
|
69
|
+
});
|
|
70
70
|
return [
|
|
71
71
|
rowBar({
|
|
72
72
|
from: zero,
|
|
@@ -82,12 +82,12 @@ function barNodes(row, value, slot, at) {
|
|
|
82
82
|
}
|
|
83
83
|
/** One row: its name, and its bar when it has a value. */
|
|
84
84
|
function rowNodes(row, slot, at) {
|
|
85
|
-
const name = rowName(row.label, {
|
|
85
|
+
const name = at.frame.names > 0 ? [rowName(row.label, {
|
|
86
86
|
frame: at.frame,
|
|
87
87
|
slot,
|
|
88
88
|
env: at.env,
|
|
89
89
|
key: keyOf(row)
|
|
90
|
-
});
|
|
91
|
-
return row.value === null ?
|
|
90
|
+
})] : [];
|
|
91
|
+
return row.value === null ? name : [...name, ...barNodes(row, row.value, slot, at)];
|
|
92
92
|
}
|
|
93
93
|
export { colorOf, rowNodes };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Env, Header, Measure } from "../data/types.mjs";
|
|
1
|
+
import { Env, Header, Measure, ValueIn } from "../data/types.mjs";
|
|
2
2
|
import { Scene } from "../scene/types.mjs";
|
|
3
|
-
import { BarRow, BarSort } from "./bars-data.mjs";
|
|
3
|
+
import { BarRow as BarRow$1, BarSort } from "./bars-data.mjs";
|
|
4
|
+
/** A row of a ranked bar chart as a host gives it: its value a number, decimal text, or null. */
|
|
5
|
+
export type BarRow<V extends ValueIn = ValueIn> = BarRow$1<V>;
|
|
4
6
|
export type BarOptions = Header & {
|
|
5
7
|
measure: Measure;
|
|
6
8
|
/** By value, largest first (the default), or in the order given. */
|
|
@@ -14,4 +16,4 @@ export type BarOptions = Header & {
|
|
|
14
16
|
};
|
|
15
17
|
/** Ranked bars of one measure by category. */
|
|
16
18
|
export declare function barChart(rows: readonly BarRow[], options: BarOptions, env: Env): Scene;
|
|
17
|
-
export type {
|
|
19
|
+
export type { BarSort };
|