@motionscript/charts 0.1.1-alpha.1 → 0.1.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +19 -8
- package/dist/bar-chart/bar-chart.d.ts +97 -65
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +9 -5
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/chart-bars.d.ts +29 -5
- package/dist/bar-chart/chart-bars.d.ts.map +1 -1
- package/dist/bar-chart/chart-bars.js +33 -8
- package/dist/bar-chart/chart-bars.js.map +1 -1
- package/dist/bar-chart/shared.d.ts +9 -4
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +10 -5
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-7XCRX6GE.js +2 -0
- package/dist/browser/chunks/chunk-7XCRX6GE.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/kit/cartesian.d.ts +6 -4
- package/dist/kit/cartesian.d.ts.map +1 -1
- package/dist/kit/cartesian.js +5 -3
- package/dist/kit/cartesian.js.map +1 -1
- package/dist/kit/style.d.ts +339 -76
- package/dist/kit/style.d.ts.map +1 -1
- package/dist/kit/style.js +196 -101
- package/dist/kit/style.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +81 -57
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +9 -7
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +43 -43
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +2 -1
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +15 -8
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +21 -20
- package/dist/pie-chart/shared.js.map +1 -1
- package/dist/radar-chart/index.d.ts +1 -1
- package/dist/radar-chart/index.d.ts.map +1 -1
- package/dist/radar-chart/index.js +1 -1
- package/dist/radar-chart/index.js.map +1 -1
- package/dist/radar-chart/radar-chart.d.ts +37 -43
- package/dist/radar-chart/radar-chart.d.ts.map +1 -1
- package/dist/radar-chart/radar-chart.js +12 -12
- package/dist/radar-chart/radar-chart.js.map +1 -1
- package/dist/radar-chart/radar-grid.d.ts +7 -1
- package/dist/radar-chart/radar-grid.d.ts.map +1 -1
- package/dist/radar-chart/radar-grid.js +17 -15
- package/dist/radar-chart/radar-grid.js.map +1 -1
- package/dist/radar-chart/shared.d.ts +7 -2
- package/dist/radar-chart/shared.d.ts.map +1 -1
- package/dist/radar-chart/shared.js +6 -0
- package/dist/radar-chart/shared.js.map +1 -1
- package/dist/radial-chart/radial-chart.d.ts +37 -43
- package/dist/radial-chart/radial-chart.d.ts.map +1 -1
- package/dist/radial-chart/radial-chart.js +2 -1
- package/dist/radial-chart/radial-chart.js.map +1 -1
- package/dist/radial-chart/shared.d.ts +13 -9
- package/dist/radial-chart/shared.d.ts.map +1 -1
- package/dist/radial-chart/shared.js +15 -16
- package/dist/radial-chart/shared.js.map +1 -1
- package/package.json +4 -4
- package/src/bar-chart/bar-chart.ts +17 -6
- package/src/bar-chart/chart-bars.ts +48 -9
- package/src/bar-chart/shared.ts +20 -5
- package/src/kit/cartesian.ts +10 -7
- package/src/kit/style.ts +214 -118
- package/src/line-chart/line-chart.ts +14 -8
- package/src/pie-chart/pie-chart.ts +3 -1
- package/src/pie-chart/shared.ts +30 -22
- package/src/radar-chart/index.ts +1 -1
- package/src/radar-chart/radar-chart.ts +16 -13
- package/src/radar-chart/radar-grid.ts +18 -13
- package/src/radar-chart/shared.ts +9 -2
- package/src/radial-chart/radial-chart.ts +3 -1
- package/src/radial-chart/shared.ts +30 -18
- package/dist/browser/chunks/chunk-R3Q5EE6E.js +0 -2
- package/dist/browser/chunks/chunk-R3Q5EE6E.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart.js","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,GAeR,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACrH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAA+B,MAAM,eAAe,CAAA;AAC5G,OAAO,EACL,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EACT,GAAG,EACH,iBAAiB,EACjB,gBAAgB,GAIjB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,UAAU,EACV,SAAS,GACV,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAoB,M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G,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM;oBAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;gBACpF,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAA;gBAClC,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;YAChG,CAAC;SACF;QACD,sIAAsI;QACtI,aAAa,EAAE;YACb,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,OAAO,EAAE;YACjB,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;gBACvB,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAA;gBAClC,IAAI,IAAI,KAAK,CAAC;oBAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;gBACvD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAA;gBAC3B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAC1I,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\n Rect,\n Types,\n clamp,\n component2d,\n easeOut,\n type ChildView,\n type DataRecord,\n type NodeOf,\n type OutOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D,\n type Node2DProps as _Node2DProps,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type Size2D,\n type StyleInput as _StyleInput,\n type StyleValues as _StyleValues,\n} from \"@motionscript/sdk\"\nimport { formatNumber } from \"@motionscript/sdk/component\"\n\nimport { cartesianFrame, chartViews, columnGhost, frameGap, headroom, laidOutSize, overhang } from \"../kit/cartesian\"\nimport { ChartCanvas } from \"../kit/chart-canvas\"\nimport { ChartLegend } from \"../kit/chart-legend\"\nimport { SERIES_ARG, asParts, fresh } from \"../kit/entries\"\nimport { HorizontalAxis } from \"../kit/horizontal-axis\"\nimport { DEFAULT_MARKERS, ENTER_SHARE, beats, legendAway, type AnyTimeline, type Beat } from \"../kit/motion\"\nimport {\n SPOTLIGHT_DIM,\n formatMarker,\n lerpAxisDomain,\n lerpAxisEntry,\n markerStep,\n markerValues,\n niceTicks,\n num,\n resolveAxisDomain,\n settleAxisDomain,\n type AxisDomainConfig,\n type Range,\n type ResolvedAxisDomain,\n} from \"../kit/shared\"\nimport {\n CARTESIAN_GRID,\n CHART_COLORS,\n CHART_LEGEND,\n CHART_STYLE_FAMILY,\n CHART_STYLE_PRESETS,\n CHART_TEXT,\n axisConfigOf,\n legendConfigOf,\n seriesFill,\n valueText,\n} from \"../kit/style\"\nimport { VerticalAxis, axisPads } from \"../kit/vertical-axis\"\nimport { CategoryAxis, slotCentre } from \"./category-axis\"\nimport { ChartBars, type BarGeometry } from \"./chart-bars\"\nimport {\n BAR_LABELS,\n BAR_MARKS,\n barCategories,\n barSpans,\n resolveBarScale,\n type BarOrientation,\n type BarSeries,\n type BarStack,\n} from \"./shared\"\n\nconst BAR_STYLE = Types.style(\n CHART_STYLE_FAMILY,\n { colors: CHART_COLORS, text: CHART_TEXT, grid: CARTESIAN_GRID, marks: BAR_MARKS, labels: BAR_LABELS, legend: CHART_LEGEND },\n { presets: CHART_STYLE_PRESETS }\n)\n\n/** A bar chart's resolved style. */\nexport type BarChartStyle = OutOf<typeof BAR_STYLE>\n\n/** What a bar chart plots, as its entries hold it. */\nexport interface BarChartValues {\n readonly data: DataRecord[]\n readonly series: BarSeries[]\n readonly stack: BarStack\n readonly valueAxis: AxisDomainConfig\n}\n\n/** The value axis's domain with its range and ticks resolved. */\nexport type BarChartDomain = ResolvedAxisDomain\n\ninterface BarState extends BarChartValues {\n readonly categoryField: string\n readonly orientation: BarOrientation\n readonly style: BarChartStyle\n readonly weights: number[]\n readonly showing: boolean[]\n readonly spotlight: number | null\n readonly spotlightReveal: number\n}\n\nfunction drawnValue(s: BarChartValues, domain: AxisDomainConfig): AxisDomainConfig {\n const divisions = (domain.ticks?.length ?? DEFAULT_MARKERS) - 1\n const range = resolveBarScale(s.data, s.series, s.stack, domain.range, divisions)\n const even = domain.range !== undefined || s.stack === \"percent\"\n return { ...domain, range, ticks: domain.ticks ?? (even ? markerValues(range, DEFAULT_MARKERS - 1) : niceTicks(range, DEFAULT_MARKERS - 1)) }\n}\n\n/** The last domain worked out from each data array, and what it was read from. */\nconst domainsDrawn = new WeakMap<DataRecord[], { readonly key: readonly unknown[]; readonly domain: BarChartDomain }>()\n\n/** The value axis as drawn now. A series being hidden keeps its room, so the ticks hold still while it goes. */\nexport function barChartDomain(s: BarChartValues): BarChartDomain {\n const key = [s.series, s.stack, s.valueAxis]\n const kept = domainsDrawn.get(s.data)\n if (kept && kept.key.every((value, i) => value === key[i])) return kept.domain\n const domain = settleAxisDomain(s.valueAxis, (d) => drawnValue(s, d)) as BarChartDomain\n domainsDrawn.set(s.data, { key, domain })\n return domain\n}\n\n/** Ticks and the figures printed by bars both read through here, so they cannot disagree about how a number looks. */\nfunction valueLabel(s: BarChartValues, domain: BarChartDomain, value: number): string {\n const pattern = s.valueAxis.format\n if (pattern !== undefined) return formatNumber(value, pattern)\n const text = formatMarker(value, markerStep(domain.ticks))\n return s.stack === \"percent\" ? `${text}%` : text\n}\n\n/** A value along the value axis, a run of `length` px centred on 0. */\nfunction valueToPx(domain: BarChartDomain, length: number, value: number): number {\n const [min, max] = domain.range\n if (max === min) return -length / 2\n return ((value - min) / (max - min) - 0.5) * length\n}\n\n/** Where bars grow from: zero held on the scale, so a cropped axis grows them from the plot's edge. */\nfunction baselineValue(domain: BarChartDomain): number {\n const [lo, hi] = domain.range\n return clamp(0, Math.min(lo, hi), Math.max(lo, hi))\n}\n\nfunction weightAt(s: { readonly weights: readonly number[] }, index: number): number {\n return Math.max(0, s.weights[index] ?? 1)\n}\n\n/** The plot's run along the value axis and across the categories. */\nfunction runs(s: BarState, plot: Size2D): { along: number; across: number } {\n return s.orientation === \"horizontal\" ? { along: plot.width, across: plot.height } : { along: plot.height, across: plot.width }\n}\n\n/** Category `row`'s slot centre across the plot: left to right, or top to bottom. */\nfunction slotAt(s: BarState, row: number, across: number): number {\n const centre = slotCentre(row, s.data.length, across)\n return s.orientation === \"horizontal\" ? -centre : centre\n}\n\n/**\n * Series `index`'s bars in centred pixel space. Side by side, a series divides\n * the slot with its siblings by live weight; stacked, it takes the whole slot\n * and its weight scales its length, so hiding a series reflows rather than\n * punching a hole.\n */\nfunction seriesBars(s: BarState, index: number, plot: Size2D): BarGeometry[] {\n const series = s.series[index]\n if (!series) return []\n const domain = barChartDomain(s)\n const { along, across } = runs(s, plot)\n const n = s.data.length\n const slot = n > 0 ? across / n : 0\n const inner = slot * clamp(s.style.barWidth, 0, 1)\n const stacked = s.stack !== \"none\"\n let total = 0\n for (let i = 0; i < s.series.length; i++) total += weightAt(s, i)\n const unit = inner / (total > 0 ? total : 1)\n const weight = weightAt(s, index)\n let before = 0\n for (let i = 0; i < index; i++) before += weightAt(s, i)\n const gap = s.series.length > 1 ? s.style.barGap : 0\n const values = s.style.values\n\n return s.data.map((row, rowIndex) => {\n // Built from live contributions, so a fading series lowers the segments beyond it.\n const spans = barSpans(row, s.series, s.stack, s.weights)\n const span = spans[index] ?? { from: 0, to: 0, value: 0, outer: false }\n const centre = slotAt(s, rowIndex, across)\n const offset = -inner / 2 + unit * before + (unit * weight) / 2\n let caption = \"\"\n if (values !== \"none\" && span.value !== 0) {\n if (!stacked || values === \"inside\" || s.stack === \"percent\") caption = valueLabel(s, domain, stacked ? span.value : num(row, series.field))\n else if (span.outer) caption = valueLabel(s, domain, span.to)\n }\n return {\n center: stacked ? centre : centre + (s.orientation === \"horizontal\" ? -offset : offset),\n thickness: stacked ? inner : Math.max(0, unit * weight - gap),\n from: valueToPx(domain, along, span.from),\n to: valueToPx(domain, along, span.to),\n round: span.outer,\n caption,\n }\n })\n}\n\n/** Per-row opacity: 1 while nothing is spotlit, falling to {@link SPOTLIGHT_DIM} for all but the chosen category. */\nfunction categoryDims(s: BarState): number[] {\n const focus = clamp(s.spotlightReveal, 0, 1)\n const chosen = s.spotlight\n return s.data.map((_, i) => (focus <= 0 || chosen === i ? 1 : 1 - (1 - SPOTLIGHT_DIM) * focus))\n}\n\n/** The parts a bar chart's commands drive, found through its children. */\nfunction partsOf(children: readonly ChildView[]) {\n const views = chartViews(children)\n return {\n valueAxis: views.find((view) => VerticalAxis.is(view) || HorizontalAxis.is(view)) ?? null,\n categoryAxis: views.find(CategoryAxis.is) ?? null,\n bars: views.filter(ChartBars.is),\n legend: views.find(ChartLegend.is) ?? null,\n }\n}\n\n/**\n * Move series `index`'s share to `target` with its legend entry. Its bars stay\n * drawn for every frame the move covers and switch off only once a hide has\n * landed, so arriving at a time backwards matches arriving forwards.\n */\nfunction toggling(timeline: AnyTimeline, state: BarState, children: readonly ChildView[], index: number, target: number) {\n const parts = partsOf(children)\n if (!parts.bars[index]) return timeline.wait(timeline.duration)\n const from = state.series.map((_, i) => weightAt(state, i))\n const start = from[index] ?? 1\n const showing = state.series.map((s, i) => state.showing[i] ?? (s.enabled ?? true))\n return timeline.together([\n timeline.animate((t) => {\n const weights = [...from]\n weights[index] = start + (target - start) * timeline.ease(t)\n const shown = [...showing]\n shown[index] = target > 0 || t < 1\n return { weights, showing: shown }\n }, { eased: false }),\n ...(parts.legend ? [parts.legend.run(target > 0 ? \"showSeries\" : \"hideSeries\", { index })] : []),\n ])\n}\n\n/**\n * A bar chart, vertical or horizontal, its series side by side, stacked, or\n * stacked as shares of 100. Built like the line chart from `ChartCanvas`, a\n * value axis, a {@link CategoryAxis}, one {@link ChartBars} per series and\n * `ChartLegend`. Zero is always on the scale and bars grow about it, so a\n * negative value draws the other way from the same `growth` signal.\n *\n * Resting state is the finished chart; `enter` arms every part on its first\n * frame. A `to` of the value axis's `range` or `ticks` tweens from the domain as\n * drawn, so an auto axis rescales the bars continuously.\n */\nexport const BarChart = component2d({\n key: \"barChart\",\n state: {\n data: fresh<DataRecord[]>(() => [], { kind: \"dataset\" }),\n // Names a column, not a value, like the line chart's `xField`.\n categoryField: \"\",\n series: fresh<BarSeries[]>(() => [], { kind: \"series\" }),\n /** `vertical`: columns rise from a row of categories; `horizontal`: bars grow right from a column of them. */\n orientation: Types.oneOf([\"vertical\", \"horizontal\"] as const, { animatable: false }),\n /** `stacked`: each series sits on the sum of those before it; `percent`: every category reads as shares of 100. */\n stack: Types.oneOf([\"none\", \"stacked\", \"percent\"] as const),\n valueAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisEntry }),\n categoryAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisDomain }),\n style: BAR_STYLE,\n /** Rise of every bar about the baseline, `[0, 1]`: 0 collapses them onto it. */\n growth: 1,\n /** The category spotlit, or `null`. The choice snaps; `spotlightReveal` animates it. */\n spotlight: Types.custom<number | null>(null),\n spotlightReveal: 0,\n /** Each series' share of the slot, seeded from `enabled`: a weight rather than a switch, so hiding one widens the others. */\n weights: Types.custom<number[]>([], { private: true }),\n /** Whether each series' bars are drawn: on for every frame a show or hide covers, off once a hide lands. */\n showing: Types.custom<boolean[]>([], { private: true }),\n },\n defaults: {\n // A node made of parts that fill would otherwise hug them.\n width: \"fill\",\n height: \"fill\",\n weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),\n showing: (state) => state.series.map((s) => s.enabled ?? true),\n },\n allowedChildren: [],\n children: (state) => {\n const style = () => state.style\n const domain = () => barChartDomain(state)\n let plot: Node2D | undefined\n const plotSize = () => laidOutSize(plot)\n const built = state.style\n const horizontal = state.orientation === \"horizontal\"\n const categories = barCategories(state.data, state.categoryField)\n const valueConfig = () => axisConfigOf(style(), horizontal ? \"x\" : \"y\")\n const categoryConfig = () => axisConfigOf(style(), horizontal ? \"y\" : \"x\")\n const valueCaptions = () => {\n const d = domain()\n return d.ticks.map((value) => valueLabel(state, d, value))\n }\n const showValue = horizontal ? built.showXAxis : built.showYAxis\n const showCategory = horizontal ? built.showYAxis : built.showXAxis\n\n const valueAxis = showValue\n ? (horizontal\n ? new HorizontalAxis({\n range: () => domain().range,\n markers: () => domain().ticks,\n captions: valueCaptions,\n axis: valueConfig,\n label: state.valueAxis.label ?? \"\",\n overhang: () => ({ left: overhang(style()), right: overhang(style()) }),\n width: \"fill\",\n height: \"hug\",\n })\n : new VerticalAxis({\n range: () => domain().range,\n markers: () => domain().ticks,\n captions: valueCaptions,\n axis: valueConfig,\n label: state.valueAxis.label ?? \"\",\n width: \"hug\",\n height: \"fill\",\n })) as unknown as Node2D\n : undefined\n\n const categoryAxis = showCategory\n ? (new CategoryAxis({\n categories,\n axis: categoryConfig,\n label: state.categoryAxis.label ?? \"\",\n orientation: horizontal ? \"vertical\" : \"horizontal\",\n dims: () => categoryDims(state),\n width: horizontal ? \"hug\" : \"fill\",\n height: horizontal ? \"fill\" : \"hug\",\n }) as unknown as Node2D)\n : undefined\n\n const left = horizontal ? categoryAxis : valueAxis\n const bottom = horizontal ? valueAxis : categoryAxis\n const leftConfig = horizontal ? categoryConfig : valueConfig\n const ghost = left && bottom\n ? columnGhost({\n captions: horizontal ? () => categories : valueCaptions,\n count: horizontal ? categories.length : barChartDomain(state).ticks.length,\n text: () => leftConfig().labelStyle,\n title: (horizontal ? state.categoryAxis.label : state.valueAxis.label) ?? \"\",\n titleText: () => leftConfig().titleStyle,\n tickPad: () => axisPads(leftConfig(), \"right\").tick,\n titlePad: () => axisPads(leftConfig(), \"right\").title,\n })\n : undefined\n\n const barSets = state.series.map(\n (s, i) =>\n new ChartBars({\n bars: () => seriesBars(state, i, plotSize()),\n baseline: () => valueToPx(domain(), runs(state, plotSize()).along, baselineValue(domain())),\n horizontal,\n fill: () => seriesFill(style(), s, i),\n cornerRadius: () => style().barRadius,\n growth: () => state.growth,\n dims: () => categoryDims(state),\n // A figure past a stack's end prints the stack's total; a percent stack has none worth printing, so prints its shares inside.\n values: () => (built.values === \"end\" && state.stack === \"percent\" ? \"inside\" : built.values),\n valueStyle: () => ({ ...valueText(style()), fontSize: Math.round(style().fontSize * 0.85) }),\n enabled: () => state.showing[i] ?? (s.enabled ?? true),\n }) as unknown as Node2D\n )\n\n const legendAt = built.legend\n const legend = legendAt !== \"none\"\n ? (new ChartLegend({\n series: state.series,\n swatches: () => state.series.map((s, i) => seriesFill(style(), s, i)),\n legend: () => legendConfigOf(style()),\n flow: legendAt === \"right\" ? \"vertical\" : \"horizontal\",\n }) as unknown as Node2D)\n : undefined\n\n const n = state.data.length\n // Category lines fall between the slots, never through a bar.\n const boundaries = () => Array.from({ length: Math.max(0, n - 1) }, (_, i) => i + 1)\n const slots = (): Range => [0, Math.max(1, n)]\n plot = new Rect({\n children: [\n new ChartCanvas({\n fill: () => style().background,\n xGridStroke: () => style().verticalGrid,\n yGridStroke: () => style().horizontalGrid,\n xMarkers: horizontal ? () => domain().ticks : boundaries,\n yMarkers: horizontal ? boundaries : () => domain().ticks,\n xExtent: horizontal ? () => domain().range : slots,\n yExtent: horizontal ? slots : () => domain().range,\n axisStroke: () => style().axisStroke,\n xAxisAt: () => (horizontal ? 0 : baselineValue(domain())),\n yAxisAt: () => (horizontal ? baselineValue(domain()) : 0),\n }),\n ...barSets,\n ],\n }) as unknown as Node2D\n\n return asParts([\n cartesianFrame({\n left,\n ghost,\n plot,\n bottom,\n legend,\n legendAt,\n gap: () => frameGap(style()),\n padding: () => ({\n top: headroom(style()),\n right: horizontal && bottom ? overhang(style()) : 0,\n left: horizontal && bottom && !left ? overhang(style()) : 0,\n bottom: 0,\n }),\n }),\n ])\n },\n commands: {\n /** Axes stagger in, bars rise from the baseline, the legend fades up last. `duration` is the whole entrance. */\n enter: {\n args: {},\n // Held from arrival, so it never shows finished ahead of its draw.\n entrance: true,\n easing: easeOut(),\n run: (timeline, state, children) => {\n const parts = partsOf(children)\n const duration = timeline.duration\n const axes = duration * ENTER_SHARE.axes\n const rise = duration * ENTER_SHARE.marks\n const { legend } = parts\n const at0 = (piece: Beat[\"piece\"]): Beat => ({ at: 0, duration: 0, piece })\n return beats(timeline, [\n at0(timeline.animate(() => ({ growth: 0 }))),\n ...(legend ? [at0(legend.to({ opacity: 0, ...legendAway(state.style.legend) }))] : []),\n ...(parts.valueAxis ? [{ at: 0, duration: axes, piece: parts.valueAxis.run(\"enter\", { slide: 24 }) }] : []),\n ...(parts.categoryAxis ? [{ at: 0, duration: axes, piece: parts.categoryAxis.run(\"enter\", { slide: 24 }) }] : []),\n // No priming to 0 first: the value at `t` is a function of `t`.\n { at: axes, duration: rise, piece: timeline.animate((t) => ({ growth: t })) },\n ...(legend ? [{ at: axes + rise, duration: duration * ENTER_SHARE.legend, piece: legend.to({ opacity: 1, x: 0, y: 0 }) }] : []),\n ])\n },\n },\n /** Bring series `index` back, the group reflowing to make room, with its legend entry. */\n showSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 1),\n },\n /** The mirror of `showSeries`: bars narrow away (stacked, sink out) while the rest widen into the space. */\n hideSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 0),\n },\n /** Fade every other series, bars and legend entry, to focus on `index`. Nothing moves, so the group does not reflow. */\n spotlightSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, _state, children) => {\n const parts = partsOf(children)\n const index = timeline.args.seriesIndex\n return timeline.together([\n ...parts.bars.map((bars, i) => bars.to({ opacity: i === index ? 1 : SPOTLIGHT_DIM })),\n ...(parts.legend ? [parts.legend.run(\"spotlightSeries\", { index })] : []),\n timeline.wait(timeline.duration),\n ])\n },\n },\n /**\n * Fade every other category's bars and caption to {@link SPOTLIGHT_DIM}. While\n * another is lit the focus moves directly. A missing category takes its slot\n * and changes nothing.\n */\n spotlightCategory: {\n args: { categoryIndex: Types.number(0, { min: 0, step: 1 }) },\n easing: easeOut(),\n run: (timeline, state) => {\n const index = timeline.args.categoryIndex\n if (index < 0 || index >= state.data.length) return timeline.wait(timeline.duration)\n const from = state.spotlightReveal\n return timeline.animate((t) => ({ spotlight: index, spotlightReveal: from + (1 - from) * t }))\n },\n },\n /** Every category back to full; the lit one is held until the fade lands. A no-op when nothing is lit, which still takes its slot. */\n clearCategory: {\n args: {},\n easing: easeOut(),\n run: (timeline, state) => {\n const from = state.spotlightReveal\n if (from === 0) return timeline.wait(timeline.duration)\n const lit = state.spotlight\n return timeline.animate((t) => (t >= 1 ? { spotlight: null, spotlightReveal: 0 } : { spotlight: lit, spotlightReveal: from * (1 - t) }))\n },\n },\n },\n})\n\nexport type BarChart = NodeOf<typeof BarChart>\n"]}
|
|
1
|
+
{"version":3,"file":"bar-chart.js","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,GAoBR,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACrH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAA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AI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;YAChG,CAAC;SACF;QACD,sIAAsI;QACtI,aAAa,EAAE;YACb,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,OAAO,EAAE;YACjB,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;gBACvB,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAA;gBAClC,IAAI,IAAI,KAAK,CAAC;oBAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;gBACvD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAA;gBAC3B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAC1I,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\n Rect,\n Types,\n clamp,\n component2d,\n easeOut,\n type ChildView,\n type DataRecord,\n type NodeOf,\n type OutOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D,\n type Node2DProps as _Node2DProps,\n type TextStyle as _TextStyle,\n type CornerRadiusResolved as _CornerRadiusResolved,\n type CornerStyleResolved as _CornerStyleResolved,\n type RectCornerRadius as _RectCornerRadius,\n type RectCornerStyle as _RectCornerStyle,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type Size2D,\n type StyleInput as _StyleInput,\n type StyleValues as _StyleValues,\n} from \"@motionscript/sdk\"\nimport { formatNumber } from \"@motionscript/sdk/component\"\n\nimport { cartesianFrame, chartViews, columnGhost, frameGap, headroom, laidOutSize, overhang } from \"../kit/cartesian\"\nimport { ChartCanvas } from \"../kit/chart-canvas\"\nimport { ChartLegend } from \"../kit/chart-legend\"\nimport { SERIES_ARG, asParts, fresh } from \"../kit/entries\"\nimport { HorizontalAxis } from \"../kit/horizontal-axis\"\nimport { DEFAULT_MARKERS, ENTER_SHARE, beats, legendAway, type AnyTimeline, type Beat } from \"../kit/motion\"\nimport {\n SPOTLIGHT_DIM,\n formatMarker,\n lerpAxisDomain,\n lerpAxisEntry,\n markerStep,\n markerValues,\n niceTicks,\n num,\n resolveAxisDomain,\n settleAxisDomain,\n type AxisDomainConfig,\n type Range,\n type ResolvedAxisDomain,\n} from \"../kit/shared\"\nimport {\n CARTESIAN_GRID,\n CARTESIAN_TEXT,\n CHART_LEGEND,\n CHART_SERIES,\n CHART_STYLE_FAMILY,\n CHART_STYLE_PRESETS,\n GRID_BACKGROUND,\n axisConfigOf,\n migrateChartStyle,\n legendConfigOf,\n seriesFill,\n valueText,\n} from \"../kit/style\"\nimport { VerticalAxis, axisPads } from \"../kit/vertical-axis\"\nimport { CategoryAxis, slotCentre } from \"./category-axis\"\nimport { ChartBars, type BarGeometry } from \"./chart-bars\"\nimport {\n BAR_LABELS,\n BAR_MARKS,\n barCategories,\n barSpans,\n resolveBarScale,\n type BarOrientation,\n type BarSeries,\n type BarStack,\n} from \"./shared\"\n\nconst BAR_STYLE = Types.style(\n CHART_STYLE_FAMILY,\n { series: CHART_SERIES, background: GRID_BACKGROUND, text: CARTESIAN_TEXT, grid: CARTESIAN_GRID, marks: BAR_MARKS, labels: BAR_LABELS, legend: CHART_LEGEND },\n { presets: CHART_STYLE_PRESETS }\n)\n\n/** A bar chart's resolved style. */\nexport type BarChartStyle = OutOf<typeof BAR_STYLE>\n\n/** What a bar chart plots, as its entries hold it. */\nexport interface BarChartValues {\n readonly data: DataRecord[]\n readonly series: BarSeries[]\n readonly stack: BarStack\n readonly valueAxis: AxisDomainConfig\n}\n\n/** The value axis's domain with its range and ticks resolved. */\nexport type BarChartDomain = ResolvedAxisDomain\n\ninterface BarState extends BarChartValues {\n readonly categoryField: string\n readonly orientation: BarOrientation\n readonly style: BarChartStyle\n readonly weights: number[]\n readonly showing: boolean[]\n readonly spotlight: number | null\n readonly spotlightReveal: number\n}\n\nfunction drawnValue(s: BarChartValues, domain: AxisDomainConfig): AxisDomainConfig {\n const divisions = (domain.ticks?.length ?? DEFAULT_MARKERS) - 1\n const range = resolveBarScale(s.data, s.series, s.stack, domain.range, divisions)\n const even = domain.range !== undefined || s.stack === \"percent\"\n return { ...domain, range, ticks: domain.ticks ?? (even ? markerValues(range, DEFAULT_MARKERS - 1) : niceTicks(range, DEFAULT_MARKERS - 1)) }\n}\n\n/** The last domain worked out from each data array, and what it was read from. */\nconst domainsDrawn = new WeakMap<DataRecord[], { readonly key: readonly unknown[]; readonly domain: BarChartDomain }>()\n\n/** The value axis as drawn now. A series being hidden keeps its room, so the ticks hold still while it goes. */\nexport function barChartDomain(s: BarChartValues): BarChartDomain {\n const key = [s.series, s.stack, s.valueAxis]\n const kept = domainsDrawn.get(s.data)\n if (kept && kept.key.every((value, i) => value === key[i])) return kept.domain\n const domain = settleAxisDomain(s.valueAxis, (d) => drawnValue(s, d)) as BarChartDomain\n domainsDrawn.set(s.data, { key, domain })\n return domain\n}\n\n/** Ticks and the figures printed by bars both read through here, so they cannot disagree about how a number looks. */\nfunction valueLabel(s: BarChartValues, domain: BarChartDomain, value: number): string {\n const pattern = s.valueAxis.format\n if (pattern !== undefined) return formatNumber(value, pattern)\n const text = formatMarker(value, markerStep(domain.ticks))\n return s.stack === \"percent\" ? `${text}%` : text\n}\n\n/** A value along the value axis, a run of `length` px centred on 0. */\nfunction valueToPx(domain: BarChartDomain, length: number, value: number): number {\n const [min, max] = domain.range\n if (max === min) return -length / 2\n return ((value - min) / (max - min) - 0.5) * length\n}\n\n/** Where bars grow from: zero held on the scale, so a cropped axis grows them from the plot's edge. */\nfunction baselineValue(domain: BarChartDomain): number {\n const [lo, hi] = domain.range\n return clamp(0, Math.min(lo, hi), Math.max(lo, hi))\n}\n\nfunction weightAt(s: { readonly weights: readonly number[] }, index: number): number {\n return Math.max(0, s.weights[index] ?? 1)\n}\n\n/** The plot's run along the value axis and across the categories. */\nfunction runs(s: BarState, plot: Size2D): { along: number; across: number } {\n return s.orientation === \"horizontal\" ? { along: plot.width, across: plot.height } : { along: plot.height, across: plot.width }\n}\n\n/** Category `row`'s slot centre across the plot: left to right, or top to bottom. */\nfunction slotAt(s: BarState, row: number, across: number): number {\n const centre = slotCentre(row, s.data.length, across)\n return s.orientation === \"horizontal\" ? -centre : centre\n}\n\n/**\n * Series `index`'s bars in centred pixel space. Side by side, a series divides\n * the slot with its siblings by live weight; stacked, it takes the whole slot\n * and its weight scales its length, so hiding a series reflows rather than\n * punching a hole.\n */\nfunction seriesBars(s: BarState, index: number, plot: Size2D): BarGeometry[] {\n const series = s.series[index]\n if (!series) return []\n const domain = barChartDomain(s)\n const { along, across } = runs(s, plot)\n const n = s.data.length\n const slot = n > 0 ? across / n : 0\n const inner = slot * clamp(s.style.barWidth, 0, 1)\n const stacked = s.stack !== \"none\"\n let total = 0\n for (let i = 0; i < s.series.length; i++) total += weightAt(s, i)\n const unit = inner / (total > 0 ? total : 1)\n const weight = weightAt(s, index)\n let before = 0\n for (let i = 0; i < index; i++) before += weightAt(s, i)\n const gap = s.series.length > 1 ? s.style.barGap : 0\n const values = s.style.values\n\n return s.data.map((row, rowIndex) => {\n // Built from live contributions, so a fading series lowers the segments beyond it.\n const spans = barSpans(row, s.series, s.stack, s.weights)\n const span = spans[index] ?? { from: 0, to: 0, value: 0, outer: false }\n const centre = slotAt(s, rowIndex, across)\n const offset = -inner / 2 + unit * before + (unit * weight) / 2\n let caption = \"\"\n if (values !== \"none\" && span.value !== 0) {\n if (!stacked || values === \"inside\" || s.stack === \"percent\") caption = valueLabel(s, domain, stacked ? span.value : num(row, series.field))\n else if (span.outer) caption = valueLabel(s, domain, span.to)\n }\n return {\n center: stacked ? centre : centre + (s.orientation === \"horizontal\" ? -offset : offset),\n thickness: stacked ? inner : Math.max(0, unit * weight - gap),\n from: valueToPx(domain, along, span.from),\n to: valueToPx(domain, along, span.to),\n round: span.outer,\n grounded: !stacked || span.from === 0,\n caption,\n }\n })\n}\n\n/** Per-row opacity: 1 while nothing is spotlit, falling to {@link SPOTLIGHT_DIM} for all but the chosen category. */\nfunction categoryDims(s: BarState): number[] {\n const focus = clamp(s.spotlightReveal, 0, 1)\n const chosen = s.spotlight\n return s.data.map((_, i) => (focus <= 0 || chosen === i ? 1 : 1 - (1 - SPOTLIGHT_DIM) * focus))\n}\n\n/** The parts a bar chart's commands drive, found through its children. */\nfunction partsOf(children: readonly ChildView[]) {\n const views = chartViews(children)\n return {\n valueAxis: views.find((view) => VerticalAxis.is(view) || HorizontalAxis.is(view)) ?? null,\n categoryAxis: views.find(CategoryAxis.is) ?? null,\n bars: views.filter(ChartBars.is),\n legend: views.find(ChartLegend.is) ?? null,\n }\n}\n\n/**\n * Move series `index`'s share to `target` with its legend entry. Its bars stay\n * drawn for every frame the move covers and switch off only once a hide has\n * landed, so arriving at a time backwards matches arriving forwards.\n */\nfunction toggling(timeline: AnyTimeline, state: BarState, children: readonly ChildView[], index: number, target: number) {\n const parts = partsOf(children)\n if (!parts.bars[index]) return timeline.wait(timeline.duration)\n const from = state.series.map((_, i) => weightAt(state, i))\n const start = from[index] ?? 1\n const showing = state.series.map((s, i) => state.showing[i] ?? (s.enabled ?? true))\n return timeline.together([\n timeline.animate((t) => {\n const weights = [...from]\n weights[index] = start + (target - start) * timeline.ease(t)\n const shown = [...showing]\n shown[index] = target > 0 || t < 1\n return { weights, showing: shown }\n }, { eased: false }),\n ...(parts.legend ? [parts.legend.run(target > 0 ? \"showSeries\" : \"hideSeries\", { index })] : []),\n ])\n}\n\n/**\n * A bar chart, vertical or horizontal, its series side by side, stacked, or\n * stacked as shares of 100. Built like the line chart from `ChartCanvas`, a\n * value axis, a {@link CategoryAxis}, one {@link ChartBars} per series and\n * `ChartLegend`. Zero is always on the scale and bars grow about it, so a\n * negative value draws the other way from the same `growth` signal.\n *\n * Resting state is the finished chart; `enter` arms every part on its first\n * frame. A `to` of the value axis's `range` or `ticks` tweens from the domain as\n * drawn, so an auto axis rescales the bars continuously.\n */\nexport const BarChart = component2d({\n key: \"barChart\",\n state: {\n data: fresh<DataRecord[]>(() => [], { kind: \"dataset\" }),\n // Names a column, not a value, like the line chart's `xField`.\n categoryField: \"\",\n series: fresh<BarSeries[]>(() => [], { kind: \"series\" }),\n /** `vertical`: columns rise from a row of categories; `horizontal`: bars grow right from a column of them. */\n orientation: Types.oneOf([\"vertical\", \"horizontal\"] as const, { animatable: false }),\n /** `stacked`: each series sits on the sum of those before it; `percent`: every category reads as shares of 100. */\n stack: Types.oneOf([\"none\", \"stacked\", \"percent\"] as const),\n valueAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisEntry }),\n categoryAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisDomain }),\n style: BAR_STYLE,\n /** Rise of every bar about the baseline, `[0, 1]`: 0 collapses them onto it. */\n growth: 1,\n /** The category spotlit, or `null`. The choice snaps; `spotlightReveal` animates it. */\n spotlight: Types.custom<number | null>(null),\n spotlightReveal: 0,\n /** Each series' share of the slot, seeded from `enabled`: a weight rather than a switch, so hiding one widens the others. */\n weights: Types.custom<number[]>([], { private: true }),\n /** Whether each series' bars are drawn: on for every frame a show or hide covers, off once a hide lands. */\n showing: Types.custom<boolean[]>([], { private: true }),\n },\n defaults: {\n // A node made of parts that fill would otherwise hug them.\n width: \"fill\",\n height: \"fill\",\n weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),\n showing: (state) => state.series.map((s) => s.enabled ?? true),\n },\n migrate: { style: migrateChartStyle(\"cartesian\") },\n allowedChildren: [],\n children: (state) => {\n const style = () => state.style\n const domain = () => barChartDomain(state)\n let plot: Node2D | undefined\n const plotSize = () => laidOutSize(plot)\n const built = state.style\n const horizontal = state.orientation === \"horizontal\"\n const categories = barCategories(state.data, state.categoryField)\n const valueConfig = () => axisConfigOf(style(), horizontal ? \"x\" : \"y\")\n const categoryConfig = () => axisConfigOf(style(), horizontal ? \"y\" : \"x\")\n const valueCaptions = () => {\n const d = domain()\n return d.ticks.map((value) => valueLabel(state, d, value))\n }\n const showValue = horizontal ? built.showXAxis : built.showYAxis\n const showCategory = horizontal ? built.showYAxis : built.showXAxis\n\n const valueAxis = showValue\n ? (horizontal\n ? new HorizontalAxis({\n range: () => domain().range,\n markers: () => domain().ticks,\n captions: valueCaptions,\n axis: valueConfig,\n label: state.valueAxis.label ?? \"\",\n overhang: () => ({ left: overhang(style()), right: overhang(style()) }),\n width: \"fill\",\n height: \"hug\",\n })\n : new VerticalAxis({\n range: () => domain().range,\n markers: () => domain().ticks,\n captions: valueCaptions,\n axis: valueConfig,\n label: state.valueAxis.label ?? \"\",\n width: \"hug\",\n height: \"fill\",\n })) as unknown as Node2D\n : undefined\n\n const categoryAxis = showCategory\n ? (new CategoryAxis({\n categories,\n axis: categoryConfig,\n label: state.categoryAxis.label ?? \"\",\n orientation: horizontal ? \"vertical\" : \"horizontal\",\n dims: () => categoryDims(state),\n width: horizontal ? \"hug\" : \"fill\",\n height: horizontal ? \"fill\" : \"hug\",\n }) as unknown as Node2D)\n : undefined\n\n const left = horizontal ? categoryAxis : valueAxis\n const bottom = horizontal ? valueAxis : categoryAxis\n const leftConfig = horizontal ? categoryConfig : valueConfig\n const ghost = left && bottom\n ? columnGhost({\n captions: horizontal ? () => categories : valueCaptions,\n count: horizontal ? categories.length : barChartDomain(state).ticks.length,\n text: () => leftConfig().labelStyle,\n title: (horizontal ? state.categoryAxis.label : state.valueAxis.label) ?? \"\",\n titleText: () => leftConfig().titleStyle,\n tickPad: () => axisPads(leftConfig(), \"right\").tick,\n titlePad: () => axisPads(leftConfig(), \"right\").title,\n })\n : undefined\n\n const barSets = state.series.map(\n (s, i) =>\n new ChartBars({\n bars: () => seriesBars(state, i, plotSize()),\n baseline: () => valueToPx(domain(), runs(state, plotSize()).along, baselineValue(domain())),\n horizontal,\n fill: () => seriesFill(style(), s, i),\n cornerRadius: () => style().barCornerRadius,\n cornerStyle: () => style().barCornerStyle,\n growth: () => state.growth,\n dims: () => categoryDims(state),\n // A figure past a stack's end prints the stack's total; a percent stack has none worth printing, so prints its shares inside.\n values: () => (built.values === \"end\" && state.stack === \"percent\" ? \"inside\" : built.values),\n valueStyle: () => valueText(style()),\n enabled: () => state.showing[i] ?? (s.enabled ?? true),\n }) as unknown as Node2D\n )\n\n const legendAt = built.legend\n const legend = legendAt !== \"none\"\n ? (new ChartLegend({\n series: state.series,\n swatches: () => state.series.map((s, i) => seriesFill(style(), s, i)),\n legend: () => legendConfigOf(style()),\n flow: legendAt === \"right\" ? \"vertical\" : \"horizontal\",\n }) as unknown as Node2D)\n : undefined\n\n const n = state.data.length\n // Category lines fall between the slots, never through a bar.\n const boundaries = () => Array.from({ length: Math.max(0, n - 1) }, (_, i) => i + 1)\n const slots = (): Range => [0, Math.max(1, n)]\n plot = new Rect({\n children: [\n new ChartCanvas({\n fill: () => style().gridBackground,\n xGridStroke: () => style().verticalGrid,\n yGridStroke: () => style().horizontalGrid,\n xMarkers: horizontal ? () => domain().ticks : boundaries,\n yMarkers: horizontal ? boundaries : () => domain().ticks,\n xExtent: horizontal ? () => domain().range : slots,\n yExtent: horizontal ? slots : () => domain().range,\n axisStroke: () => style().axisStroke,\n xAxisAt: () => (horizontal ? 0 : baselineValue(domain())),\n yAxisAt: () => (horizontal ? baselineValue(domain()) : 0),\n }),\n ...barSets,\n ],\n }) as unknown as Node2D\n\n return asParts([\n cartesianFrame({\n background: () => style().background,\n left,\n ghost,\n plot,\n bottom,\n legend,\n legendAt,\n gap: () => frameGap(style()),\n padding: () => ({\n top: headroom(style()),\n right: horizontal && bottom ? overhang(style()) : 0,\n left: horizontal && bottom && !left ? overhang(style()) : 0,\n bottom: 0,\n }),\n }),\n ])\n },\n commands: {\n /** Axes stagger in, bars rise from the baseline, the legend fades up last. `duration` is the whole entrance. */\n enter: {\n args: {},\n // Held from arrival, so it never shows finished ahead of its draw.\n entrance: true,\n easing: easeOut(),\n run: (timeline, state, children) => {\n const parts = partsOf(children)\n const duration = timeline.duration\n const axes = duration * ENTER_SHARE.axes\n const rise = duration * ENTER_SHARE.marks\n const { legend } = parts\n const at0 = (piece: Beat[\"piece\"]): Beat => ({ at: 0, duration: 0, piece })\n return beats(timeline, [\n at0(timeline.animate(() => ({ growth: 0 }))),\n ...(legend ? [at0(legend.to({ opacity: 0, ...legendAway(state.style.legend) }))] : []),\n ...(parts.valueAxis ? [{ at: 0, duration: axes, piece: parts.valueAxis.run(\"enter\", { slide: 24 }) }] : []),\n ...(parts.categoryAxis ? [{ at: 0, duration: axes, piece: parts.categoryAxis.run(\"enter\", { slide: 24 }) }] : []),\n // No priming to 0 first: the value at `t` is a function of `t`.\n { at: axes, duration: rise, piece: timeline.animate((t) => ({ growth: t })) },\n ...(legend ? [{ at: axes + rise, duration: duration * ENTER_SHARE.legend, piece: legend.to({ opacity: 1, x: 0, y: 0 }) }] : []),\n ])\n },\n },\n /** Bring series `index` back, the group reflowing to make room, with its legend entry. */\n showSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 1),\n },\n /** The mirror of `showSeries`: bars narrow away (stacked, sink out) while the rest widen into the space. */\n hideSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 0),\n },\n /** Fade every other series, bars and legend entry, to focus on `index`. Nothing moves, so the group does not reflow. */\n spotlightSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, _state, children) => {\n const parts = partsOf(children)\n const index = timeline.args.seriesIndex\n return timeline.together([\n ...parts.bars.map((bars, i) => bars.to({ opacity: i === index ? 1 : SPOTLIGHT_DIM })),\n ...(parts.legend ? [parts.legend.run(\"spotlightSeries\", { index })] : []),\n timeline.wait(timeline.duration),\n ])\n },\n },\n /**\n * Fade every other category's bars and caption to {@link SPOTLIGHT_DIM}. While\n * another is lit the focus moves directly. A missing category takes its slot\n * and changes nothing.\n */\n spotlightCategory: {\n args: { categoryIndex: Types.number(0, { min: 0, step: 1 }) },\n easing: easeOut(),\n run: (timeline, state) => {\n const index = timeline.args.categoryIndex\n if (index < 0 || index >= state.data.length) return timeline.wait(timeline.duration)\n const from = state.spotlightReveal\n return timeline.animate((t) => ({ spotlight: index, spotlightReveal: from + (1 - from) * t }))\n },\n },\n /** Every category back to full; the lit one is held until the fade lands. A no-op when nothing is lit, which still takes its slot. */\n clearCategory: {\n args: {},\n easing: easeOut(),\n run: (timeline, state) => {\n const from = state.spotlightReveal\n if (from === 0) return timeline.wait(timeline.duration)\n const lit = state.spotlight\n return timeline.animate((t) => (t >= 1 ? { spotlight: null, spotlightReveal: 0 } : { spotlight: lit, spotlightReveal: from * (1 - t) }))\n },\n },\n },\n})\n\nexport type BarChart = NodeOf<typeof BarChart>\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Fill, type FillResolved, type NodeOf, type Node2D, type Node2DProps as _Node2DProps, type TextStyle } from "@motionscript/sdk";
|
|
1
|
+
import { type Fill, type FillResolved, type NodeOf, type Node2D, type Node2DProps as _Node2DProps, type RectCornerRadius as _RectCornerRadius, type RectCornerStyle as _RectCornerStyle, type TextStyle, type CornerRadiusResolved, type CornerStyleResolved } from "@motionscript/sdk";
|
|
2
2
|
/**
|
|
3
3
|
* One drawn bar in the plot's centred pixel space (origin at the centre, y-up),
|
|
4
4
|
* mapped by the parent {@link BarChart}: `center` and `thickness` across the
|
|
@@ -13,8 +13,10 @@ export interface BarGeometry {
|
|
|
13
13
|
from: number;
|
|
14
14
|
/** The far end at full growth. */
|
|
15
15
|
to: number;
|
|
16
|
-
/** Whether the far end takes the
|
|
16
|
+
/** Whether the far end takes the far corners (the stack's last segment on its side). */
|
|
17
17
|
round: boolean;
|
|
18
|
+
/** Whether the base takes the base corners (it stands on the baseline: every grouped bar, a stack's first segment). */
|
|
19
|
+
grounded?: boolean;
|
|
18
20
|
/** The figure printed by the bar; empty for none. */
|
|
19
21
|
caption: string;
|
|
20
22
|
}
|
|
@@ -31,7 +33,9 @@ export declare const ChartBars: import("@motionscript/sdk").Component<"chartBars
|
|
|
31
33
|
/** Bars grow along x from a category column rather than along y from a row. */
|
|
32
34
|
readonly horizontal: false;
|
|
33
35
|
readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
|
|
34
|
-
|
|
36
|
+
/** As for a bar standing up from the baseline: `topLeft`/`topRight` round its far end, the bottom pair its base. */
|
|
37
|
+
readonly cornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, CornerRadiusResolved, false>;
|
|
38
|
+
readonly cornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, CornerStyleResolved, false>;
|
|
35
39
|
/**
|
|
36
40
|
* Rise of every bar in `[0, 1]` about the baseline, not each bar's own base:
|
|
37
41
|
* every segment travels by the same factor, so a stack stays flush
|
|
@@ -54,7 +58,9 @@ export declare const ChartBars: import("@motionscript/sdk").Component<"chartBars
|
|
|
54
58
|
/** Bars grow along x from a category column rather than along y from a row. */
|
|
55
59
|
readonly horizontal: false;
|
|
56
60
|
readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
|
|
57
|
-
|
|
61
|
+
/** As for a bar standing up from the baseline: `topLeft`/`topRight` round its far end, the bottom pair its base. */
|
|
62
|
+
readonly cornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, CornerRadiusResolved, false>;
|
|
63
|
+
readonly cornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, CornerStyleResolved, false>;
|
|
58
64
|
/**
|
|
59
65
|
* Rise of every bar in `[0, 1]` about the baseline, not each bar's own base:
|
|
60
66
|
* every segment travels by the same factor, so a stack stays flush
|
|
@@ -75,7 +81,9 @@ export declare const ChartBars: import("@motionscript/sdk").Component<"chartBars
|
|
|
75
81
|
/** Bars grow along x from a category column rather than along y from a row. */
|
|
76
82
|
readonly horizontal: false;
|
|
77
83
|
readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
|
|
78
|
-
|
|
84
|
+
/** As for a bar standing up from the baseline: `topLeft`/`topRight` round its far end, the bottom pair its base. */
|
|
85
|
+
readonly cornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, CornerRadiusResolved, false>;
|
|
86
|
+
readonly cornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, CornerStyleResolved, false>;
|
|
79
87
|
/**
|
|
80
88
|
* Rise of every bar in `[0, 1]` about the baseline, not each bar's own base:
|
|
81
89
|
* every segment travels by the same factor, so a stack stays flush
|
|
@@ -93,6 +101,22 @@ export declare const ChartBars: import("@motionscript/sdk").Component<"chartBars
|
|
|
93
101
|
readonly enter: unknown;
|
|
94
102
|
}, Node2D<_Node2DProps>>>>;
|
|
95
103
|
export type ChartBars = NodeOf<typeof ChartBars>;
|
|
104
|
+
type Corners<T> = {
|
|
105
|
+
topLeft: T;
|
|
106
|
+
topRight: T;
|
|
107
|
+
bottomRight: T;
|
|
108
|
+
bottomLeft: T;
|
|
109
|
+
};
|
|
110
|
+
/** Bar `bar`'s rect corners: the far pair only where its stack ends, the base pair only on the baseline, each held inside the bar. */
|
|
111
|
+
export declare function barCorners(state: {
|
|
112
|
+
readonly cornerRadius: CornerRadiusResolved;
|
|
113
|
+
readonly cornerStyle: CornerStyleResolved;
|
|
114
|
+
readonly horizontal: boolean;
|
|
115
|
+
}, bar: BarGeometry, forward: boolean, length: number): {
|
|
116
|
+
cornerRadius: Corners<number>;
|
|
117
|
+
cornerStyle: CornerStyleResolved;
|
|
118
|
+
};
|
|
96
119
|
/** A figure as the bar prints it when the chart gives no caption. */
|
|
97
120
|
export declare function barCaption(value: number): string;
|
|
121
|
+
export {};
|
|
98
122
|
//# sourceMappingURL=chart-bars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-bars.d.ts","sourceRoot":"","sources":["../../src/bar-chart/chart-bars.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"chart-bars.d.ts","sourceRoot":"","sources":["../../src/bar-chart/chart-bars.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,gBAAgB,IAAI,iBAAiB,EAC1C,KAAK,eAAe,IAAI,gBAAgB,EACxC,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAA;AAS1B;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,wFAAwF;IACxF,KAAK,EAAE,OAAO,CAAA;IACd,uHAAuH;IACvH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAA;CAChB;AAoDD;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;IAIlB,kFAAkF;;IAElF,+EAA+E;;;IAG/E,oHAAoH;;;IAGpH;;;;OAIG;;IAEH,oGAAoG;;IAEpG,oEAAoE;;;IAGpE,mGAAmG;;;;;;IAnBnG,kFAAkF;;IAElF,+EAA+E;;;IAG/E,oHAAoH;;;IAGpH;;;;OAIG;;IAEH,oGAAoG;;IAEpG,oEAAoE;;;IAGpE,mGAAmG;;;;IAnBnG,kFAAkF;;IAElF,+EAA+E;;;IAG/E,oHAAoH;;;IAGpH;;;;OAIG;;IAEH,oGAAoG;;IAEpG,oEAAoE;;;IAGpE,mGAAmG;;;;0BA0DrG,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA;AAEhD,KAAK,OAAO,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,QAAQ,EAAE,CAAC,CAAC;IAAC,WAAW,EAAE,CAAC,CAAC;IAAC,UAAU,EAAE,CAAC,CAAA;CAAE,CAAA;AAc5E,sIAAsI;AACtI,wBAAgB,UAAU,CACxB,KAAK,EAAE;IAAE,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAAE,EAC/H,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACb;IAAE,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAarE;AAED,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -58,7 +58,9 @@ export const ChartBars = component2d({
|
|
|
58
58
|
/** Bars grow along x from a category column rather than along y from a row. */
|
|
59
59
|
horizontal: false,
|
|
60
60
|
fill: Types.custom([], { resolve: fillOps.resolve, lerp: fillOps.lerp }),
|
|
61
|
-
|
|
61
|
+
/** As for a bar standing up from the baseline: `topLeft`/`topRight` round its far end, the bottom pair its base. */
|
|
62
|
+
cornerRadius: Types.cornerRadius(8),
|
|
63
|
+
cornerStyle: Types.cornerStyle("rounded"),
|
|
62
64
|
/**
|
|
63
65
|
* Rise of every bar in `[0, 1]` about the baseline, not each bar's own base:
|
|
64
66
|
* every segment travels by the same factor, so a stack stays flush
|
|
@@ -119,17 +121,13 @@ export const ChartBars = component2d({
|
|
|
119
121
|
const length = Math.abs(ends.end - ends.base) + seam;
|
|
120
122
|
if (length <= seam)
|
|
121
123
|
continue;
|
|
122
|
-
const radius = bar.round ? Math.max(0, Math.min(state.cornerRadius, length, bar.thickness / 2)) : 0;
|
|
123
124
|
const forward = ends.end >= ends.base;
|
|
124
125
|
const mid = (ends.base + ends.end) / 2 + (forward ? seam : -seam) / 2;
|
|
125
|
-
|
|
126
|
-
const far = state.horizontal
|
|
127
|
-
? (forward ? { topRight: radius, bottomRight: radius, topLeft: 0, bottomLeft: 0 } : { topLeft: radius, bottomLeft: radius, topRight: 0, bottomRight: 0 })
|
|
128
|
-
: (forward ? { topLeft: radius, topRight: radius, bottomLeft: 0, bottomRight: 0 } : { bottomLeft: radius, bottomRight: radius, topLeft: 0, topRight: 0 });
|
|
126
|
+
const corners = barCorners(state, bar, forward, length);
|
|
129
127
|
// One `Graphics2D` per bar: opacity belongs to the command list, and the spotlight dims single bars.
|
|
130
128
|
const g = new Graphics2D().rect(state.horizontal
|
|
131
|
-
? { x: mid, y: bar.center, width: length, height: bar.thickness,
|
|
132
|
-
: { x: bar.center, y: mid, width: bar.thickness, height: length,
|
|
129
|
+
? { x: mid, y: bar.center, width: length, height: bar.thickness, ...corners }
|
|
130
|
+
: { x: bar.center, y: mid, width: bar.thickness, height: length, ...corners });
|
|
133
131
|
g.fill(state.fill);
|
|
134
132
|
ctx.draw(g.opacity(dimAt(state, i)));
|
|
135
133
|
}
|
|
@@ -137,6 +135,33 @@ export const ChartBars = component2d({
|
|
|
137
135
|
ctx.children();
|
|
138
136
|
},
|
|
139
137
|
});
|
|
138
|
+
/**
|
|
139
|
+
* Turns corners written for a bar standing up into the drawn bar's visual
|
|
140
|
+
* (y-up) corners: mirrored for a bar below zero, turned a quarter clockwise
|
|
141
|
+
* for one growing right, and both for one growing left.
|
|
142
|
+
*/
|
|
143
|
+
function orient(c, horizontal, forward) {
|
|
144
|
+
if (!horizontal)
|
|
145
|
+
return forward ? c : { topLeft: c.bottomLeft, topRight: c.bottomRight, bottomRight: c.topRight, bottomLeft: c.topLeft };
|
|
146
|
+
return forward
|
|
147
|
+
? { topLeft: c.bottomLeft, topRight: c.topLeft, bottomRight: c.topRight, bottomLeft: c.bottomRight }
|
|
148
|
+
: { topLeft: c.topLeft, topRight: c.bottomLeft, bottomRight: c.bottomRight, bottomLeft: c.topRight };
|
|
149
|
+
}
|
|
150
|
+
/** Bar `bar`'s rect corners: the far pair only where its stack ends, the base pair only on the baseline, each held inside the bar. */
|
|
151
|
+
export function barCorners(state, bar, forward, length) {
|
|
152
|
+
const grounded = bar.grounded ?? true;
|
|
153
|
+
const r = state.cornerRadius;
|
|
154
|
+
const ends = (bar.round ? 1 : 0) + (grounded ? 1 : 0);
|
|
155
|
+
const cap = Math.max(0, Math.min(bar.thickness / 2, ends > 1 ? length / 2 : length));
|
|
156
|
+
const fit = (v, on) => (on ? Math.max(0, Math.min(v, cap)) : 0);
|
|
157
|
+
const upright = {
|
|
158
|
+
topLeft: fit(r.topLeft, bar.round),
|
|
159
|
+
topRight: fit(r.topRight, bar.round),
|
|
160
|
+
bottomRight: fit(r.bottomRight, grounded),
|
|
161
|
+
bottomLeft: fit(r.bottomLeft, grounded),
|
|
162
|
+
};
|
|
163
|
+
return { cornerRadius: orient(upright, state.horizontal, forward), cornerStyle: orient(state.cornerStyle, state.horizontal, forward) };
|
|
164
|
+
}
|
|
140
165
|
/** A figure as the bar prints it when the chart gives no caption. */
|
|
141
166
|
export function barCaption(value) {
|
|
142
167
|
return value === 0 ? "" : formatMarker(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-bars.js","sourceRoot":"","sources":["../../src/bar-chart/chart-bars.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX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AE,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;oBAC9C,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;oBACrG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;gBACxG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBAClB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;YACtC,CAAC;QACH,CAAC;QACD,GAAG,CAAC,QAAQ,EAAE,CAAA;IAChB,CAAC;CACF,CAAC,CAAA;AAIF,qEAAqE;AACrE,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["import {\n Graphics2D,\n Text,\n Types,\n clamp,\n component2d,\n fillOps,\n type Fill,\n type FillResolved,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D,\n type Node2DProps as _Node2DProps,\n type TextStyle,\n} from \"@motionscript/sdk\"\n\nimport { boundText } from \"../kit/cartesian\"\nimport { asParts, fresh } from \"../kit/entries\"\nimport { frameEase } from \"../kit/motion\"\nimport { loadPaints } from \"../kit/paints\"\nimport { formatMarker } from \"../kit/shared\"\nimport { inkOn } from \"./shared\"\n\n/**\n * One drawn bar in the plot's centred pixel space (origin at the centre, y-up),\n * mapped by the parent {@link BarChart}: `center` and `thickness` across the\n * category slot, `from` and `to` along the value axis (y for a column, x for a\n * horizontal bar). Two ends rather than a base and a length, like `BarSpan`:\n * one shape fits grouped, stacked and negative.\n */\nexport interface BarGeometry {\n center: number\n thickness: number\n /** The base: the baseline when grouped, the running stack end when stacked. */\n from: number\n /** The far end at full growth. */\n to: number\n /** Whether the far end takes the corner radius (the stack's last segment on its side). */\n round: boolean\n /** The figure printed by the bar; empty for none. */\n caption: string\n}\n\n/** A figure inside a bar needs this much room around it, in multiples of the type size. */\nconst INSIDE_ROOM = 0.6\n\ninterface Bars {\n readonly bars: readonly BarGeometry[]\n readonly baseline: number\n readonly horizontal: boolean\n readonly growth: number\n readonly dims: readonly number[]\n readonly enabled: boolean\n readonly values: \"none\" | \"end\" | \"inside\"\n readonly valueStyle: TextStyle\n}\n\n/** Bar `i`'s dimming: the category spotlight, then the series switch. */\nfunction dimAt(s: Bars, index: number): number {\n if (!s.enabled) return 0\n return clamp(s.dims[index] ?? 1, 0, 1)\n}\n\n/** Bar `i`'s two ends as grown so far, along the value axis. */\nfunction endsAt(s: Bars, index: number): { base: number; end: number } | null {\n const bar = s.bars[index]\n if (!bar) return null\n const g = clamp(s.growth, 0, 1)\n return { base: s.baseline + (bar.from - s.baseline) * g, end: s.baseline + (bar.to - s.baseline) * g }\n}\n\nfunction sizeOf(style: TextStyle): number {\n return typeof style.fontSize === \"number\" ? style.fontSize : 24\n}\n\n/** Where bar `i`'s figure sits along the value axis: past its end, or in its middle. */\nfunction captionAlong(s: Bars, index: number, extent: number): number {\n const ends = endsAt(s, index)\n if (!ends) return 0\n if (s.values === \"inside\") return (ends.base + ends.end) / 2\n const direction = ends.end >= ends.base ? 1 : -1\n return ends.end + direction * (sizeOf(s.valueStyle) * 0.4 + extent / 2)\n}\n\n/** Whether bar `i` has room for a figure `extent` long inside it. */\nfunction fitsInside(s: Bars, index: number, extent: number, across: number): boolean {\n const bar = s.bars[index]\n const ends = endsAt(s, index)\n if (!bar || !ends) return false\n const room = sizeOf(s.valueStyle) * INSIDE_ROOM\n return Math.abs(ends.end - ends.base) >= extent + room && bar.thickness >= across\n}\n\n/**\n * One series of a {@link BarChart}: its bar in every category plus the printed\n * figures. A node per series, like `ChartLine`, so `showSeries` and\n * `spotlightSeries` mean the same on both: enable the node or tween its opacity.\n * Positions come from the parent, which owns the slot arithmetic.\n */\nexport const ChartBars = component2d({\n key: \"chartBars\",\n state: {\n bars: fresh<BarGeometry[]>(() => []),\n /** Pixel position of value 0 along the value axis, where every bar grows from. */\n baseline: 0,\n /** Bars grow along x from a category column rather than along y from a row. */\n horizontal: false,\n fill: Types.custom<Fill, FillResolved[]>([], { resolve: fillOps.resolve, lerp: fillOps.lerp }),\n cornerRadius: 8,\n /**\n * Rise of every bar in `[0, 1]` about the baseline, not each bar's own base:\n * every segment travels by the same factor, so a stack stays flush\n * mid-animation and a negative bar grows the other way.\n */\n growth: 1,\n /** Per-bar opacity by row index, how the category spotlight reaches one bar. Missing reads as 1. */\n dims: fresh<number[]>(() => []),\n /** Read as built: whether each bar prints its figure, and where. */\n values: Types.custom<\"none\" | \"end\" | \"inside\">(\"none\"),\n valueStyle: Types.custom<TextStyle>({ fontSize: 24, fill: \"white\" }),\n /** The wholesale switch behind `showSeries`/`hideSeries`; off skips the bars and their figures. */\n enabled: true,\n },\n // A node made of its figures would otherwise hug them.\n defaults: { width: \"fill\", height: \"fill\" },\n // One figure per bar, built once (the row count is fixed at construction)\n // and bound to the live geometry so it travels with its bar.\n children: (state) => {\n if (state.values === \"none\") return []\n return asParts(state.bars.map((_, i) => {\n const caption: Node2D = new Text({\n ...boundText(() => ({ ...state.valueStyle, ...(state.values === \"inside\" && { fill: inkOn(state.fill) }) })),\n text: () => state.bars[i]?.caption ?? \"\",\n x: () => (state.horizontal ? captionAlong(state, i, caption.layoutBounds.width) : (state.bars[i]?.center ?? 0)),\n y: () => (state.horizontal ? (state.bars[i]?.center ?? 0) : captionAlong(state, i, caption.layoutBounds.height)),\n opacity: () => {\n const box = caption.layoutBounds\n const along = state.horizontal ? box.width : box.height\n const across = state.horizontal ? box.height : box.width\n if (state.values === \"inside\" && !fitsInside(state, i, along, across)) return 0\n // A figure past the end rises in with its bar's last stretch.\n return dimAt(state, i) * clamp((state.growth - 0.6) / 0.4, 0, 1)\n },\n }) as unknown as Node2D\n return caption\n }))\n },\n load: (loader, state) => loadPaints(loader, { fills: [state.fill] }),\n commands: {\n /** Raise every bar from the baseline (`growth` 0 to 1). The resting state is the finished one; the chart arms it back to 0. */\n enter: (timeline) => {\n const ease = frameEase(timeline)\n return timeline.animate((t) => ({ growth: ease(t) }))\n },\n },\n render: (ctx, state) => {\n if (state.enabled) {\n for (let i = 0; i < state.bars.length; i++) {\n const bar = state.bars[i]\n const ends = endsAt(state, i)\n if (!ends || bar.thickness <= 0) continue\n // A segment inside a stack reaches a pixel under the next, so no seam of background shows between them.\n const seam = bar.round ? 0 : 1\n const length = Math.abs(ends.end - ends.base) + seam\n if (length <= seam) continue\n const radius = bar.round ? Math.max(0, Math.min(state.cornerRadius, length, bar.thickness / 2)) : 0\n const forward = ends.end >= ends.base\n const mid = (ends.base + ends.end) / 2 + (forward ? seam : -seam) / 2\n // Corner keys are visual (y-up): only the far end rounds.\n const far = state.horizontal\n ? (forward ? { topRight: radius, bottomRight: radius, topLeft: 0, bottomLeft: 0 } : { topLeft: radius, bottomLeft: radius, topRight: 0, bottomRight: 0 })\n : (forward ? { topLeft: radius, topRight: radius, bottomLeft: 0, bottomRight: 0 } : { bottomLeft: radius, bottomRight: radius, topLeft: 0, topRight: 0 })\n // One `Graphics2D` per bar: opacity belongs to the command list, and the spotlight dims single bars.\n const g = new Graphics2D().rect(state.horizontal\n ? { x: mid, y: bar.center, width: length, height: bar.thickness, cornerRadius: radius > 0 ? far : 0 }\n : { x: bar.center, y: mid, width: bar.thickness, height: length, cornerRadius: radius > 0 ? far : 0 })\n g.fill(state.fill)\n ctx.draw(g.opacity(dimAt(state, i)))\n }\n }\n ctx.children()\n },\n})\n\nexport type ChartBars = NodeOf<typeof ChartBars>\n\n/** A figure as the bar prints it when the chart gives no caption. */\nexport function barCaption(value: number): string {\n return value === 0 ? \"\" : formatMarker(value)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-bars.js","sourceRoot":"","sources":["../../src/bar-chart/chart-bars.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,GAYR,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAwBhC,2FAA2F;AAC3F,MAAM,WAAW,GAAG,GAAG,CAAA;AAavB,yEAAyE;AACzE,SAAS,KAAK,CAAC,CAAO,EAAE,KAAa;IACnC,IAAI,CAAC,CAAC,CAAC,OAAO;QAAE,OAAO,CAAC,CAAA;IACxB,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AACxC,CAAC;AAED,gEAAgE;AAChE,SAAS,MAAM,CAAC,CAAO,EAAE,KAAa;IACpC,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACzB,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,CAAC,GAAG,KAA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AAa;IACtC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["import {\n Graphics2D,\n Text,\n Types,\n clamp,\n component2d,\n fillOps,\n type Fill,\n type FillResolved,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D,\n type Node2DProps as _Node2DProps,\n type RectCornerRadius as _RectCornerRadius,\n type RectCornerStyle as _RectCornerStyle,\n type TextStyle,\n type CornerRadiusResolved,\n type CornerStyleResolved,\n} from \"@motionscript/sdk\"\n\nimport { boundText } from \"../kit/cartesian\"\nimport { asParts, fresh } from \"../kit/entries\"\nimport { frameEase } from \"../kit/motion\"\nimport { loadPaints } from \"../kit/paints\"\nimport { formatMarker } from \"../kit/shared\"\nimport { inkOn } from \"./shared\"\n\n/**\n * One drawn bar in the plot's centred pixel space (origin at the centre, y-up),\n * mapped by the parent {@link BarChart}: `center` and `thickness` across the\n * category slot, `from` and `to` along the value axis (y for a column, x for a\n * horizontal bar). Two ends rather than a base and a length, like `BarSpan`:\n * one shape fits grouped, stacked and negative.\n */\nexport interface BarGeometry {\n center: number\n thickness: number\n /** The base: the baseline when grouped, the running stack end when stacked. */\n from: number\n /** The far end at full growth. */\n to: number\n /** Whether the far end takes the far corners (the stack's last segment on its side). */\n round: boolean\n /** Whether the base takes the base corners (it stands on the baseline: every grouped bar, a stack's first segment). */\n grounded?: boolean\n /** The figure printed by the bar; empty for none. */\n caption: string\n}\n\n/** A figure inside a bar needs this much room around it, in multiples of the type size. */\nconst INSIDE_ROOM = 0.6\n\ninterface Bars {\n readonly bars: readonly BarGeometry[]\n readonly baseline: number\n readonly horizontal: boolean\n readonly growth: number\n readonly dims: readonly number[]\n readonly enabled: boolean\n readonly values: \"none\" | \"end\" | \"inside\"\n readonly valueStyle: TextStyle\n}\n\n/** Bar `i`'s dimming: the category spotlight, then the series switch. */\nfunction dimAt(s: Bars, index: number): number {\n if (!s.enabled) return 0\n return clamp(s.dims[index] ?? 1, 0, 1)\n}\n\n/** Bar `i`'s two ends as grown so far, along the value axis. */\nfunction endsAt(s: Bars, index: number): { base: number; end: number } | null {\n const bar = s.bars[index]\n if (!bar) return null\n const g = clamp(s.growth, 0, 1)\n return { base: s.baseline + (bar.from - s.baseline) * g, end: s.baseline + (bar.to - s.baseline) * g }\n}\n\nfunction sizeOf(style: TextStyle): number {\n return typeof style.fontSize === \"number\" ? style.fontSize : 24\n}\n\n/** Where bar `i`'s figure sits along the value axis: past its end, or in its middle. */\nfunction captionAlong(s: Bars, index: number, extent: number): number {\n const ends = endsAt(s, index)\n if (!ends) return 0\n if (s.values === \"inside\") return (ends.base + ends.end) / 2\n const direction = ends.end >= ends.base ? 1 : -1\n return ends.end + direction * (sizeOf(s.valueStyle) * 0.4 + extent / 2)\n}\n\n/** Whether bar `i` has room for a figure `extent` long inside it. */\nfunction fitsInside(s: Bars, index: number, extent: number, across: number): boolean {\n const bar = s.bars[index]\n const ends = endsAt(s, index)\n if (!bar || !ends) return false\n const room = sizeOf(s.valueStyle) * INSIDE_ROOM\n return Math.abs(ends.end - ends.base) >= extent + room && bar.thickness >= across\n}\n\n/**\n * One series of a {@link BarChart}: its bar in every category plus the printed\n * figures. A node per series, like `ChartLine`, so `showSeries` and\n * `spotlightSeries` mean the same on both: enable the node or tween its opacity.\n * Positions come from the parent, which owns the slot arithmetic.\n */\nexport const ChartBars = component2d({\n key: \"chartBars\",\n state: {\n bars: fresh<BarGeometry[]>(() => []),\n /** Pixel position of value 0 along the value axis, where every bar grows from. */\n baseline: 0,\n /** Bars grow along x from a category column rather than along y from a row. */\n horizontal: false,\n fill: Types.custom<Fill, FillResolved[]>([], { resolve: fillOps.resolve, lerp: fillOps.lerp }),\n /** As for a bar standing up from the baseline: `topLeft`/`topRight` round its far end, the bottom pair its base. */\n cornerRadius: Types.cornerRadius(8),\n cornerStyle: Types.cornerStyle(\"rounded\"),\n /**\n * Rise of every bar in `[0, 1]` about the baseline, not each bar's own base:\n * every segment travels by the same factor, so a stack stays flush\n * mid-animation and a negative bar grows the other way.\n */\n growth: 1,\n /** Per-bar opacity by row index, how the category spotlight reaches one bar. Missing reads as 1. */\n dims: fresh<number[]>(() => []),\n /** Read as built: whether each bar prints its figure, and where. */\n values: Types.custom<\"none\" | \"end\" | \"inside\">(\"none\"),\n valueStyle: Types.custom<TextStyle>({ fontSize: 24, fill: \"white\" }),\n /** The wholesale switch behind `showSeries`/`hideSeries`; off skips the bars and their figures. */\n enabled: true,\n },\n // A node made of its figures would otherwise hug them.\n defaults: { width: \"fill\", height: \"fill\" },\n // One figure per bar, built once (the row count is fixed at construction)\n // and bound to the live geometry so it travels with its bar.\n children: (state) => {\n if (state.values === \"none\") return []\n return asParts(state.bars.map((_, i) => {\n const caption: Node2D = new Text({\n ...boundText(() => ({ ...state.valueStyle, ...(state.values === \"inside\" && { fill: inkOn(state.fill) }) })),\n text: () => state.bars[i]?.caption ?? \"\",\n x: () => (state.horizontal ? captionAlong(state, i, caption.layoutBounds.width) : (state.bars[i]?.center ?? 0)),\n y: () => (state.horizontal ? (state.bars[i]?.center ?? 0) : captionAlong(state, i, caption.layoutBounds.height)),\n opacity: () => {\n const box = caption.layoutBounds\n const along = state.horizontal ? box.width : box.height\n const across = state.horizontal ? box.height : box.width\n if (state.values === \"inside\" && !fitsInside(state, i, along, across)) return 0\n // A figure past the end rises in with its bar's last stretch.\n return dimAt(state, i) * clamp((state.growth - 0.6) / 0.4, 0, 1)\n },\n }) as unknown as Node2D\n return caption\n }))\n },\n load: (loader, state) => loadPaints(loader, { fills: [state.fill] }),\n commands: {\n /** Raise every bar from the baseline (`growth` 0 to 1). The resting state is the finished one; the chart arms it back to 0. */\n enter: (timeline) => {\n const ease = frameEase(timeline)\n return timeline.animate((t) => ({ growth: ease(t) }))\n },\n },\n render: (ctx, state) => {\n if (state.enabled) {\n for (let i = 0; i < state.bars.length; i++) {\n const bar = state.bars[i]\n const ends = endsAt(state, i)\n if (!ends || bar.thickness <= 0) continue\n // A segment inside a stack reaches a pixel under the next, so no seam of background shows between them.\n const seam = bar.round ? 0 : 1\n const length = Math.abs(ends.end - ends.base) + seam\n if (length <= seam) continue\n const forward = ends.end >= ends.base\n const mid = (ends.base + ends.end) / 2 + (forward ? seam : -seam) / 2\n const corners = barCorners(state, bar, forward, length)\n // One `Graphics2D` per bar: opacity belongs to the command list, and the spotlight dims single bars.\n const g = new Graphics2D().rect(state.horizontal\n ? { x: mid, y: bar.center, width: length, height: bar.thickness, ...corners }\n : { x: bar.center, y: mid, width: bar.thickness, height: length, ...corners })\n g.fill(state.fill)\n ctx.draw(g.opacity(dimAt(state, i)))\n }\n }\n ctx.children()\n },\n})\n\nexport type ChartBars = NodeOf<typeof ChartBars>\n\ntype Corners<T> = { topLeft: T; topRight: T; bottomRight: T; bottomLeft: T }\n\n/**\n * Turns corners written for a bar standing up into the drawn bar's visual\n * (y-up) corners: mirrored for a bar below zero, turned a quarter clockwise\n * for one growing right, and both for one growing left.\n */\nfunction orient<T>(c: Corners<T>, horizontal: boolean, forward: boolean): Corners<T> {\n if (!horizontal) return forward ? c : { topLeft: c.bottomLeft, topRight: c.bottomRight, bottomRight: c.topRight, bottomLeft: c.topLeft }\n return forward\n ? { topLeft: c.bottomLeft, topRight: c.topLeft, bottomRight: c.topRight, bottomLeft: c.bottomRight }\n : { topLeft: c.topLeft, topRight: c.bottomLeft, bottomRight: c.bottomRight, bottomLeft: c.topRight }\n}\n\n/** Bar `bar`'s rect corners: the far pair only where its stack ends, the base pair only on the baseline, each held inside the bar. */\nexport function barCorners(\n state: { readonly cornerRadius: CornerRadiusResolved; readonly cornerStyle: CornerStyleResolved; readonly horizontal: boolean },\n bar: BarGeometry,\n forward: boolean,\n length: number\n): { cornerRadius: Corners<number>; cornerStyle: CornerStyleResolved } {\n const grounded = bar.grounded ?? true\n const r = state.cornerRadius\n const ends = (bar.round ? 1 : 0) + (grounded ? 1 : 0)\n const cap = Math.max(0, Math.min(bar.thickness / 2, ends > 1 ? length / 2 : length))\n const fit = (v: number, on: boolean) => (on ? Math.max(0, Math.min(v, cap)) : 0)\n const upright: Corners<number> = {\n topLeft: fit(r.topLeft, bar.round),\n topRight: fit(r.topRight, bar.round),\n bottomRight: fit(r.bottomRight, grounded),\n bottomLeft: fit(r.bottomLeft, grounded),\n }\n return { cornerRadius: orient(upright, state.horizontal, forward), cornerStyle: orient(state.cornerStyle, state.horizontal, forward) }\n}\n\n/** A figure as the bar prints it when the chart gives no caption. */\nexport function barCaption(value: number): string {\n return value === 0 ? \"\" : formatMarker(value)\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DataRecord, type Fill } from "@motionscript/sdk";
|
|
1
|
+
import { type DataRecord, type Fill, type CornerRadiusResolved as _CornerRadiusResolved, type CornerStyleResolved as _CornerStyleResolved, type RectCornerRadius as _RectCornerRadius, type RectCornerStyle as _RectCornerStyle } from "@motionscript/sdk";
|
|
2
2
|
import { type ChartSeries, type Range } from "../kit/shared.js";
|
|
3
3
|
/** One bar per row, beside its siblings in the category slot or stacked on them: {@link ChartSeries} under the name for what it draws here. */
|
|
4
4
|
export type BarSeries = ChartSeries;
|
|
@@ -38,10 +38,15 @@ export declare function barValueExtent(data: DataRecord[], series: readonly BarS
|
|
|
38
38
|
export declare function resolveBarScale(data: DataRecord[], series: readonly BarSeries[], stack: BarStack, range: Range | undefined, divisions: number, weights?: readonly number[]): Range;
|
|
39
39
|
/** Black or white, whichever reads on `fill`: a figure printed inside a bar. */
|
|
40
40
|
export declare function inkOn(fill: Fill): string;
|
|
41
|
-
/** A bar chart's own look:
|
|
41
|
+
/** A bar chart's own look: its corners, and how wide the bars are. */
|
|
42
42
|
export declare const BAR_MARKS: {
|
|
43
|
-
/**
|
|
44
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Each corner as for a bar standing up from the baseline: the top pair round
|
|
45
|
+
* its far end, the bottom pair its base. Inside a stack, a segment's far end
|
|
46
|
+
* stays square unless it ends the stack, and its base unless it starts it.
|
|
47
|
+
*/
|
|
48
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
49
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
45
50
|
/** How much of its category slot a bar group fills, the rest spacing the groups. */
|
|
46
51
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
47
52
|
/** Space between the bars of one group, side by side. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/bar-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/bar-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,IAAI,EAET,KAAK,oBAAoB,IAAI,qBAAqB,EAClD,KAAK,mBAAmB,IAAI,oBAAoB,EAChD,KAAK,gBAAgB,IAAI,iBAAiB,EAC1C,KAAK,eAAe,IAAI,gBAAgB,EACzC,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAwB,KAAK,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAA;AAElF,+IAA+I;AAC/I,MAAM,MAAM,SAAS,GAAG,WAAW,CAAA;AAEnC,2FAA2F;AAC3F,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AAErD,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,YAAY,CAAA;AAEtD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,qGAAqG;IACrG,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAE,SAAS,MAAM,EAAO,GAAG,OAAO,EAAE,CA6BnI;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,CAUpI;AAED,2LAA2L;AAC3L,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAAE,EAClB,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,KAAK,GAAG,SAAS,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAC1B,KAAK,CAKP;AAED,gFAAgF;AAChF,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAQxC;AAED,sEAAsE;AACtE,eAAO,MAAM,SAAS;IACpB;;;;OAIG;;;IAGH,oFAAoF;;IAEpF,yDAAyD;;CAE1D,CAAA;AAED,eAAO,MAAM,UAAU;IACrB,qFAAqF;;CAEtF,CAAA"}
|
package/dist/bar-chart/shared.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Types, fillOps } from "@motionscript/sdk";
|
|
1
|
+
import { Types, fillOps, } from "@motionscript/sdk";
|
|
2
2
|
import { niceRange, num, text } from "../kit/shared.js";
|
|
3
3
|
/**
|
|
4
4
|
* One row's spans, in series order. Stacking keeps a running sum on each side
|
|
@@ -78,12 +78,17 @@ export function inkOn(fill) {
|
|
|
78
78
|
const luminance = 0.2126 * lift(r) + 0.7152 * lift(g) + 0.0722 * lift(b);
|
|
79
79
|
return luminance > 0.4 ? "#0a0a0a" : "white";
|
|
80
80
|
}
|
|
81
|
-
/** A bar chart's own look:
|
|
81
|
+
/** A bar chart's own look: its corners, and how wide the bars are. */
|
|
82
82
|
export const BAR_MARKS = {
|
|
83
|
-
/**
|
|
84
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Each corner as for a bar standing up from the baseline: the top pair round
|
|
85
|
+
* its far end, the bottom pair its base. Inside a stack, a segment's far end
|
|
86
|
+
* stays square unless it ends the stack, and its base unless it starts it.
|
|
87
|
+
*/
|
|
88
|
+
barCornerRadius: Types.cornerRadius({ topLeft: 10, topRight: 10, bottomRight: 0, bottomLeft: 0 }),
|
|
89
|
+
barCornerStyle: Types.cornerStyle("rounded"),
|
|
85
90
|
/** How much of its category slot a bar group fills, the rest spacing the groups. */
|
|
86
|
-
barWidth: Types.number(0.7, { min: 0.05, max: 1, step: 0.05 }),
|
|
91
|
+
barWidth: Types.number(0.7, { min: 0.05, max: 1, step: 0.05, unit: "%", scale: 100 }),
|
|
87
92
|
/** Space between the bars of one group, side by side. */
|
|
88
93
|
barGap: Types.number(6, { min: 0, max: 40, step: 1, unit: "px" }),
|
|
89
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/bar-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAA8B,MAAM,mBAAmB,CAAA;AAE9E,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAgC,MAAM,eAAe,CAAA;AAyBlF;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAe,EAAE,MAA4B,EAAE,KAAe,EAAE,UAA6B,EAAE;IACtH,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC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dk\"\n\nimport { niceRange, num, text, type ChartSeries, type Range } from \"../kit/shared\"\n\n/** One bar per row, beside its siblings in the category slot or stacked on them: {@link ChartSeries} under the name for what it draws here. */\nexport type BarSeries = ChartSeries\n\n/** How the series share a category: side by side, stacked, or stacked as shares of 100. */\nexport type BarStack = \"none\" | \"stacked\" | \"percent\"\n\n/** Which way the bars grow: up from a category row, or right from a category column. */\nexport type BarOrientation = \"vertical\" | \"horizontal\"\n\n/**\n * One bar's span in data units. A span rather than a height because every mode\n * fits it, and a negative value just runs the other way with no special case.\n */\nexport interface BarSpan {\n /** Where the base sits: 0 apart, the running total below (or above, for a negative) when stacked. */\n from: number\n to: number\n /** `to - from`. */\n value: number\n /** Whether it ends its stack on its side of zero, so its far end is rounded. */\n outer: boolean\n}\n\n/**\n * One row's spans, in series order. Stacking keeps a running sum on each side\n * of zero, so a negative value stacks downward from the baseline rather than\n * eating into the positives. In `percent` each value is its share of the row's\n * total magnitude. A zero value still yields a degenerate span, keeping the list\n * index-aligned with the series. `weights` scale each series' contribution.\n */\nexport function barSpans(row: DataRecord, series: readonly BarSeries[], stack: BarStack, weights: readonly number[] = []): BarSpan[] {\n const weight = (i: number) => Math.max(0, weights[i] ?? 1)\n if (stack !== \"stacked\" && stack !== \"percent\") {\n return series.map((s) => {\n const value = num(row, s.field)\n return { from: 0, to: value, value, outer: true }\n })\n }\n const values = series.map((s, i) => num(row, s.field) * weight(i))\n const total = values.reduce((sum, v) => sum + Math.abs(v), 0)\n const scaled = stack === \"percent\" ? values.map((v) => (total > 0 ? (v / total) * 100 : 0)) : values\n let lastUp = -1\n let lastDown = -1\n scaled.forEach((v, i) => {\n if (v > 0) lastUp = i\n else if (v < 0) lastDown = i\n })\n let up = 0\n let down = 0\n return scaled.map((value, i) => {\n if (value < 0) {\n const from = down\n down += value\n return { from, to: down, value, outer: i === lastDown }\n }\n const from = up\n up += value\n return { from, to: up, value, outer: i === lastUp }\n })\n}\n\nexport function barCategories(data: DataRecord[], field: string): string[] {\n return data.map((row) => text(row, field))\n}\n\n/**\n * The `[min, max]` of everything drawn, zero always included: a scale starting\n * at 40 draws a bar three times its neighbour for a 10% difference. A cropped\n * axis takes an explicit range.\n */\nexport function barValueExtent(data: DataRecord[], series: readonly BarSeries[], stack: BarStack, weights?: readonly number[]): Range {\n let lo = 0\n let hi = 0\n for (const row of data) {\n for (const span of barSpans(row, series, stack, weights)) {\n lo = Math.min(lo, span.from, span.to)\n hi = Math.max(hi, span.from, span.to)\n }\n }\n return lo < hi ? [lo, hi] : [0, 1]\n}\n\n/** The explicit `range`, else the data's extent nudged to tidy bounds (a percent stack reads to 100); `divisions` (one fewer than the marker count) makes the drawn ticks land on them. */\nexport function resolveBarScale(\n data: DataRecord[],\n series: readonly BarSeries[],\n stack: BarStack,\n range: Range | undefined,\n divisions: number,\n weights?: readonly number[]\n): Range {\n if (range) return range\n const [lo, hi] = barValueExtent(data, series, stack, weights)\n if (stack === \"percent\") return [lo < 0 ? -100 : 0, hi > 0 ? 100 : 0]\n return niceRange([lo, hi], divisions)\n}\n\n/** Black or white, whichever reads on `fill`: a figure printed inside a bar. */\nexport function inkOn(fill: Fill): string {\n const layers = fillOps.resolve(fill)\n const top = layers[layers.length - 1]\n if (top?.type !== \"solid\") return \"white\"\n const [r, g, b] = top.color\n const lift = (c: number) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)\n const luminance = 0.2126 * lift(r) + 0.7152 * lift(g) + 0.0722 * lift(b)\n return luminance > 0.4 ? \"#0a0a0a\" : \"white\"\n}\n\n/** A bar chart's own look: how round and how wide the bars are. */\nexport const BAR_MARKS = {\n /** Radius of each bar's far corners; a stacked segment inside the stack stays square. */\n barRadius: Types.number(10, { min: 0, max: 64, step: 1, unit: \"px\" }),\n /** How much of its category slot a bar group fills, the rest spacing the groups. */\n barWidth: Types.number(0.7, { min: 0.05, max: 1, step: 0.05 }),\n /** Space between the bars of one group, side by side. */\n barGap: Types.number(6, { min: 0, max: 40, step: 1, unit: \"px\" }),\n}\n\nexport const BAR_LABELS = {\n /** Read as the chart is built: each bar's value past its end, inside it, or none. */\n values: Types.oneOf([\"none\", \"end\", \"inside\"] as const, { animatable: false }),\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/bar-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,GAQR,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAgC,MAAM,eAAe,CAAA;AAyBlF;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAe,EAAE,MAA4B,EAAE,KAAe,EAAE,UAA6B,EAAE;IACtH,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IAC1D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACtB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;YAC/B,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAClE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,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AS,CAAC;IAC5C,oFAAoF;IACpF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IACrF,yDAAyD;IACzD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;CAClE,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,qFAAqF;IACrF,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAU,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;CAC/E,CAAA","sourcesContent":["import {\n Types,\n fillOps,\n type DataRecord,\n type Fill,\n // Named so the emitted marks types reach these through the sdk, not core.\n type CornerRadiusResolved as _CornerRadiusResolved,\n type CornerStyleResolved as _CornerStyleResolved,\n type RectCornerRadius as _RectCornerRadius,\n type RectCornerStyle as _RectCornerStyle,\n} from \"@motionscript/sdk\"\n\nimport { niceRange, num, text, type ChartSeries, type Range } from \"../kit/shared\"\n\n/** One bar per row, beside its siblings in the category slot or stacked on them: {@link ChartSeries} under the name for what it draws here. */\nexport type BarSeries = ChartSeries\n\n/** How the series share a category: side by side, stacked, or stacked as shares of 100. */\nexport type BarStack = \"none\" | \"stacked\" | \"percent\"\n\n/** Which way the bars grow: up from a category row, or right from a category column. */\nexport type BarOrientation = \"vertical\" | \"horizontal\"\n\n/**\n * One bar's span in data units. A span rather than a height because every mode\n * fits it, and a negative value just runs the other way with no special case.\n */\nexport interface BarSpan {\n /** Where the base sits: 0 apart, the running total below (or above, for a negative) when stacked. */\n from: number\n to: number\n /** `to - from`. */\n value: number\n /** Whether it ends its stack on its side of zero, so its far end is rounded. */\n outer: boolean\n}\n\n/**\n * One row's spans, in series order. Stacking keeps a running sum on each side\n * of zero, so a negative value stacks downward from the baseline rather than\n * eating into the positives. In `percent` each value is its share of the row's\n * total magnitude. A zero value still yields a degenerate span, keeping the list\n * index-aligned with the series. `weights` scale each series' contribution.\n */\nexport function barSpans(row: DataRecord, series: readonly BarSeries[], stack: BarStack, weights: readonly number[] = []): BarSpan[] {\n const weight = (i: number) => Math.max(0, weights[i] ?? 1)\n if (stack !== \"stacked\" && stack !== \"percent\") {\n return series.map((s) => {\n const value = num(row, s.field)\n return { from: 0, to: value, value, outer: true }\n })\n }\n const values = series.map((s, i) => num(row, s.field) * weight(i))\n const total = values.reduce((sum, v) => sum + Math.abs(v), 0)\n const scaled = stack === \"percent\" ? values.map((v) => (total > 0 ? (v / total) * 100 : 0)) : values\n let lastUp = -1\n let lastDown = -1\n scaled.forEach((v, i) => {\n if (v > 0) lastUp = i\n else if (v < 0) lastDown = i\n })\n let up = 0\n let down = 0\n return scaled.map((value, i) => {\n if (value < 0) {\n const from = down\n down += value\n return { from, to: down, value, outer: i === lastDown }\n }\n const from = up\n up += value\n return { from, to: up, value, outer: i === lastUp }\n })\n}\n\nexport function barCategories(data: DataRecord[], field: string): string[] {\n return data.map((row) => text(row, field))\n}\n\n/**\n * The `[min, max]` of everything drawn, zero always included: a scale starting\n * at 40 draws a bar three times its neighbour for a 10% difference. A cropped\n * axis takes an explicit range.\n */\nexport function barValueExtent(data: DataRecord[], series: readonly BarSeries[], stack: BarStack, weights?: readonly number[]): Range {\n let lo = 0\n let hi = 0\n for (const row of data) {\n for (const span of barSpans(row, series, stack, weights)) {\n lo = Math.min(lo, span.from, span.to)\n hi = Math.max(hi, span.from, span.to)\n }\n }\n return lo < hi ? [lo, hi] : [0, 1]\n}\n\n/** The explicit `range`, else the data's extent nudged to tidy bounds (a percent stack reads to 100); `divisions` (one fewer than the marker count) makes the drawn ticks land on them. */\nexport function resolveBarScale(\n data: DataRecord[],\n series: readonly BarSeries[],\n stack: BarStack,\n range: Range | undefined,\n divisions: number,\n weights?: readonly number[]\n): Range {\n if (range) return range\n const [lo, hi] = barValueExtent(data, series, stack, weights)\n if (stack === \"percent\") return [lo < 0 ? -100 : 0, hi > 0 ? 100 : 0]\n return niceRange([lo, hi], divisions)\n}\n\n/** Black or white, whichever reads on `fill`: a figure printed inside a bar. */\nexport function inkOn(fill: Fill): string {\n const layers = fillOps.resolve(fill)\n const top = layers[layers.length - 1]\n if (top?.type !== \"solid\") return \"white\"\n const [r, g, b] = top.color\n const lift = (c: number) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)\n const luminance = 0.2126 * lift(r) + 0.7152 * lift(g) + 0.0722 * lift(b)\n return luminance > 0.4 ? \"#0a0a0a\" : \"white\"\n}\n\n/** A bar chart's own look: its corners, and how wide the bars are. */\nexport const BAR_MARKS = {\n /**\n * Each corner as for a bar standing up from the baseline: the top pair round\n * its far end, the bottom pair its base. Inside a stack, a segment's far end\n * stays square unless it ends the stack, and its base unless it starts it.\n */\n barCornerRadius: Types.cornerRadius({ topLeft: 10, topRight: 10, bottomRight: 0, bottomLeft: 0 }),\n barCornerStyle: Types.cornerStyle(\"rounded\"),\n /** How much of its category slot a bar group fills, the rest spacing the groups. */\n barWidth: Types.number(0.7, { min: 0.05, max: 1, step: 0.05, unit: \"%\", scale: 100 }),\n /** Space between the bars of one group, side by side. */\n barGap: Types.number(6, { min: 0, max: 40, step: 1, unit: \"px\" }),\n}\n\nexport const BAR_LABELS = {\n /** Read as the chart is built: each bar's value past its end, inside it, or none. */\n values: Types.oneOf([\"none\", \"end\", \"inside\"] as const, { animatable: false }),\n}\n"]}
|