@sinnstack/ui 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/LICENSE +373 -0
- package/README.md +188 -2
- package/docs/blocks.md +373 -0
- package/docs/data.md +128 -0
- package/docs/finishes.md +165 -0
- package/docs/motion.md +166 -0
- package/docs/primitives.md +510 -0
- package/docs/seo.md +191 -0
- package/docs/tokens.md +122 -0
- package/package.json +132 -3
- package/scripts/check-contrast.mjs +180 -0
- package/src/blocks/BlockRenderer.astro +60 -0
- package/src/blocks/CTABanner.astro +121 -0
- package/src/blocks/CTAPair.astro +110 -0
- package/src/blocks/CardGrid.astro +167 -0
- package/src/blocks/ConsentEmbed.astro +125 -0
- package/src/blocks/ConsentManager.astro +147 -0
- package/src/blocks/ConsentScript.astro +47 -0
- package/src/blocks/ContactCard.astro +164 -0
- package/src/blocks/ContactForm.astro +224 -0
- package/src/blocks/ErrorPage.astro +242 -0
- package/src/blocks/FAQ.astro +135 -0
- package/src/blocks/FeatureGrid.astro +148 -0
- package/src/blocks/Hero.astro +171 -0
- package/src/blocks/HeroCarousel.astro +220 -0
- package/src/blocks/HighlightCards.astro +107 -0
- package/src/blocks/LocationHours.astro +311 -0
- package/src/blocks/LogoCloud.astro +135 -0
- package/src/blocks/MaintenancePage.astro +173 -0
- package/src/blocks/MediaText.astro +177 -0
- package/src/blocks/PageHeader.astro +126 -0
- package/src/blocks/ProseSection.astro +98 -0
- package/src/blocks/Reviews.astro +194 -0
- package/src/blocks/RichText.astro +58 -0
- package/src/blocks/StatsBand.astro +117 -0
- package/src/blocks/Steps.astro +141 -0
- package/src/blocks/Testimonials.astro +144 -0
- package/src/blocks/Topbar.astro +158 -0
- package/src/blocks/cms/card-grid.ts +48 -0
- package/src/blocks/cms/consent.ts +16 -0
- package/src/blocks/cms/contact-card.ts +46 -0
- package/src/blocks/cms/contact-form.ts +37 -0
- package/src/blocks/cms/cta-banner.ts +27 -0
- package/src/blocks/cms/cta-pair.ts +30 -0
- package/src/blocks/cms/data-base.ts +5 -0
- package/src/blocks/cms/data.ts +257 -0
- package/src/blocks/cms/faq.ts +38 -0
- package/src/blocks/cms/feature-grid.ts +47 -0
- package/src/blocks/cms/fixtures.ts +591 -0
- package/src/blocks/cms/hero-carousel.ts +36 -0
- package/src/blocks/cms/hero.ts +33 -0
- package/src/blocks/cms/highlight-cards.ts +41 -0
- package/src/blocks/cms/images.ts +37 -0
- package/src/blocks/cms/index.ts +59 -0
- package/src/blocks/cms/location-hours.ts +67 -0
- package/src/blocks/cms/logo-cloud.ts +36 -0
- package/src/blocks/cms/media-text.ts +26 -0
- package/src/blocks/cms/page-header.ts +27 -0
- package/src/blocks/cms/pages.ts +35 -0
- package/src/blocks/cms/prose-section.ts +25 -0
- package/src/blocks/cms/reviews.ts +50 -0
- package/src/blocks/cms/schema-dsl.ts +134 -0
- package/src/blocks/cms/schema.ts +794 -0
- package/src/blocks/cms/shared.ts +63 -0
- package/src/blocks/cms/stats-band.ts +35 -0
- package/src/blocks/cms/steps.ts +40 -0
- package/src/blocks/cms/testimonials.ts +46 -0
- package/src/blocks/cms/topbar.ts +27 -0
- package/src/blocks/cms/types.ts +27 -0
- package/src/blocks/consent.ts +14 -0
- package/src/blocks/icons.ts +47 -0
- package/src/blocks/index.ts +42 -0
- package/src/blocks/internal/Actions.astro +35 -0
- package/src/blocks/internal/BlockHeader.astro +45 -0
- package/src/blocks/internal/BlockShell.astro +58 -0
- package/src/blocks/internal/CarouselScript.astro +7 -0
- package/src/blocks/internal/ConsentEmbedScript.astro +7 -0
- package/src/blocks/internal/ConsentManagerScript.astro +7 -0
- package/src/blocks/internal/HoursScript.astro +7 -0
- package/src/blocks/internal/Placeholder.astro +13 -0
- package/src/blocks/internal/RichTextNode.astro +133 -0
- package/src/blocks/internal/StandaloneDocument.astro +53 -0
- package/src/blocks/internal/consent.ts +96 -0
- package/src/blocks/internal/fields.ts +18 -0
- package/src/blocks/internal/registry-contract.ts +67 -0
- package/src/blocks/internal/reviews.ts +22 -0
- package/src/blocks/internal/slug.ts +12 -0
- package/src/blocks/internal/util.ts +23 -0
- package/src/blocks/lib/contact.ts +92 -0
- package/src/blocks/lib/error-pages.ts +119 -0
- package/src/blocks/lib/faq.ts +37 -0
- package/src/blocks/lib/hours.ts +201 -0
- package/src/blocks/lib/maintenance.ts +129 -0
- package/src/blocks/lib/markdown.ts +350 -0
- package/src/blocks/lib/rich-text.ts +132 -0
- package/src/blocks/registry.ts +79 -0
- package/src/blocks/scripts/carousel.ts +218 -0
- package/src/blocks/scripts/consent-embed.ts +105 -0
- package/src/blocks/scripts/consent-manager.ts +112 -0
- package/src/blocks/scripts/consent-store.ts +86 -0
- package/src/blocks/scripts/error-page.ts +71 -0
- package/src/blocks/scripts/hours.ts +107 -0
- package/src/blocks/scripts/maintenance.ts +109 -0
- package/src/blocks/styles/blocks.css +1320 -0
- package/src/blocks/styles/consent.css +102 -0
- package/src/blocks/styles/faq.css +28 -0
- package/src/blocks/styles/location.css +92 -0
- package/src/blocks/styles/prose-section.css +13 -0
- package/src/blocks/styles/quotes.css +123 -0
- package/src/blocks/styles/rich-text.css +14 -0
- package/src/blocks/types.ts +293 -0
- package/src/data/ChartAxis.astro +19 -0
- package/src/data/ChartContainer.astro +152 -0
- package/src/data/ChartLegend.astro +25 -0
- package/src/data/ChartSeries.astro +14 -0
- package/src/data/ChartTable.astro +17 -0
- package/src/data/ChartTooltip.astro +20 -0
- package/src/data/Sparkline.astro +55 -0
- package/src/data/cms.ts +130 -0
- package/src/data/index.ts +10 -0
- package/src/data/internal/scale.ts +107 -0
- package/src/data/lib/chart.ts +459 -0
- package/src/data/lib/render.ts +219 -0
- package/src/data/lib/sparkline.ts +117 -0
- package/src/data/schema.ts +65 -0
- package/src/data/scripts/chart.ts +324 -0
- package/src/data/styles/chart.css +392 -0
- package/src/finishes/aurora.css +75 -0
- package/src/finishes/autumn.css +87 -0
- package/src/finishes/blueprint.css +69 -0
- package/src/finishes/brutalist.css +55 -0
- package/src/finishes/clay.css +48 -0
- package/src/finishes/day-cycle.css +46 -0
- package/src/finishes/fog.css +71 -0
- package/src/finishes/glass.css +149 -0
- package/src/finishes/holographic.css +91 -0
- package/src/finishes/night.css +77 -0
- package/src/finishes/paper.css +58 -0
- package/src/finishes/polished-glass.css +159 -0
- package/src/finishes/rain.css +84 -0
- package/src/finishes/scripts/day-cycle.ts +30 -0
- package/src/finishes/scripts/holographic.ts +37 -0
- package/src/finishes/scripts/spotlight.ts +30 -0
- package/src/finishes/spotlight.css +41 -0
- package/src/finishes/spring.css +80 -0
- package/src/finishes/terminal.css +49 -0
- package/src/motion/Marquee.astro +90 -0
- package/src/motion/MotionProvider.astro +50 -0
- package/src/motion/PageTransitions.astro +61 -0
- package/src/motion/Parallax.astro +44 -0
- package/src/motion/ParallaxLayer.astro +31 -0
- package/src/motion/RevealOnScroll.astro +59 -0
- package/src/motion/SceneRegistry.astro +38 -0
- package/src/motion/ScrollScene.astro +81 -0
- package/src/motion/index.ts +12 -0
- package/src/motion/integration.ts +48 -0
- package/src/motion/runtime/page-transitions.ts +68 -0
- package/src/motion/runtime/runtime.ts +180 -0
- package/src/motion/runtime/scenes.ts +248 -0
- package/src/motion/runtime/types.ts +103 -0
- package/src/motion/styles/motion.css +332 -0
- package/src/motion/transitions.ts +74 -0
- package/src/motion/virtual.d.ts +4 -0
- package/src/primitives/Accordion.astro +129 -0
- package/src/primitives/Breadcrumbs.astro +50 -0
- package/src/primitives/BulletList.astro +69 -0
- package/src/primitives/Button.astro +73 -0
- package/src/primitives/ButtonGroup.astro +54 -0
- package/src/primitives/Callout.astro +137 -0
- package/src/primitives/Caption.astro +35 -0
- package/src/primitives/Card.astro +72 -0
- package/src/primitives/CardContent.astro +24 -0
- package/src/primitives/CardFooter.astro +36 -0
- package/src/primitives/CardHeader.astro +86 -0
- package/src/primitives/Checkbox.astro +38 -0
- package/src/primitives/ChoiceGroup.astro +23 -0
- package/src/primitives/Cluster.astro +49 -0
- package/src/primitives/Container.astro +44 -0
- package/src/primitives/DescriptionList.astro +83 -0
- package/src/primitives/Dialog.astro +38 -0
- package/src/primitives/Disclosure.astro +67 -0
- package/src/primitives/Divider.astro +93 -0
- package/src/primitives/Drawer.astro +33 -0
- package/src/primitives/Fieldset.astro +80 -0
- package/src/primitives/Flex.astro +64 -0
- package/src/primitives/FocusRing.astro +63 -0
- package/src/primitives/FocusTrap.astro +64 -0
- package/src/primitives/Footer.astro +155 -0
- package/src/primitives/Form.astro +68 -0
- package/src/primitives/FormDescription.astro +26 -0
- package/src/primitives/FormError.astro +106 -0
- package/src/primitives/FormField.astro +72 -0
- package/src/primitives/Grid.astro +64 -0
- package/src/primitives/Heading.astro +45 -0
- package/src/primitives/IconButton.astro +48 -0
- package/src/primitives/Image.astro +125 -0
- package/src/primitives/Input.astro +86 -0
- package/src/primitives/Label.astro +50 -0
- package/src/primitives/Link.astro +81 -0
- package/src/primitives/LinkButton.astro +66 -0
- package/src/primitives/List.astro +39 -0
- package/src/primitives/ListItem.astro +178 -0
- package/src/primitives/MediaObject.astro +66 -0
- package/src/primitives/MetricCard.astro +278 -0
- package/src/primitives/NavLink.astro +81 -0
- package/src/primitives/NavMenu.astro +109 -0
- package/src/primitives/Navbar.astro +197 -0
- package/src/primitives/Panel.astro +153 -0
- package/src/primitives/Picture.astro +167 -0
- package/src/primitives/Popover.astro +95 -0
- package/src/primitives/Prose.astro +45 -0
- package/src/primitives/Radio.astro +21 -0
- package/src/primitives/Rating.astro +135 -0
- package/src/primitives/ReducedMotion.astro +90 -0
- package/src/primitives/SegmentedControl.astro +132 -0
- package/src/primitives/Select.astro +109 -0
- package/src/primitives/Sheet.astro +45 -0
- package/src/primitives/SkipLink.astro +31 -0
- package/src/primitives/Slider.astro +186 -0
- package/src/primitives/Spacer.astro +35 -0
- package/src/primitives/Stack.astro +51 -0
- package/src/primitives/Surface.astro +70 -0
- package/src/primitives/Switch.astro +22 -0
- package/src/primitives/Table.astro +382 -0
- package/src/primitives/Tabs.astro +126 -0
- package/src/primitives/Text.astro +56 -0
- package/src/primitives/Textarea.astro +75 -0
- package/src/primitives/Thumbnail.astro +154 -0
- package/src/primitives/Toggle.astro +99 -0
- package/src/primitives/Tooltip.astro +50 -0
- package/src/primitives/VisuallyHidden.astro +29 -0
- package/src/primitives/index.ts +103 -0
- package/src/primitives/internal/AccordionScript.astro +7 -0
- package/src/primitives/internal/ChoiceField.astro +91 -0
- package/src/primitives/internal/FocusTrapScript.astro +8 -0
- package/src/primitives/internal/FormValidationScript.astro +10 -0
- package/src/primitives/internal/IndeterminateScript.astro +13 -0
- package/src/primitives/internal/ModalPanel.astro +114 -0
- package/src/primitives/internal/OverlayScript.astro +7 -0
- package/src/primitives/internal/ReducedMotionScript.astro +7 -0
- package/src/primitives/internal/SliderScript.astro +7 -0
- package/src/primitives/internal/SparklineScript.astro +7 -0
- package/src/primitives/internal/TableSortScript.astro +7 -0
- package/src/primitives/internal/TabsScript.astro +7 -0
- package/src/primitives/internal/TooltipScript.astro +7 -0
- package/src/primitives/internal/image-plan.ts +82 -0
- package/src/primitives/internal/image.ts +129 -0
- package/src/primitives/internal/slider.ts +170 -0
- package/src/primitives/lib/deprecate.ts +47 -0
- package/src/primitives/lib/focus-trap.ts +197 -0
- package/src/primitives/lib/focus.ts +60 -0
- package/src/primitives/lib/motion.ts +68 -0
- package/src/primitives/scripts/accordion.ts +123 -0
- package/src/primitives/scripts/form-validation.ts +225 -0
- package/src/primitives/scripts/overlay.ts +71 -0
- package/src/primitives/scripts/reduced-motion.ts +59 -0
- package/src/primitives/scripts/slider.ts +150 -0
- package/src/primitives/scripts/sparkline.ts +131 -0
- package/src/primitives/scripts/table-sort.ts +68 -0
- package/src/primitives/scripts/tabs.ts +151 -0
- package/src/primitives/scripts/tooltip.ts +28 -0
- package/src/primitives/styles/a11y.css +104 -0
- package/src/primitives/styles/accordion.css +53 -0
- package/src/primitives/styles/breadcrumbs.css +59 -0
- package/src/primitives/styles/bullet-list.css +89 -0
- package/src/primitives/styles/button.css +237 -0
- package/src/primitives/styles/choice.css +164 -0
- package/src/primitives/styles/cluster.css +24 -0
- package/src/primitives/styles/container.css +19 -0
- package/src/primitives/styles/data.css +849 -0
- package/src/primitives/styles/disclosure.css +140 -0
- package/src/primitives/styles/divider.css +50 -0
- package/src/primitives/styles/flex.css +42 -0
- package/src/primitives/styles/form.css +241 -0
- package/src/primitives/styles/grid.css +36 -0
- package/src/primitives/styles/media.css +247 -0
- package/src/primitives/styles/nav.css +792 -0
- package/src/primitives/styles/overlay.css +362 -0
- package/src/primitives/styles/prose.css +146 -0
- package/src/primitives/styles/scale.css +175 -0
- package/src/primitives/styles/segmented.css +165 -0
- package/src/primitives/styles/slider.css +170 -0
- package/src/primitives/styles/spacer.css +17 -0
- package/src/primitives/styles/stack.css +25 -0
- package/src/primitives/styles/surface.css +403 -0
- package/src/primitives/styles/tabs.css +223 -0
- package/src/primitives/styles/typography.css +144 -0
- package/src/primitives/styles/utilities.css +24 -0
- package/src/primitives/types.ts +385 -0
- package/src/primitives/utils.ts +254 -0
- package/src/seo/JSONLD.astro +35 -0
- package/src/seo/SEOHead.astro +47 -0
- package/src/seo/cms.ts +59 -0
- package/src/seo/index.ts +10 -0
- package/src/seo/integration.ts +268 -0
- package/src/seo/internal/url.ts +68 -0
- package/src/seo/lib/jsonld.ts +342 -0
- package/src/seo/lib/meta.ts +205 -0
- package/src/seo/lib/redirects.ts +293 -0
- package/src/seo/lib/robots.ts +33 -0
- package/src/seo/lib/rss.ts +98 -0
- package/src/seo/lib/sitemap.ts +105 -0
- package/src/seo/schema.ts +43 -0
- package/src/tokens/base.css +71 -0
- package/src/tokens/tokens.css +210 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineChart — turns data into a ChartModel: scales, ticks, mark positions (as percentages, so
|
|
3
|
+
* the SVG is responsive without JavaScript), tooltip rows, a screen-reader summary and the table.
|
|
4
|
+
* Every Chart* component renders from the same model:
|
|
5
|
+
*
|
|
6
|
+
* ---
|
|
7
|
+
* const chart = defineChart({ type: 'line', x: months, series: [{ label: 'Visits', values }], yFormat: 'integer' });
|
|
8
|
+
* ---
|
|
9
|
+
* <ChartContainer chart={chart} title="Site visits per month">
|
|
10
|
+
* <ChartAxis chart={chart} axis="y" /> <ChartAxis chart={chart} axis="x" />
|
|
11
|
+
* <ChartSeries chart={chart} /> <ChartTooltip chart={chart} />
|
|
12
|
+
* </ChartContainer>
|
|
13
|
+
*
|
|
14
|
+
* Pure: no DOM, no Astro. Tested directly.
|
|
15
|
+
*/
|
|
16
|
+
import { formatValue } from '../../primitives/utils';
|
|
17
|
+
import type { ValueFormat } from '../../primitives/types';
|
|
18
|
+
import { dataGranularity, niceDomain, timeFullLabel, timeTickLabel, timeTicks, xPct as xp, yPct as yp } from '../internal/scale';
|
|
19
|
+
|
|
20
|
+
export type ChartType = 'line' | 'area' | 'bar';
|
|
21
|
+
export type SeriesSlot = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
22
|
+
|
|
23
|
+
export interface SeriesInput {
|
|
24
|
+
/** Stable id (used for colors, toggles and DOM). Defaults to a slug of the label. */
|
|
25
|
+
id?: string;
|
|
26
|
+
label: string;
|
|
27
|
+
/** One value per x position; null/undefined is a gap. */
|
|
28
|
+
values: Array<number | null | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Color slot 1–8 from the validated categorical palette. Defaults to the series' position, so a
|
|
31
|
+
* series keeps its color when others are filtered out only if you pass `slot` explicitly.
|
|
32
|
+
*/
|
|
33
|
+
slot?: SeriesSlot;
|
|
34
|
+
/** De-emphasize (gray): for "Other", targets, or everything but the series the story is about. */
|
|
35
|
+
muted?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ChartInput {
|
|
39
|
+
type: ChartType;
|
|
40
|
+
/**
|
|
41
|
+
* Categories ("Q1", "Fort Worth", 2024) or dates (Date or ISO string). Numbers are categories
|
|
42
|
+
* (years plot as "2024", not as milliseconds); they're read as timestamps only with `xType: 'time'`.
|
|
43
|
+
*/
|
|
44
|
+
x: Array<string | number | Date>;
|
|
45
|
+
/** `time` positions points by date; `category` spaces them evenly. Auto: time for dates on line/area. */
|
|
46
|
+
xType?: 'category' | 'time';
|
|
47
|
+
xTitle?: string;
|
|
48
|
+
yTitle?: string;
|
|
49
|
+
series: SeriesInput[];
|
|
50
|
+
/** How values print on the axis, tooltip and table. */
|
|
51
|
+
yFormat?: ValueFormat;
|
|
52
|
+
/** Force the y range (otherwise nice bounds around the data). */
|
|
53
|
+
yMin?: number;
|
|
54
|
+
yMax?: number;
|
|
55
|
+
/** Include zero in the y range. Default: always for bars; for lines when the data is near zero. */
|
|
56
|
+
yZero?: boolean;
|
|
57
|
+
/** About how many y ticks (default 5). */
|
|
58
|
+
yTicks?: number;
|
|
59
|
+
/** Stack bars or areas. */
|
|
60
|
+
stacked?: boolean;
|
|
61
|
+
locale?: string;
|
|
62
|
+
/** DOM id prefix (stable ids for aria references). */
|
|
63
|
+
id?: string;
|
|
64
|
+
/** What the chart shows ("site visits"), used in the screen-reader summary. */
|
|
65
|
+
subject?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface XTick {
|
|
69
|
+
pct: number;
|
|
70
|
+
label: string;
|
|
71
|
+
/** Largest power of two (≤16) dividing this tick's index: lets CSS thin labels by density. */
|
|
72
|
+
tier: 1 | 2 | 4 | 8 | 16;
|
|
73
|
+
anchor: 'start' | 'middle' | 'end';
|
|
74
|
+
}
|
|
75
|
+
export interface YTick {
|
|
76
|
+
pct: number;
|
|
77
|
+
value: number;
|
|
78
|
+
label: string;
|
|
79
|
+
}
|
|
80
|
+
export interface PointModel {
|
|
81
|
+
index: number;
|
|
82
|
+
xPct: number;
|
|
83
|
+
yPct: number;
|
|
84
|
+
value: number;
|
|
85
|
+
display: string;
|
|
86
|
+
}
|
|
87
|
+
export interface BarModel {
|
|
88
|
+
index: number;
|
|
89
|
+
/** Band center, percent from the left. */
|
|
90
|
+
xPct: number;
|
|
91
|
+
topPct: number;
|
|
92
|
+
bottomPct: number;
|
|
93
|
+
/** Which end is rounded (the data end); `none` for inner stacked segments. */
|
|
94
|
+
rounded: 'top' | 'bottom' | 'none';
|
|
95
|
+
/** Position within a group: -1.5 … 1.5 bar widths from the band center ("0" when stacked). */
|
|
96
|
+
offset: string;
|
|
97
|
+
value: number;
|
|
98
|
+
display: string;
|
|
99
|
+
}
|
|
100
|
+
export interface SeriesModel {
|
|
101
|
+
id: string;
|
|
102
|
+
label: string;
|
|
103
|
+
slot: SeriesSlot;
|
|
104
|
+
muted: boolean;
|
|
105
|
+
points: Array<PointModel | null>;
|
|
106
|
+
/** Paths in a 0–1000 viewBox (drawn with non-scaling strokes). */
|
|
107
|
+
linePath: string;
|
|
108
|
+
areaPath: string;
|
|
109
|
+
bars: BarModel[];
|
|
110
|
+
last?: PointModel;
|
|
111
|
+
}
|
|
112
|
+
export interface HitModel {
|
|
113
|
+
index: number;
|
|
114
|
+
/** Hit band, percent from the left. */
|
|
115
|
+
fromPct: number;
|
|
116
|
+
toPct: number;
|
|
117
|
+
/** Crosshair / band center. */
|
|
118
|
+
xPct: number;
|
|
119
|
+
label: string;
|
|
120
|
+
rows: Array<{ series: string; label: string; slot: SeriesSlot; display: string; yPct?: number }>;
|
|
121
|
+
total?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ChartModel {
|
|
125
|
+
id: string;
|
|
126
|
+
type: ChartType;
|
|
127
|
+
stacked: boolean;
|
|
128
|
+
xType: 'category' | 'time';
|
|
129
|
+
xTitle?: string;
|
|
130
|
+
yTitle?: string;
|
|
131
|
+
locale: string;
|
|
132
|
+
yMin: number;
|
|
133
|
+
yMax: number;
|
|
134
|
+
baselinePct: number;
|
|
135
|
+
xTicks: XTick[];
|
|
136
|
+
/** Show every Nth label at each container size (xs <24rem, sm <36rem, md <52rem, lg). */
|
|
137
|
+
xSteps: { xs: number; sm: number; md: number; lg: number };
|
|
138
|
+
yTicks: YTick[];
|
|
139
|
+
/** Width of the y-axis label column, in ch. */
|
|
140
|
+
yLabelCh: number;
|
|
141
|
+
series: SeriesModel[];
|
|
142
|
+
/** Max bar thickness as a % of the plot width (CSS caps it at 24px). */
|
|
143
|
+
barPct: number;
|
|
144
|
+
hits: HitModel[];
|
|
145
|
+
summary: string;
|
|
146
|
+
table: { headers: string[]; rows: string[][]; csv: string };
|
|
147
|
+
warnings: string[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const slugify = (s: string) =>
|
|
151
|
+
s
|
|
152
|
+
.toLowerCase()
|
|
153
|
+
.normalize('NFKD')
|
|
154
|
+
.replace(/[̀-ͯ]/g, '')
|
|
155
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
156
|
+
.replace(/^-|-$/g, '') || 's';
|
|
157
|
+
let counter = 0;
|
|
158
|
+
const r2 = (v: number) => Math.round(v * 100) / 100;
|
|
159
|
+
|
|
160
|
+
function toTime(v: string | number | Date): number | undefined {
|
|
161
|
+
if (v instanceof Date) return v.getTime();
|
|
162
|
+
if (typeof v === 'number') return v;
|
|
163
|
+
if (/^\d{4}-\d{2}(-\d{2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/.test(v)) {
|
|
164
|
+
const t = Date.parse(v.length === 7 ? `${v}-01` : v);
|
|
165
|
+
return Number.isFinite(t) ? t : undefined;
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const TIERS = [16, 8, 4, 2, 1] as const;
|
|
171
|
+
const tierOf = (i: number): XTick['tier'] => (i === 0 ? 16 : TIERS.find((k) => i % k === 0) ?? 1);
|
|
172
|
+
/** Plot widths (px) assumed for each container size when thinning x labels. */
|
|
173
|
+
const PLOT_WIDTH = { xs: 240, sm: 380, md: 600, lg: 880 } as const;
|
|
174
|
+
|
|
175
|
+
export function defineChart(input: ChartInput): ChartModel {
|
|
176
|
+
const warnings: string[] = [];
|
|
177
|
+
const locale = input.locale ?? 'en-US';
|
|
178
|
+
const type = input.type;
|
|
179
|
+
const stacked = Boolean(input.stacked) && type !== 'line';
|
|
180
|
+
const n = input.x.length;
|
|
181
|
+
const id = input.id ?? `sinn-chart-${++counter}`;
|
|
182
|
+
// Values (tooltip, table, summary) are exact: never compact, and whole-dollar data shows no cents,
|
|
183
|
+
// so one column never mixes "$9,000.00" with "$23.4K". Only the axis abbreviates (see tickSpec).
|
|
184
|
+
const exactSpec: ValueFormat = (() => {
|
|
185
|
+
const base = input.yFormat ?? 'number';
|
|
186
|
+
const spec = (typeof base === 'string' ? { kind: base } : { ...base }) as ValueFormat & { kind: string; compact?: unknown; digits?: number };
|
|
187
|
+
if (spec.compact !== true) spec.compact = false;
|
|
188
|
+
if (spec.kind === 'compact' && spec.compact === false) spec.kind = 'number';
|
|
189
|
+
const allWhole = input.series.every((s) => s.values.every((v) => v === null || v === undefined || Number.isInteger(v)));
|
|
190
|
+
if (spec.kind === 'currency' && spec.digits === undefined && allWhole) spec.digits = 0;
|
|
191
|
+
return spec;
|
|
192
|
+
})();
|
|
193
|
+
const fmtY = (v: number | null | undefined, spec: ValueFormat = exactSpec) => formatValue(v, spec, locale);
|
|
194
|
+
|
|
195
|
+
// ---------- x ----------
|
|
196
|
+
const times = input.x.map(toTime);
|
|
197
|
+
// Auto-detection skips numbers: x: [2019, 2020] are years (categories), not ms since 1970.
|
|
198
|
+
const canTime = type !== 'bar' && times.every((t) => t !== undefined) && (input.xType === 'time' || !input.x.some((v) => typeof v === 'number'));
|
|
199
|
+
const xType = input.xType === 'category' ? 'category' : input.xType === 'time' || canTime ? (canTime ? 'time' : 'category') : 'category';
|
|
200
|
+
if (input.xType === 'time' && !canTime) warnings.push('xType "time" needs dates for every x value (or bars, which are always categories); using categories.');
|
|
201
|
+
const granularity = xType === 'time' ? dataGranularity(times as number[]) : undefined;
|
|
202
|
+
const tMin = xType === 'time' ? Math.min(...(times as number[])) : 0;
|
|
203
|
+
const tMax = xType === 'time' ? Math.max(...(times as number[])) : 0;
|
|
204
|
+
const xLabelFull = (i: number) => (xType === 'time' ? timeFullLabel(times[i]!, granularity!, locale) : String(input.x[i]));
|
|
205
|
+
const xPos = (i: number) => {
|
|
206
|
+
if (type === 'bar') return r2(((i + 0.5) / n) * 100);
|
|
207
|
+
if (xType === 'time') return xp(times[i]!, tMin, tMax);
|
|
208
|
+
return n === 1 ? 50 : r2((i / (n - 1)) * 100);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// ---------- series ----------
|
|
212
|
+
if (input.series.length > 8) warnings.push(`${input.series.length} series: past 8 the palette can't keep them apart. Fold the smallest into "Other".`);
|
|
213
|
+
const usedIds = new Set<string>();
|
|
214
|
+
const series = input.series.map((s, i) => {
|
|
215
|
+
let sid = s.id ?? slugify(s.label);
|
|
216
|
+
while (usedIds.has(sid)) sid += '-2';
|
|
217
|
+
usedIds.add(sid);
|
|
218
|
+
if (s.values.length !== n) warnings.push(`Series "${s.label}" has ${s.values.length} values for ${n} x positions.`);
|
|
219
|
+
const slot = (s.slot ?? (((i % 8) + 1) as SeriesSlot)) as SeriesSlot;
|
|
220
|
+
return { ...s, id: sid, slot, muted: Boolean(s.muted), values: Array.from({ length: n }, (_, k) => (typeof s.values[k] === 'number' && Number.isFinite(s.values[k]) ? (s.values[k] as number) : null)) };
|
|
221
|
+
});
|
|
222
|
+
const slots = series.filter((s) => !s.muted).map((s) => s.slot);
|
|
223
|
+
if (new Set(slots).size !== slots.length) warnings.push('Two series share a color slot.');
|
|
224
|
+
|
|
225
|
+
// ---------- y domain ----------
|
|
226
|
+
let lo = Infinity;
|
|
227
|
+
let hi = -Infinity;
|
|
228
|
+
if (stacked) {
|
|
229
|
+
for (let k = 0; k < n; k++) {
|
|
230
|
+
let pos = 0;
|
|
231
|
+
let neg = 0;
|
|
232
|
+
for (const s of series) {
|
|
233
|
+
const v = s.values[k];
|
|
234
|
+
if (v === null) continue;
|
|
235
|
+
if (v >= 0) pos += v;
|
|
236
|
+
else neg += v;
|
|
237
|
+
}
|
|
238
|
+
hi = Math.max(hi, pos);
|
|
239
|
+
lo = Math.min(lo, neg);
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
for (const s of series) for (const v of s.values) if (v !== null) (lo = Math.min(lo, v)), (hi = Math.max(hi, v));
|
|
243
|
+
}
|
|
244
|
+
if (!Number.isFinite(lo)) {
|
|
245
|
+
lo = 0;
|
|
246
|
+
hi = 1;
|
|
247
|
+
warnings.push('No numeric values to plot.');
|
|
248
|
+
}
|
|
249
|
+
const includeZero = input.yZero ?? (type !== 'line' || lo <= 0 || lo < hi * 0.35);
|
|
250
|
+
if (type === 'bar' && input.yZero === false) warnings.push('Bars must start at zero (their length is the value); ignoring yZero: false.');
|
|
251
|
+
if (type !== 'line' || includeZero) {
|
|
252
|
+
lo = Math.min(lo, 0);
|
|
253
|
+
hi = Math.max(hi, 0);
|
|
254
|
+
}
|
|
255
|
+
const dom = niceDomain(input.yMin ?? lo, input.yMax ?? hi, input.yTicks ?? 5);
|
|
256
|
+
const yMin = input.yMin ?? dom.min;
|
|
257
|
+
const yMax = input.yMax ?? dom.max;
|
|
258
|
+
const axisCompact = Math.max(Math.abs(yMin), Math.abs(yMax)) >= 10_000;
|
|
259
|
+
const tickSpec: ValueFormat = (() => {
|
|
260
|
+
const base = input.yFormat ?? 'number';
|
|
261
|
+
const spec = typeof base === 'string' ? { kind: base } : { ...base };
|
|
262
|
+
if (spec.kind === 'number' || spec.kind === 'integer' || spec.kind === 'currency' || spec.kind === 'compact') (spec as { compact?: boolean }).compact = axisCompact;
|
|
263
|
+
if (spec.kind === 'integer') spec.kind = 'number';
|
|
264
|
+
// Fewest decimals that keep every tick exact: "$400K", "2.5K", "$1.25M" (never "$400.0K").
|
|
265
|
+
if ((spec as { digits?: number }).digits === undefined && (axisCompact || spec.kind === 'number' || spec.kind === 'currency')) {
|
|
266
|
+
const need = (v: number) => {
|
|
267
|
+
const a = Math.abs(v);
|
|
268
|
+
const unit = axisCompact && a >= 1000 ? 1000 ** Math.floor(Math.log10(a) / 3) : 1;
|
|
269
|
+
const r = Math.round((a / unit) * 100) / 100;
|
|
270
|
+
return r === Math.round(r) ? 0 : Math.round(r * 10) === r * 10 ? 1 : 2;
|
|
271
|
+
};
|
|
272
|
+
(spec as { digits?: number }).digits = Math.max(0, ...dom.ticks.map(need));
|
|
273
|
+
}
|
|
274
|
+
return spec as ValueFormat;
|
|
275
|
+
})();
|
|
276
|
+
const yTicks: YTick[] = dom.ticks.filter((v) => v >= yMin - 1e-9 && v <= yMax + 1e-9).map((v) => ({ value: v, pct: yp(v, yMin, yMax), label: fmtY(v, tickSpec) }));
|
|
277
|
+
const baseline = Math.min(Math.max(0, yMin), yMax);
|
|
278
|
+
const baselinePct = yp(baseline, yMin, yMax);
|
|
279
|
+
const Y = (v: number) => yp(v, yMin, yMax);
|
|
280
|
+
|
|
281
|
+
// ---------- marks ----------
|
|
282
|
+
const visibleCount = series.length;
|
|
283
|
+
const groupSize = type === 'bar' && !stacked ? visibleCount : 1;
|
|
284
|
+
const band = 100 / Math.max(1, n);
|
|
285
|
+
const barPct = Math.max(1, Math.min(60, Math.floor((band * 0.72) / Math.max(1, groupSize))));
|
|
286
|
+
const stackPos = new Array(n).fill(0);
|
|
287
|
+
const stackNeg = new Array(n).fill(0);
|
|
288
|
+
const offsets = ['-1.5', '-1', '-0.5', '0', '0.5', '1', '1.5'];
|
|
289
|
+
if (groupSize > 4) warnings.push('More than 4 grouped bars per category: consider stacking or small multiples.');
|
|
290
|
+
|
|
291
|
+
const models: SeriesModel[] = series.map((s, si) => {
|
|
292
|
+
const points: Array<PointModel | null> = [];
|
|
293
|
+
const bars: BarModel[] = [];
|
|
294
|
+
const base: number[] = [];
|
|
295
|
+
for (let k = 0; k < n; k++) {
|
|
296
|
+
const v = s.values[k];
|
|
297
|
+
if (v === null) {
|
|
298
|
+
points.push(null);
|
|
299
|
+
base.push(NaN);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
let top = v;
|
|
303
|
+
let bottom = 0;
|
|
304
|
+
if (stacked) {
|
|
305
|
+
if (v >= 0) {
|
|
306
|
+
bottom = stackPos[k];
|
|
307
|
+
top = stackPos[k] += v;
|
|
308
|
+
} else {
|
|
309
|
+
bottom = stackNeg[k];
|
|
310
|
+
top = stackNeg[k] += v;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
base.push(stacked ? bottom : baseline);
|
|
314
|
+
points.push({ index: k, xPct: xPos(k), yPct: Y(top), value: v, display: fmtY(v) });
|
|
315
|
+
if (type === 'bar') {
|
|
316
|
+
const offset = stacked ? '0' : offsets[Math.max(0, Math.min(6, Math.round((si - (groupSize - 1) / 2) * 2) + 3))];
|
|
317
|
+
bars.push({ index: k, xPct: xPos(k), topPct: Y(Math.max(top, bottom)), bottomPct: Y(Math.min(top, bottom)), rounded: 'none', offset, value: v, display: fmtY(v) });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
// Lines/areas: break at gaps.
|
|
321
|
+
let linePath = '';
|
|
322
|
+
let areaPath = '';
|
|
323
|
+
let run: Array<[number, number, number]> = [];
|
|
324
|
+
const flush = () => {
|
|
325
|
+
if (!run.length) return;
|
|
326
|
+
linePath += run.map(([x, y], j) => `${j ? 'L' : 'M'}${r2(x * 10)} ${r2(y * 10)}`).join('');
|
|
327
|
+
const back = [...run].reverse().map(([x, , b]) => `L${r2(x * 10)} ${r2(Y(b) * 10)}`).join('');
|
|
328
|
+
areaPath += `M${r2(run[0][0] * 10)} ${r2(run[0][1] * 10)}${run.slice(1).map(([x, y]) => `L${r2(x * 10)} ${r2(y * 10)}`).join('')}${back}Z`;
|
|
329
|
+
run = [];
|
|
330
|
+
};
|
|
331
|
+
points.forEach((p, k) => (p ? run.push([p.xPct, p.yPct, base[k]]) : flush()));
|
|
332
|
+
flush();
|
|
333
|
+
const last = [...points].reverse().find(Boolean) ?? undefined;
|
|
334
|
+
return { id: s.id, label: s.label, slot: s.slot, muted: s.muted, points, linePath, areaPath, bars, last: last ?? undefined };
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// Rounded data ends: grouped bars each; stacked bars only the outermost segment per side.
|
|
338
|
+
if (type === 'bar') {
|
|
339
|
+
for (let k = 0; k < n; k++) {
|
|
340
|
+
if (!stacked) {
|
|
341
|
+
for (const m of models) {
|
|
342
|
+
const b = m.bars.find((x) => x.index === k);
|
|
343
|
+
if (b) b.rounded = b.value >= 0 ? 'top' : 'bottom';
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
const segs = models.map((m) => m.bars.find((x) => x.index === k)).filter(Boolean) as BarModel[];
|
|
347
|
+
const posTop = segs.filter((b) => b.value > 0).sort((a, b) => a.topPct - b.topPct)[0];
|
|
348
|
+
const negBot = segs.filter((b) => b.value < 0).sort((a, b) => b.bottomPct - a.bottomPct)[0];
|
|
349
|
+
if (posTop) posTop.rounded = 'top';
|
|
350
|
+
if (negBot) negBot.rounded = 'bottom';
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// ---------- x ticks ----------
|
|
356
|
+
let xTicks: XTick[];
|
|
357
|
+
if (xType === 'time') {
|
|
358
|
+
const { ticks, unit } = timeTicks(tMin, tMax, 8);
|
|
359
|
+
xTicks = ticks.map((t, i) => ({ pct: xp(t, tMin, tMax), label: timeTickLabel(t, unit, locale, ticks[i - 1]), tier: tierOf(i), anchor: 'middle' as const }));
|
|
360
|
+
} else {
|
|
361
|
+
xTicks = input.x.map((v, i) => ({ pct: xPos(i), label: String(v), tier: tierOf(i), anchor: 'middle' as const }));
|
|
362
|
+
}
|
|
363
|
+
// Labels at the very edges would hang outside the plot: anchor them inward. Lines: at the ends.
|
|
364
|
+
// Narrow bar bands (many categories): the first/last label starts/ends at the plot edge, still
|
|
365
|
+
// under its own band, instead of spilling into the y-axis gutter on small screens.
|
|
366
|
+
for (const t of xTicks) {
|
|
367
|
+
if (type !== 'bar' && t.pct <= 1) t.anchor = 'start';
|
|
368
|
+
if (type !== 'bar' && t.pct >= 99) t.anchor = 'end';
|
|
369
|
+
if (type === 'bar' && t.pct < 5) Object.assign(t, { anchor: 'start', pct: 0 });
|
|
370
|
+
if (type === 'bar' && t.pct > 95) Object.assign(t, { anchor: 'end', pct: 100 });
|
|
371
|
+
}
|
|
372
|
+
const maxChars = Math.max(1, ...xTicks.map((t) => t.label.length));
|
|
373
|
+
const labelPx = maxChars * 7 + 14;
|
|
374
|
+
const stepFor = (w: number) => [1, 2, 4, 8, 16].find((k) => Math.ceil(xTicks.length / k) * labelPx <= w) ?? 16;
|
|
375
|
+
const xSteps = { xs: stepFor(PLOT_WIDTH.xs), sm: stepFor(PLOT_WIDTH.sm), md: stepFor(PLOT_WIDTH.md), lg: stepFor(PLOT_WIDTH.lg) };
|
|
376
|
+
|
|
377
|
+
// ---------- hits (tooltip bands) ----------
|
|
378
|
+
const hits: HitModel[] = [];
|
|
379
|
+
for (let k = 0; k < n; k++) {
|
|
380
|
+
const x = xPos(k);
|
|
381
|
+
let fromPct: number;
|
|
382
|
+
let toPct: number;
|
|
383
|
+
if (type === 'bar') {
|
|
384
|
+
fromPct = r2(k * band);
|
|
385
|
+
toPct = r2((k + 1) * band);
|
|
386
|
+
} else {
|
|
387
|
+
const prev = k > 0 ? xPos(k - 1) : x;
|
|
388
|
+
const next = k < n - 1 ? xPos(k + 1) : x;
|
|
389
|
+
fromPct = k === 0 ? 0 : r2((prev + x) / 2);
|
|
390
|
+
toPct = k === n - 1 ? 100 : r2((x + next) / 2);
|
|
391
|
+
}
|
|
392
|
+
const rows = models
|
|
393
|
+
.map((m) => ({ series: m.id, label: m.label, slot: m.slot, display: fmtY(series.find((s) => s.id === m.id)!.values[k]), yPct: m.points[k]?.yPct }))
|
|
394
|
+
.filter((r) => r.display !== '—' || type !== 'bar');
|
|
395
|
+
const vals = series.map((s) => s.values[k]).filter((v): v is number => v !== null);
|
|
396
|
+
hits.push({ index: k, fromPct, toPct, xPct: x, label: xLabelFull(k), rows, total: stacked && vals.length > 1 ? fmtY(vals.reduce((a, b) => a + b, 0)) : undefined });
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// ---------- summary ----------
|
|
400
|
+
const kind = type === 'bar' ? (stacked ? 'Stacked bar chart' : 'Bar chart') : type === 'area' ? (stacked ? 'Stacked area chart' : 'Area chart') : 'Line chart';
|
|
401
|
+
const names = series.map((s) => s.label);
|
|
402
|
+
const list = names.length <= 1 ? names.join('') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
|
|
403
|
+
const range = n ? `${xLabelFull(0)} to ${xLabelFull(n - 1)}` : '';
|
|
404
|
+
const parts = [`${kind}${input.subject ? ` of ${input.subject}` : list ? ` of ${list}` : ''}${n > 1 ? `, ${range}` : ''}.`];
|
|
405
|
+
for (const s of series.slice(0, 4)) {
|
|
406
|
+
const idx = s.values.map((v, k) => [v, k] as const).filter(([v]) => v !== null) as Array<readonly [number, number]>;
|
|
407
|
+
if (!idx.length) continue;
|
|
408
|
+
const max = idx.reduce((a, b) => (b[0] > a[0] ? b : a));
|
|
409
|
+
const min = idx.reduce((a, b) => (b[0] < a[0] ? b : a));
|
|
410
|
+
const lastP = idx[idx.length - 1];
|
|
411
|
+
const who = series.length > 1 ? `${s.label}: ` : '';
|
|
412
|
+
const cap = (t: string) => (who ? t : t.charAt(0).toUpperCase() + t.slice(1));
|
|
413
|
+
parts.push(
|
|
414
|
+
type === 'bar'
|
|
415
|
+
? `${who}${cap('highest')} ${xLabelFull(max[1])} (${fmtY(max[0])}), lowest ${xLabelFull(min[1])} (${fmtY(min[0])}).`
|
|
416
|
+
: `${who}${cap('from')} ${fmtY(idx[0][0])} to ${fmtY(lastP[0])}; high ${fmtY(max[0])} (${xLabelFull(max[1])}), low ${fmtY(min[0])} (${xLabelFull(min[1])}).`,
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
if (series.length > 4) parts.push(`${series.length - 4} more series in the data table.`);
|
|
420
|
+
|
|
421
|
+
// ---------- table ----------
|
|
422
|
+
const xHeader = input.xTitle ?? (xType === 'time' ? 'Date' : 'Category');
|
|
423
|
+
const headers = [xHeader, ...series.map((s) => s.label)];
|
|
424
|
+
const rows = Array.from({ length: n }, (_, k) => [xLabelFull(k), ...series.map((s) => fmtY(s.values[k]))]);
|
|
425
|
+
// Text cells that start like a formula (=, +, -, @) get a leading ' so spreadsheets show them as
|
|
426
|
+
// text instead of running them (CSV injection). Series values are numbers, written as they are.
|
|
427
|
+
const csvCell = (raw: string) => {
|
|
428
|
+
const v = /^[=+\-@\t\r]/.test(raw) ? `'${raw}` : raw;
|
|
429
|
+
return /[",\r\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
|
|
430
|
+
};
|
|
431
|
+
const rawX = (k: number) => (xType === 'time' ? new Date(times[k]!).toISOString().slice(0, granularity === 'day' ? 10 : granularity === 'month' ? 7 : 4) : String(input.x[k]));
|
|
432
|
+
const csv = [headers.map(csvCell).join(','), ...Array.from({ length: n }, (_, k) => [csvCell(rawX(k)), ...series.map((s) => (s.values[k] === null ? '' : String(s.values[k])))].join(','))].join('\n');
|
|
433
|
+
|
|
434
|
+
// Gutter width in `ch` (digit widths): wide glyphs (%, letters, minus) count for more, separators less.
|
|
435
|
+
const glyphCh = (c: string) => (/[0-9 ]/.test(c) ? 1 : /[.,:'’]/.test(c) ? 0.45 : c === '%' ? 1.6 : /[A-ZÀ-Ý$€£¥−\-+]/.test(c) ? 1.25 : 1.1);
|
|
436
|
+
const yLabelCh = Math.min(14, Math.max(2, ...yTicks.map((t) => Math.ceil([...t.label].reduce((a, c) => a + glyphCh(c), 0)))));
|
|
437
|
+
return {
|
|
438
|
+
id,
|
|
439
|
+
type,
|
|
440
|
+
stacked,
|
|
441
|
+
xType,
|
|
442
|
+
xTitle: input.xTitle,
|
|
443
|
+
yTitle: input.yTitle,
|
|
444
|
+
locale,
|
|
445
|
+
yMin,
|
|
446
|
+
yMax,
|
|
447
|
+
baselinePct,
|
|
448
|
+
xTicks,
|
|
449
|
+
xSteps,
|
|
450
|
+
yTicks,
|
|
451
|
+
yLabelCh,
|
|
452
|
+
series: models,
|
|
453
|
+
barPct,
|
|
454
|
+
hits,
|
|
455
|
+
summary: parts.join(' '),
|
|
456
|
+
table: { headers, rows, csv },
|
|
457
|
+
warnings,
|
|
458
|
+
};
|
|
459
|
+
}
|