goro-charts 1.0.0 → 1.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 +113 -0
- package/README.md +46 -19
- package/dist/charts/chart-base.d.ts +80 -17
- package/dist/data/series-store.d.ts +25 -2
- package/dist/defaults.d.ts +2 -2
- package/dist/goro-charts.js +229 -121
- package/dist/goro-charts.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +23 -4
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export { LineChart } from './charts/line-chart.js';
|
|
|
9
9
|
export { AreaChart } from './charts/area-chart.js';
|
|
10
10
|
export { ScatterChart } from './charts/scatter-chart.js';
|
|
11
11
|
export { DARK, LIGHT } from './presets.js';
|
|
12
|
-
export type { ChartOpts, SeriesConfig } from './types.js';
|
|
12
|
+
export type { ChartOpts, SeriesConfig, DataOwnership } from './types.js';
|
|
13
13
|
export type { SeriesHit } from './render/crosshair.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
* contract the renderers depend on instead of the concrete data store — it
|
|
8
8
|
* decouples `render/` from `data/` so either can change independently.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* Data-array ownership for snapshot mode (`setData`).
|
|
12
|
+
*
|
|
13
|
+
* - `'copy'` (default): the store copies the caller's arrays into fresh buffers;
|
|
14
|
+
* the caller may mutate the originals freely without affecting the chart.
|
|
15
|
+
* - `'borrowed'`: the store keeps the caller's arrays by reference — the caller
|
|
16
|
+
* **must** treat them as immutable for as long as the chart holds them. The
|
|
17
|
+
* arrays are read-only to the chart; mutating them externally leads to
|
|
18
|
+
* undefined behaviour.
|
|
19
|
+
*/
|
|
20
|
+
export type DataOwnership = 'copy' | 'borrowed';
|
|
10
21
|
/** Per-series visual configuration. */
|
|
11
22
|
export interface SeriesConfig {
|
|
12
23
|
/** Display name for legends and the crosshair tooltip. */
|
|
@@ -79,12 +90,14 @@ export interface ChartOpts {
|
|
|
79
90
|
autoDraw?: boolean;
|
|
80
91
|
/**
|
|
81
92
|
* Fixed Y-axis lower bound. When set the grid domain is pinned to this
|
|
82
|
-
* value instead of auto-expanding from data.
|
|
93
|
+
* value instead of auto-expanding from data. `undefined` (default) = auto.
|
|
94
|
+
* Pair with {@link yMax}.
|
|
83
95
|
*/
|
|
84
96
|
yMin?: number;
|
|
85
97
|
/**
|
|
86
98
|
* Fixed Y-axis upper bound. When set the grid domain is pinned to this
|
|
87
|
-
* value instead of auto-expanding from data.
|
|
99
|
+
* value instead of auto-expanding from data. `undefined` (default) = auto.
|
|
100
|
+
* Pair with {@link yMin}.
|
|
88
101
|
*/
|
|
89
102
|
yMax?: number;
|
|
90
103
|
/**
|
|
@@ -93,8 +106,14 @@ export interface ChartOpts {
|
|
|
93
106
|
*/
|
|
94
107
|
maxDots?: number;
|
|
95
108
|
}
|
|
96
|
-
/** Fully-resolved options (every field present).
|
|
97
|
-
|
|
109
|
+
/** Fully-resolved options (every field present).
|
|
110
|
+
*
|
|
111
|
+
* `yMin` and `yMax` are `number | undefined` because `undefined` is the
|
|
112
|
+
* sentinel for "auto" domain — `0` is a legitimate fixed bound. */
|
|
113
|
+
export type ResolvedOpts = Required<Omit<ChartOpts, 'yMin' | 'yMax'>> & {
|
|
114
|
+
yMin: number | undefined;
|
|
115
|
+
yMax: number | undefined;
|
|
116
|
+
};
|
|
98
117
|
/** Plot area rectangle in CSS pixels, padding already applied. */
|
|
99
118
|
export interface PlotRect {
|
|
100
119
|
/** Left edge (x of the plot origin). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goro-charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Minimal high-performance line and area chart engine. Canvas 2D, zero dependencies, framework-agnostic.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"preview:demo": "vite preview --config vite.demo.config.ts",
|
|
56
56
|
"prepublishOnly": "npm run build",
|
|
57
57
|
"fix:all": "eslint --fix . && prettier --write .",
|
|
58
|
+
"check:readme": "node scripts/check-readme.mjs",
|
|
58
59
|
"test": "vitest run",
|
|
59
60
|
"test:watch": "vitest",
|
|
60
61
|
"test:ui": "vitest --ui",
|