sferic-charts 0.0.0-stage → 0.2.1

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.
Files changed (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +201 -2
  3. package/dist/sferic.js +16116 -0
  4. package/dist/sferic.js.map +1 -0
  5. package/dist/sferic.umd.cjs +1149 -0
  6. package/dist/sferic.umd.cjs.map +1 -0
  7. package/dist/types/bar/BarChart.d.cts +249 -0
  8. package/dist/types/bar/BarChart.d.ts +249 -0
  9. package/dist/types/bar/index.d.cts +1 -0
  10. package/dist/types/bar/index.d.ts +1 -0
  11. package/dist/types/chart3d/Axis3D.d.cts +97 -0
  12. package/dist/types/chart3d/Axis3D.d.ts +97 -0
  13. package/dist/types/chart3d/Chart3D.d.cts +154 -0
  14. package/dist/types/chart3d/Chart3D.d.ts +154 -0
  15. package/dist/types/chart3d/gl3d.d.cts +78 -0
  16. package/dist/types/chart3d/gl3d.d.ts +78 -0
  17. package/dist/types/chart3d/index.d.cts +13 -0
  18. package/dist/types/chart3d/index.d.ts +13 -0
  19. package/dist/types/chart3d/math3d.d.cts +15 -0
  20. package/dist/types/chart3d/math3d.d.ts +15 -0
  21. package/dist/types/chart3d/mesh3d.d.cts +127 -0
  22. package/dist/types/chart3d/mesh3d.d.ts +127 -0
  23. package/dist/types/chart3d/series3d.d.cts +168 -0
  24. package/dist/types/chart3d/series3d.d.ts +168 -0
  25. package/dist/types/chart3d/shaders3d.d.cts +17 -0
  26. package/dist/types/chart3d/shaders3d.d.ts +17 -0
  27. package/dist/types/chart3d/store3d.d.cts +81 -0
  28. package/dist/types/chart3d/store3d.d.ts +81 -0
  29. package/dist/types/chart3d/styles3d.d.cts +81 -0
  30. package/dist/types/chart3d/styles3d.d.ts +81 -0
  31. package/dist/types/chart3d/surface3d.d.cts +159 -0
  32. package/dist/types/chart3d/surface3d.d.ts +159 -0
  33. package/dist/types/core/Legend.d.cts +90 -0
  34. package/dist/types/core/Legend.d.ts +90 -0
  35. package/dist/types/core/Panel.d.cts +197 -0
  36. package/dist/types/core/Panel.d.ts +197 -0
  37. package/dist/types/core/color.d.cts +38 -0
  38. package/dist/types/core/color.d.ts +38 -0
  39. package/dist/types/core/style.d.cts +184 -0
  40. package/dist/types/core/style.d.ts +184 -0
  41. package/dist/types/core/theme.d.cts +87 -0
  42. package/dist/types/core/theme.d.ts +87 -0
  43. package/dist/types/core/util.d.cts +52 -0
  44. package/dist/types/core/util.d.ts +52 -0
  45. package/dist/types/dashboard/Dashboard.d.cts +98 -0
  46. package/dist/types/dashboard/Dashboard.d.ts +98 -0
  47. package/dist/types/dashboard/UIPanel.d.cts +10 -0
  48. package/dist/types/dashboard/UIPanel.d.ts +10 -0
  49. package/dist/types/datagrid/DataGrid.d.cts +160 -0
  50. package/dist/types/datagrid/DataGrid.d.ts +160 -0
  51. package/dist/types/datagrid/index.d.cts +1 -0
  52. package/dist/types/datagrid/index.d.ts +1 -0
  53. package/dist/types/hierarchy/SunburstChart.d.cts +96 -0
  54. package/dist/types/hierarchy/SunburstChart.d.ts +96 -0
  55. package/dist/types/hierarchy/TreeMapChart.d.cts +113 -0
  56. package/dist/types/hierarchy/TreeMapChart.d.ts +113 -0
  57. package/dist/types/hierarchy/common.d.cts +116 -0
  58. package/dist/types/hierarchy/common.d.ts +116 -0
  59. package/dist/types/hierarchy/index.d.cts +4 -0
  60. package/dist/types/hierarchy/index.d.ts +4 -0
  61. package/dist/types/hierarchy/shaders.d.cts +9 -0
  62. package/dist/types/hierarchy/shaders.d.ts +9 -0
  63. package/dist/types/index.d.cts +37 -0
  64. package/dist/types/index.d.ts +37 -0
  65. package/dist/types/lc.d.cts +49 -0
  66. package/dist/types/lc.d.ts +49 -0
  67. package/dist/types/map/MapChart.d.cts +172 -0
  68. package/dist/types/map/MapChart.d.ts +172 -0
  69. package/dist/types/map/index.d.cts +6 -0
  70. package/dist/types/map/index.d.ts +6 -0
  71. package/dist/types/map/iso.d.cts +2 -0
  72. package/dist/types/map/iso.d.ts +2 -0
  73. package/dist/types/map/projection.d.cts +12 -0
  74. package/dist/types/map/projection.d.ts +12 -0
  75. package/dist/types/map/topojson.d.cts +43 -0
  76. package/dist/types/map/topojson.d.ts +43 -0
  77. package/dist/types/map/triangulate.d.cts +5 -0
  78. package/dist/types/map/triangulate.d.ts +5 -0
  79. package/dist/types/parallel/ParallelCoordinateChart.d.cts +245 -0
  80. package/dist/types/parallel/ParallelCoordinateChart.d.ts +245 -0
  81. package/dist/types/parallel/index.d.cts +1 -0
  82. package/dist/types/parallel/index.d.ts +1 -0
  83. package/dist/types/pie/FunnelChart.d.cts +24 -0
  84. package/dist/types/pie/FunnelChart.d.ts +24 -0
  85. package/dist/types/pie/GaugeChart.d.cts +110 -0
  86. package/dist/types/pie/GaugeChart.d.ts +110 -0
  87. package/dist/types/pie/PieChart.d.cts +103 -0
  88. package/dist/types/pie/PieChart.d.ts +103 -0
  89. package/dist/types/pie/PyramidChart.d.cts +21 -0
  90. package/dist/types/pie/PyramidChart.d.ts +21 -0
  91. package/dist/types/pie/SlicedShapeChart.d.cts +108 -0
  92. package/dist/types/pie/SlicedShapeChart.d.ts +108 -0
  93. package/dist/types/pie/index.d.cts +6 -0
  94. package/dist/types/pie/index.d.ts +6 -0
  95. package/dist/types/pie/slices.d.cts +95 -0
  96. package/dist/types/pie/slices.d.ts +95 -0
  97. package/dist/types/polar/PolarChart.d.cts +166 -0
  98. package/dist/types/polar/PolarChart.d.ts +166 -0
  99. package/dist/types/polar/PolarSeries.d.cts +226 -0
  100. package/dist/types/polar/PolarSeries.d.ts +226 -0
  101. package/dist/types/polar/SpiderChart.d.cts +181 -0
  102. package/dist/types/polar/SpiderChart.d.ts +181 -0
  103. package/dist/types/polar/common.d.cts +33 -0
  104. package/dist/types/polar/common.d.ts +33 -0
  105. package/dist/types/polar/gl.d.cts +92 -0
  106. package/dist/types/polar/gl.d.ts +92 -0
  107. package/dist/types/polar/index.d.cts +4 -0
  108. package/dist/types/polar/index.d.ts +4 -0
  109. package/dist/types/render/GLRenderer.d.cts +181 -0
  110. package/dist/types/render/GLRenderer.d.ts +181 -0
  111. package/dist/types/render/Surface.d.cts +153 -0
  112. package/dist/types/render/Surface.d.ts +153 -0
  113. package/dist/types/render/draw.d.cts +125 -0
  114. package/dist/types/render/draw.d.ts +125 -0
  115. package/dist/types/render/shaders.d.cts +37 -0
  116. package/dist/types/render/shaders.d.ts +37 -0
  117. package/dist/types/xy/Axis.d.cts +233 -0
  118. package/dist/types/xy/Axis.d.ts +233 -0
  119. package/dist/types/xy/ChartXY.d.cts +224 -0
  120. package/dist/types/xy/ChartXY.d.ts +224 -0
  121. package/dist/types/xy/series/BoxSeries.d.cts +94 -0
  122. package/dist/types/xy/series/BoxSeries.d.ts +94 -0
  123. package/dist/types/xy/series/EllipseSeries.d.cts +61 -0
  124. package/dist/types/xy/series/EllipseSeries.d.ts +61 -0
  125. package/dist/types/xy/series/HeatmapSeries.d.cts +141 -0
  126. package/dist/types/xy/series/HeatmapSeries.d.ts +141 -0
  127. package/dist/types/xy/series/OHLCSeries.d.cts +122 -0
  128. package/dist/types/xy/series/OHLCSeries.d.ts +122 -0
  129. package/dist/types/xy/series/PointLineAreaSeries.d.cts +168 -0
  130. package/dist/types/xy/series/PointLineAreaSeries.d.ts +168 -0
  131. package/dist/types/xy/series/RectangleSeries.d.cts +192 -0
  132. package/dist/types/xy/series/RectangleSeries.d.ts +192 -0
  133. package/dist/types/xy/series/SegmentSeries.d.cts +66 -0
  134. package/dist/types/xy/series/SegmentSeries.d.ts +66 -0
  135. package/dist/types/xy/series/SeriesXY.d.cts +97 -0
  136. package/dist/types/xy/series/SeriesXY.d.ts +97 -0
  137. package/dist/types/xy/store.d.cts +185 -0
  138. package/dist/types/xy/store.d.ts +185 -0
  139. package/dist/types/xy/sync.d.cts +6 -0
  140. package/dist/types/xy/sync.d.ts +6 -0
  141. package/dist/types/xy/ticks.d.cts +122 -0
  142. package/dist/types/xy/ticks.d.ts +122 -0
  143. package/dist/types/xydata/gen3d.d.cts +24 -0
  144. package/dist/types/xydata/gen3d.d.ts +24 -0
  145. package/dist/types/xydata/index.d.cts +121 -0
  146. package/dist/types/xydata/index.d.ts +121 -0
  147. package/dist/types/zoomband/ZoomBandChart.d.cts +53 -0
  148. package/dist/types/zoomband/ZoomBandChart.d.ts +53 -0
  149. package/dist/types/zoomband/index.d.cts +1 -0
  150. package/dist/types/zoomband/index.d.ts +1 -0
  151. package/package.json +64 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Murray Kopit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,202 @@
1
- # Temporary Holding Version
1
+ # Sferic Charts
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ GPU-accelerated charting for the browser. Sferic renders millions of data points
4
+ at interactive frame rates with WebGL2, ships with a dark, glowing default theme,
5
+ and uses a fluent builder API. Zero runtime dependencies.
6
+
7
+ ![Sferic gallery: real-time dashboards, 3D surfaces, heatmaps, trading, polar, treemap, gauges, parallel coordinates, map](https://raw.githubusercontent.com/murr2k/sferic-charts/main/docs/gallery.jpg)
8
+
9
+ > A *sferic* is the broadband radio impulse emitted by a lightning stroke.
10
+
11
+ ## Highlights
12
+
13
+ - **Large data:** 10M+ point line charts stay interactive through a per-chunk min/max
14
+ level-of-detail pyramid; 1M-point scatter plots with per-point colors pan smoothly.
15
+ - **Real-time:** scrolling, sweeping and multi-channel streaming; a 100-chart live
16
+ dashboard renders in about 9 ms per frame on an integrated GPU.
17
+ - **Precision:** data is stored per chunk relative to a float64 origin, so epoch
18
+ timestamps zoom down to microseconds without jitter.
19
+ - **Unlimited charts per page:** all charts share one WebGL context and draw into
20
+ their own canvases, avoiding the browser's limit of about 16 WebGL contexts.
21
+ - **Looks good by default:** five themes (`storm`, `daylight`, `aurora`, `lagoon`, `graphite`);
22
+ the default `storm` adds GPU bloom glow. Series palettes are validated for
23
+ color-vision-deficiency separation.
24
+
25
+ ## Chart types
26
+
27
+ | Family | What you get |
28
+ |---|---|
29
+ | `ChartXY` | Line, point, point-line, area, area range, step, spline, heatmap grid, scrolling heatmap, box and whiskers, OHLC / candlestick, rectangles, segments, ellipses |
30
+ | Axes | Numeric, logarithmic, DateTime (years to microseconds), elapsed Time; stacked and opposite axes; scroll strategies; bands, constant lines, custom ticks |
31
+ | `Dashboard` | Grid of any charts on one canvas, draggable splitters, synchronized axes and cursors |
32
+ | `Chart3D` | Point, line, surface grid, scrolling surface, mesh model, box series; orbit camera |
33
+ | `Polar`, `Spider` | Polar line, point, area, polygon and heatmap series; radar charts |
34
+ | `Pie`, `Gauge`, `Funnel`, `Pyramid` | Pie and donut, animated gauges, funnel and pyramid |
35
+ | `BarChart` | Vertical, horizontal, grouped, stacked, animated (racing) bars |
36
+ | `ZoomBandChart`, `ParallelCoordinateChart` | Overview range selector; brushing and LUT-colored parallel coordinates |
37
+ | `TreeMapChart`, `SunburstChart` | Hierarchies with drill-down |
38
+ | `DataGrid`, `Map` | Canvas data grid with sparklines and change flashes; world map from TopoJSON or GeoJSON |
39
+
40
+ ## Quick start
41
+
42
+ ```bash
43
+ npm install sferic-charts
44
+ ```
45
+
46
+ The package ships an ES module, a UMD/CommonJS build and TypeScript declarations for
47
+ both.
48
+
49
+ ```ts
50
+ import { sferic, AxisTickStrategies, Themes } from 'sferic-charts'
51
+
52
+ const chart = sferic()
53
+ .ChartXY({ container: 'chart', theme: Themes.storm })
54
+ .setTitle('Day-ahead Power Price')
55
+
56
+ chart.axisX.setTickStrategy(AxisTickStrategies.DateTime)
57
+ chart.axisY.setTitle('Price').setUnits('EUR/MWh')
58
+
59
+ chart
60
+ .addLineSeries()
61
+ .setName('Day-ahead')
62
+ .appendJSON([
63
+ { x: new Date(2025, 2, 3, 0).getTime(), y: 61.4 },
64
+ { x: new Date(2025, 2, 3, 1).getTime(), y: 58.9 },
65
+ ])
66
+ ```
67
+
68
+ `container` takes an element or an element id; without one the chart fills the window.
69
+ Sferic requires WebGL2 (all current desktop and mobile browsers).
70
+
71
+ ### Real-time streaming
72
+
73
+ ```ts
74
+ import { sferic, AxisTickStrategies, AxisScrollStrategies } from 'sferic-charts'
75
+
76
+ const chart = sferic().ChartXY({ container: 'chart' })
77
+ chart.axisX
78
+ .setTickStrategy(AxisTickStrategies.Time)
79
+ .setScrollStrategy(AxisScrollStrategies.scrolling)
80
+ .setDefaultInterval((s) => ({ end: s.dataMax ?? 0, start: (s.dataMax ?? 0) - 10_000, stopAxisAfter: false }))
81
+
82
+ const series = chart.addLineSeries().setMaxSampleCount(100_000)
83
+ let t = 0
84
+ setInterval(() => {
85
+ const ys = Float32Array.from({ length: 50 }, () => Math.random())
86
+ series.appendSamples({ start: t, step: 1, yValues: ys })
87
+ t += 50
88
+ }, 50)
89
+ ```
90
+
91
+ ### Heatmap with a color palette
92
+
93
+ ```ts
94
+ import { sferic, LUT, PalettedFill, regularColorSteps, Themes } from 'sferic-charts'
95
+
96
+ const theme = Themes.storm
97
+ const chart = sferic().ChartXY({ container: 'chart', theme })
98
+ const lut = new LUT({ steps: regularColorSteps(0, 100, theme.examples.intensityColorPalette), units: 'dB' })
99
+ chart
100
+ .addHeatmapGridSeries({ columns: 1000, rows: 1000, dataOrder: 'rows' })
101
+ .setFillStyle(new PalettedFill({ lut }))
102
+ .setIntensityInterpolation('bilinear')
103
+ .invalidateIntensityValues(matrix) // number[][], rows x columns
104
+ chart.legend.add(lut, { name: 'Level' })
105
+ ```
106
+
107
+ ### Dashboards
108
+
109
+ ```ts
110
+ const dash = sferic().Dashboard({ container: 'app', numberOfColumns: 2, numberOfRows: 2 })
111
+ const a = dash.createChartXY({ columnIndex: 0, rowIndex: 0 })
112
+ const b = dash.createChartXY({ columnIndex: 1, rowIndex: 0 })
113
+ const g = dash.createGaugeChart({ columnIndex: 0, rowIndex: 1, columnSpan: 2 })
114
+ ```
115
+
116
+ ## Porting from LightningChart JS
117
+
118
+ Many Sferic builder methods share names with LightningChart JS (`ChartXY`,
119
+ `Dashboard`, `axisX`, `setTickStrategy`, `addLineSeries`, `appendSamples`,
120
+ `addHeatmapGridSeries`, `LUT`, `PalettedFill`, ...), so much existing code maps over
121
+ with small edits. Sferic does not export a function under that product's name; alias
122
+ the factory yourself if you want to keep your call sites:
123
+
124
+ ```ts
125
+ import { sferic as lightningChart } from 'sferic-charts'
126
+ ```
127
+
128
+ Theme names differ (use `Themes.storm` and friends), no license key is needed, and
129
+ less common APIs and visual details are not identical. The gallery examples are the
130
+ best reference for what is covered.
131
+
132
+ ## How it works
133
+
134
+ - One process-wide WebGL2 context. Each standalone chart or dashboard owns a single
135
+ visible 2D canvas; per frame it draws backgrounds and grids (Canvas2D), renders all
136
+ GPU content into the shared context and copies it in, then draws axes, labels,
137
+ legends and cursors (Canvas2D).
138
+ - Lines are instanced capsules with signed-distance antialiasing in the fragment
139
+ shader; points are instanced quads with SDF shapes; heatmaps are float textures
140
+ colored through a LUT texture.
141
+ - Series data lives in chunks of up to 32K points, each relative to its own float64
142
+ origin. Chunk buffers are only ever re-specified whole (no partial updates of
143
+ buffers in flight, which stall ANGLE/D3D11); newly appended samples are drawn from
144
+ a small per-frame tail buffer until committed.
145
+ - Glow is a bloom post-process over multiple render targets. MSAA is enabled only for
146
+ charts that draw un-antialiased triangles (3D, filled polygons).
147
+ - Rendering is on demand: nothing is drawn unless data, layout, interaction or an
148
+ animation changed.
149
+
150
+ ## Performance
151
+
152
+ Measured with `npm run bench` on an Intel Arc integrated GPU at 1920x1080 (headless
153
+ Chrome): the wall time of each rendered frame, CPU and GPU, synchronized with a
154
+ 1-pixel readback (about 0.4 ms of each figure).
155
+
156
+ | Scenario | Median cost per frame |
157
+ |---|---|
158
+ | 10 channels x 1 kHz streaming | 3.2 ms |
159
+ | 1000x1000 heatmap, wheel zooming | 3.2 ms |
160
+ | Real-time FFT spectrogram | 3.7 ms |
161
+ | 10M-point line, wheel zooming | 4.3 ms |
162
+ | 100 live charts in one dashboard | 9.1 ms |
163
+ | 1M-point scatter, per-point colors, panning | 11.5 ms |
164
+
165
+ ## Development
166
+
167
+ ```bash
168
+ git clone https://github.com/murr2k/sferic-charts.git
169
+ cd sferic-charts
170
+ npm install
171
+ npm run dev # gallery at http://127.0.0.1:8779 (run.cmd on Windows)
172
+ npm run typecheck
173
+ npm run build:lib # library bundle and type declarations
174
+ npm run build # static gallery build
175
+ npm test # map decoder hostile-input tests
176
+ npm run snap # screenshot every example headlessly; fails on page or WebGL errors
177
+ npm run test:browser # context loss, no-WebGL, GPU memory and accessibility checks
178
+ npm run bench # GPU-synced cost per rendered frame
179
+ npm run verify:package # pack, install into a clean project, check imports and types
180
+ ```
181
+
182
+ `prepublishOnly` runs typecheck, tests, the library build and `verify:package`, so a
183
+ broken or stale build cannot be published.
184
+
185
+ Releases publish from GitHub Actions: bump `version` in `package.json`, move the
186
+ CHANGELOG's `[Unreleased]` entries under the new version, commit, then push a `vX.Y.Z`
187
+ tag. The release workflow runs the same gate and publishes with npm trusted publishing
188
+ (no stored token, with a provenance attestation).
189
+
190
+ `snap` and `bench` drive your installed Chrome or Edge through puppeteer-core and need
191
+ the dev server running. Gallery examples live in `gallery/examples/`, one file each,
192
+ and are discovered automatically.
193
+
194
+ ## License
195
+
196
+ MIT. See [LICENSE](https://github.com/murr2k/sferic-charts/blob/main/LICENSE).
197
+
198
+ ## Trademarks
199
+
200
+ LightningChart is a trademark of LightningChart Ltd. Sferic Charts is an independent
201
+ open-source project and is not affiliated with, endorsed by, or sponsored by
202
+ LightningChart Ltd. References to LightningChart JS describe API familiarity only.