@nova-lab/charts 0.0.0-stage → 1.0.0-dev.32
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/LICENSE +202 -0
- package/README.md +158 -2
- package/dist/GeometryIndex-DDQ34Jf4.js +104 -0
- package/dist/MarkSeries-CQCAnV4s.js +245 -0
- package/dist/aggregation.d.ts +6 -0
- package/dist/aggregation.js +124 -0
- package/dist/annotations.d.ts +34 -0
- package/dist/annotations.js +71 -0
- package/dist/api/camera.d.ts +8 -0
- package/dist/api/cartesian.d.ts +21 -0
- package/dist/api/events.d.ts +13 -0
- package/dist/api/font.d.ts +3 -0
- package/dist/api/handle.d.ts +5 -0
- package/dist/api/host.d.ts +23 -0
- package/dist/api/internal.d.ts +41 -0
- package/dist/api/map-background.d.ts +12 -0
- package/dist/api/mark-paint.d.ts +5 -0
- package/dist/api/mark-style.d.ts +4 -0
- package/dist/api/navigation.d.ts +4 -0
- package/dist/api/overlay.d.ts +7 -0
- package/dist/api/partition.d.ts +11 -0
- package/dist/api/scene.d.ts +42 -0
- package/dist/api/state.d.ts +34 -0
- package/dist/api/types.d.ts +743 -0
- package/dist/area.d.ts +9 -0
- package/dist/area.js +706 -0
- package/dist/bar.d.ts +9 -0
- package/dist/bar.js +554 -0
- package/dist/brush.d.ts +17 -0
- package/dist/brush.js +86 -0
- package/dist/bubble.d.ts +8 -0
- package/dist/bubble.js +434 -0
- package/dist/camera-CUJAMfpx.js +57 -0
- package/dist/candlestick.d.ts +8 -0
- package/dist/candlestick.js +42 -0
- package/dist/cartesian-k_WIYsGp.js +1139 -0
- package/dist/chart-runtime-resolver-DwwXp3X8.js +20 -0
- package/dist/chart-series-runtime-C0P7h8Tl.js +127 -0
- package/dist/charts.js +1 -0
- package/dist/composed.d.ts +2 -0
- package/dist/composed.js +4 -0
- package/dist/crosshair.d.ts +23 -0
- package/dist/crosshair.js +60 -0
- package/dist/donut.d.ts +5 -0
- package/dist/donut.js +7 -0
- package/dist/funnel.d.ts +5 -0
- package/dist/funnel.js +40 -0
- package/dist/graph.d.ts +6 -0
- package/dist/graph.js +260 -0
- package/dist/heatmap.d.ts +8 -0
- package/dist/heatmap.js +37 -0
- package/dist/host-DLDeDU5k.js +4373 -0
- package/dist/index.d.ts +1 -0
- package/dist/internal-I5BDhahD.js +4 -0
- package/dist/layout-donut-BG4ubBtU.js +39 -0
- package/dist/line.d.ts +9 -0
- package/dist/line.js +452 -0
- package/dist/mark-paint-CMHKGegE.js +14 -0
- package/dist/mark-style-Cpl-ARQM.js +10 -0
- package/dist/model/area/create-area-series-layout.d.ts +15 -0
- package/dist/model/area/hit-test-area-layout.d.ts +2 -0
- package/dist/model/axis/ChartAxisModel.d.ts +28 -0
- package/dist/model/bar/create-bar-series-layout.d.ts +19 -0
- package/dist/model/bar/hit-test-bar-layout.d.ts +2 -0
- package/dist/model/bubble/create-bubble-series-layout.d.ts +15 -0
- package/dist/model/bubble/hit-test-bubble-layout.d.ts +2 -0
- package/dist/model/cartesian/append-line-contours.d.ts +4 -0
- package/dist/model/cartesian/axis-line-batch.d.ts +3 -0
- package/dist/model/cartesian/numeric-window.d.ts +7 -0
- package/dist/model/cartesian/point-series.d.ts +54 -0
- package/dist/model/cartesian/sample-extrema.d.ts +7 -0
- package/dist/model/cartesian/smooth-y.d.ts +4 -0
- package/dist/model/cartesian/translation-window.d.ts +17 -0
- package/dist/model/context/nova-chart-runtime.d.ts +54 -0
- package/dist/model/customization/chart-customization.d.ts +47 -0
- package/dist/model/customization/chart-presets.d.ts +6 -0
- package/dist/model/customization/chart-style-sheet.d.ts +9 -0
- package/dist/model/data/ChartDataStore.d.ts +113 -0
- package/dist/model/exploration/create-graph-layout.d.ts +11 -0
- package/dist/model/exploration/exploration-chart.types.d.ts +150 -0
- package/dist/model/exploration/force-layout.d.ts +9 -0
- package/dist/model/exploration/presets/airplane.d.ts +2 -0
- package/dist/model/exploration/presets/apartment.d.ts +2 -0
- package/dist/model/exploration/presets/botanical-park.d.ts +2 -0
- package/dist/model/exploration/presets/ferry.d.ts +2 -0
- package/dist/model/exploration/presets/ice-arena.d.ts +2 -0
- package/dist/model/exploration/presets/planetarium.d.ts +2 -0
- package/dist/model/exploration/presets/science-museum.d.ts +2 -0
- package/dist/model/exploration/presets/train.d.ts +2 -0
- package/dist/model/exploration/route-geometry.d.ts +9 -0
- package/dist/model/exploration/seat-shape.d.ts +7 -0
- package/dist/model/interaction/GeometryIndex.d.ts +14 -0
- package/dist/model/line/create-line-series-layout.d.ts +15 -0
- package/dist/model/line/hit-test-line-layout.d.ts +2 -0
- package/dist/model/novel/create-novel-layout.d.ts +5 -0
- package/dist/model/novel/hit-test-novel-layout.d.ts +3 -0
- package/dist/model/novel/layout-candlestick.d.ts +3 -0
- package/dist/model/novel/layout-donut.d.ts +3 -0
- package/dist/model/novel/layout-funnel.d.ts +3 -0
- package/dist/model/novel/layout-heatmap.d.ts +3 -0
- package/dist/model/novel/layout-input.d.ts +12 -0
- package/dist/model/novel/layout-radar.d.ts +3 -0
- package/dist/model/novel/layout-tree.d.ts +3 -0
- package/dist/model/novel/layout-treemap.d.ts +3 -0
- package/dist/model/novel/layout-values.d.ts +10 -0
- package/dist/model/novel/novel-chart.types.d.ts +140 -0
- package/dist/model/novel/novel-domains.d.ts +5 -0
- package/dist/model/scale/BandScale.d.ts +86 -0
- package/dist/model/scale/ChartScaleRegistry.d.ts +45 -0
- package/dist/model/scale/LinearScale.d.ts +48 -0
- package/dist/model/scale/TimeScale.d.ts +48 -0
- package/dist/model/scale/create-chart-scale.d.ts +3 -0
- package/dist/model/scale/resolve-chart-scale.d.ts +5 -0
- package/dist/model/scatter/create-scatter-series-layout.d.ts +14 -0
- package/dist/model/scatter/hit-test-scatter-layout.d.ts +4 -0
- package/dist/model/time/calendar-time.d.ts +16 -0
- package/dist/model/types/chart-axis.types.d.ts +43 -0
- package/dist/model/types/chart-components.types.d.ts +1393 -0
- package/dist/model/types/chart-scale.types.d.ts +78 -0
- package/dist/model/viewport-controller/viewport-controller.d.ts +5 -0
- package/dist/novel-domains-DBpA_AOT.js +24 -0
- package/dist/partition-D-0LTCr3.js +221 -0
- package/dist/presets/route-map/apartment.d.ts +2 -0
- package/dist/presets/route-map/apartment.js +116 -0
- package/dist/presets/route-map/botanical-park.d.ts +2 -0
- package/dist/presets/route-map/botanical-park.js +116 -0
- package/dist/presets/route-map/science-museum.d.ts +2 -0
- package/dist/presets/route-map/science-museum.js +45 -0
- package/dist/presets/seat-map/airplane.d.ts +2 -0
- package/dist/presets/seat-map/airplane.js +95 -0
- package/dist/presets/seat-map/ferry.d.ts +2 -0
- package/dist/presets/seat-map/ferry.js +54 -0
- package/dist/presets/seat-map/ice-arena.d.ts +2 -0
- package/dist/presets/seat-map/ice-arena.js +67 -0
- package/dist/presets/seat-map/planetarium.d.ts +2 -0
- package/dist/presets/seat-map/planetarium.js +54 -0
- package/dist/presets/seat-map/train.d.ts +2 -0
- package/dist/presets/seat-map/train.js +66 -0
- package/dist/presets.d.ts +78 -0
- package/dist/presets.js +14 -0
- package/dist/public.d.ts +2 -0
- package/dist/radar.d.ts +5 -0
- package/dist/radar.js +47 -0
- package/dist/rose.d.ts +5 -0
- package/dist/rose.js +7 -0
- package/dist/route-map.d.ts +6 -0
- package/dist/route-map.js +200 -0
- package/dist/scatter.d.ts +8 -0
- package/dist/scatter.js +433 -0
- package/dist/scene-CPvPzTaB.js +137 -0
- package/dist/seat-map.d.ts +6 -0
- package/dist/seat-map.js +84 -0
- package/dist/seat-shape--kEFiUXX.js +66 -0
- package/dist/state-C5pICb11.js +134 -0
- package/dist/sync.d.ts +82 -0
- package/dist/sync.js +326 -0
- package/dist/translation-window-Ca_rCenJ.js +57 -0
- package/dist/tree.d.ts +6 -0
- package/dist/tree.js +114 -0
- package/dist/treemap.d.ts +5 -0
- package/dist/treemap.js +85 -0
- package/dist/ui/area-series/AreaSeries.d.ts +44 -0
- package/dist/ui/area-series/area-series.config.d.ts +10 -0
- package/dist/ui/area-series/area-series.registry.d.ts +4 -0
- package/dist/ui/axis/Axis.d.ts +55 -0
- package/dist/ui/axis/axis.config.d.ts +10 -0
- package/dist/ui/axis/axis.registry.d.ts +4 -0
- package/dist/ui/bar-chart/BarChart.d.ts +124 -0
- package/dist/ui/bar-chart/bar-chart.config.d.ts +10 -0
- package/dist/ui/bar-chart/bar-chart.registry.d.ts +2 -0
- package/dist/ui/bar-series/BarSeries.d.ts +102 -0
- package/dist/ui/bar-series/bar-series.config.d.ts +10 -0
- package/dist/ui/bar-series/bar-series.registry.d.ts +4 -0
- package/dist/ui/bubble-series/BubbleSeries.d.ts +33 -0
- package/dist/ui/bubble-series/bubble-series.config.d.ts +10 -0
- package/dist/ui/bubble-series/bubble-series.registry.d.ts +4 -0
- package/dist/ui/composed-chart/ComposedChart.d.ts +41 -0
- package/dist/ui/composed-chart/composed-chart.config.d.ts +10 -0
- package/dist/ui/composed-chart/composed-chart.registry.d.ts +4 -0
- package/dist/ui/exploration-chart/ExplorationChart.d.ts +83 -0
- package/dist/ui/exploration-chart/exploration-chart.config.d.ts +7 -0
- package/dist/ui/exploration-chart/exploration-chart.registry.d.ts +6 -0
- package/dist/ui/grid/Grid.d.ts +35 -0
- package/dist/ui/grid/grid.config.d.ts +10 -0
- package/dist/ui/grid/grid.registry.d.ts +4 -0
- package/dist/ui/interaction/Interaction.d.ts +53 -0
- package/dist/ui/interaction/interaction.config.d.ts +10 -0
- package/dist/ui/interaction/interaction.registry.d.ts +4 -0
- package/dist/ui/legend/Legend.d.ts +38 -0
- package/dist/ui/legend/legend.config.d.ts +10 -0
- package/dist/ui/legend/legend.registry.d.ts +2 -0
- package/dist/ui/line-series/LineSeries.d.ts +67 -0
- package/dist/ui/line-series/line-series.config.d.ts +10 -0
- package/dist/ui/line-series/line-series.registry.d.ts +4 -0
- package/dist/ui/mark-series/MarkSeries.d.ts +55 -0
- package/dist/ui/novel-series/NovelSeries.d.ts +34 -0
- package/dist/ui/novel-series/novel-series.config.d.ts +9 -0
- package/dist/ui/novel-series/novel-series.registry.d.ts +4 -0
- package/dist/ui/partition-chart/PartitionChart.d.ts +24 -0
- package/dist/ui/partition-chart/partition-chart.config.d.ts +7 -0
- package/dist/ui/partition-chart/partition-chart.registry.d.ts +9 -0
- package/dist/ui/plot/Plot.d.ts +64 -0
- package/dist/ui/plot/plot.config.d.ts +10 -0
- package/dist/ui/plot/plot.registry.d.ts +4 -0
- package/dist/ui/root/Root.d.ts +206 -0
- package/dist/ui/root/root.config.d.ts +10 -0
- package/dist/ui/root/root.registry.d.ts +5 -0
- package/dist/ui/scale/Scale.d.ts +55 -0
- package/dist/ui/scale/scale.config.d.ts +10 -0
- package/dist/ui/scale/scale.registry.d.ts +4 -0
- package/dist/ui/scatter-series/ScatterSeries.d.ts +33 -0
- package/dist/ui/scatter-series/scatter-series.config.d.ts +10 -0
- package/dist/ui/scatter-series/scatter-series.registry.d.ts +4 -0
- package/dist/ui/shared/chart-props.d.ts +150 -0
- package/dist/ui/shared/chart-runtime-resolver.d.ts +4 -0
- package/dist/ui/shared/chart-semantic-marks.d.ts +20 -0
- package/dist/ui/shared/chart-series-runtime.d.ts +48 -0
- package/dist/ui/shared/schema-types.d.ts +34 -0
- package/dist/ui/tooltip/Tooltip.d.ts +64 -0
- package/dist/ui/tooltip/tooltip.config.d.ts +10 -0
- package/dist/ui/tooltip/tooltip.registry.d.ts +4 -0
- package/dist/ui/viewport/Viewport.d.ts +81 -0
- package/dist/ui/viewport/viewport.config.d.ts +10 -0
- package/dist/ui/viewport/viewport.registry.d.ts +2 -0
- package/dist/ui/viewport-controller/ViewportController.d.ts +30 -0
- package/dist/ui/viewport-controller/viewport-controller.config.d.ts +10 -0
- package/dist/ui/viewport-controller/viewport-controller.registry.d.ts +2 -0
- package/package.json +179 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,159 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nova-lab/charts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
18 типов диаграмм с единым typed API. Charts владеет данными, шкалами, геометрией и взаимодействием; Nova Core выполняет Canvas 2D/WebGL rendering. Для SSR вызывайте mount в browser lifecycle, destroy при удалении представления.
|
|
4
|
+
|
|
5
|
+
## Импорты
|
|
6
|
+
|
|
7
|
+
| Семейство | Самостоятельные entrypoints |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| Cartesian | `bar`, `line`, `area`, `scatter`, `bubble`, `heatmap`, `candlestick`, `composed` |
|
|
10
|
+
| Категориальные и иерархические | `donut`, `rose`, `treemap`, `funnel`, `radar`, `tree` |
|
|
11
|
+
| Сценовые | `graph`, `aggregation`, `route-map`, `seat-map` |
|
|
12
|
+
|
|
13
|
+
Root `@nova-lab/charts` экспортирует только типы. Crosshair, Brush, Annotations, ChartSync и presets импортируются отдельно. Фабрики не регистрируют другие типы диаграмм. Старый публичный DSL и `NovaCharts.mount` удалены.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { LineChart } from '@nova-lab/charts/line'
|
|
17
|
+
import { AreaChart } from '@nova-lab/charts/area'
|
|
18
|
+
import { ComposedChart } from '@nova-lab/charts/composed'
|
|
19
|
+
import { Crosshair } from '@nova-lab/charts/crosshair'
|
|
20
|
+
import { Brush } from '@nova-lab/charts/brush'
|
|
21
|
+
import { Annotations } from '@nova-lab/charts/annotations'
|
|
22
|
+
import { ChartSync } from '@nova-lab/charts/sync'
|
|
23
|
+
|
|
24
|
+
type Row = { id: string, time: number, value: number }
|
|
25
|
+
const rows: Row[] = [{ id: 'a', time: 0, value: 10 }, { id: 'b', time: 1, value: 20 }]
|
|
26
|
+
const cursor = Crosshair.create({ axes: ['x'], snap: true, labels: true })
|
|
27
|
+
const brush = Brush.create({ axes: ['x'], activation: 'shift' })
|
|
28
|
+
const annotations = Annotations.create({ data: [{ key: 'limit', type: 'line', y: 15, yScaleId: 'y' }] })
|
|
29
|
+
const chart = LineChart.mount('#chart', {
|
|
30
|
+
data: rows, key: 'id', x: 'time', y: 'value',
|
|
31
|
+
width: 960, height: 540, renderer: 'canvas2d',
|
|
32
|
+
theme: 'light', motion: false, legend: { interactive: true },
|
|
33
|
+
plugins: [cursor, brush, annotations],
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
chart.batch(() => { // Одно уведомление каждого типа и совместная invalidation.
|
|
37
|
+
chart.patchRows([{ key: 'a', changes: { value: 12 } }])
|
|
38
|
+
chart.appendRows([{ id: 'c', time: 2, value: 30 }], { maxRows: 100000 })
|
|
39
|
+
})
|
|
40
|
+
chart.setSelection([{ type: 'datum', seriesId: 'main', key: 'a' }])
|
|
41
|
+
chart.followTail({ scaleId: 'x', span: 60 })
|
|
42
|
+
chart.on('selectionChange', event => console.log(event.previous, event.current, event.origin))
|
|
43
|
+
chart.resize()
|
|
44
|
+
// При удалении представления:
|
|
45
|
+
chart.destroy()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`mount(target, options)` владеет canvas, app, DOM, observers и plugins. `attach({ app, surface, parent }, options)` использует существующий Nova app и освобождает собственное поддерево. Destroy идемпотентен; дальнейшие команды отклоняются. Повторный mount в занятую цель запрещён. `renderer` и `maxDpr` фиксируются при mount; смена backend требует нового экземпляра. `setOptions({ width, height })` меняет реальные размеры canvas. Для wheel доступны `preventDefault: handled/always/never`; handled пропускает прокрутку страницы, если ограничения не допускают изменения состояния.
|
|
49
|
+
|
|
50
|
+
## Общий контракт
|
|
51
|
+
|
|
52
|
+
| Задача | Методы |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| Данные и options | `getData`, `setData`, `getOptions`, `setOptions`, `batch` |
|
|
55
|
+
| Lifecycle | `resize`, `refresh`, `setStatus`, `destroy` |
|
|
56
|
+
| State и возможности | `getViewState`, `setViewState`, `getCapabilities`, `getDiagnostics` |
|
|
57
|
+
| Элементы | `getItem`, `hitTest` |
|
|
58
|
+
| Selection | `getSelection`, `setSelection`, `select`, `unselect`, `toggleSelection`, `clearSelection` |
|
|
59
|
+
| Visibility и legend | `getLegendItems`, `getVisibility`, `setVisibility`; Cartesian `getSeries`, `setSeriesVisible` |
|
|
60
|
+
| Transient state | `getHover`, `setHover`, `clearHover`, `getFocus`, `focus`, `getHighlights`, `highlight`, `clearHighlight`, `showTooltip`, `hideTooltip` |
|
|
61
|
+
| Presentation | `setTheme`, `setPalette`, `setOptions({ styles, labels, formatters, legend, motion, accessibility })` |
|
|
62
|
+
| Export | `exportChart`, `exportData`, `getSemanticSnapshot` |
|
|
63
|
+
| Events/plugins | `on`, `use` |
|
|
64
|
+
|
|
65
|
+
Стабильные ключи обязательны: непустая строка либо конечное число. `1` и `'1'` различаются. `patchRows` меняет существующие строки с неизменным ключом; `upsertRows` заменяет полную запись или добавляет её. Невалидный batch ключей проверяется до изменения source. `batch` объединяет уведомления и rendering; rollback не обещает. Данные и возвращённые строки следует считать immutable; изменения выполняются командами API.
|
|
66
|
+
|
|
67
|
+
Все строковые семейства предоставляют `getRow`, `appendRows`, `patchRows`, `upsertRows`, `removeRows`, `getFilters`, `setFilter`, `removeFilter`, `clearFilters`. Именованные фильтры `range`, `in`, `predicate` меняют отображение, сохраняя source. `exportData({ scope: 'source' | 'filtered' | 'visible' | 'selected', format: 'json' | 'csv' })` явно выбирает набор.
|
|
68
|
+
|
|
69
|
+
Refs имеют разные discriminants: `datum`, `bucket`, `node`, `edge`, `seat`, `route`, `region`, `walker`. Aggregated bucket публикует keys участников через `ChartItem.members`. Удалённые элементы очищаются из локальных hover/focus/tooltip/highlight. `getSemanticSnapshot()` явно формирует снимок даже при `accessibility: false`; DOM при этом остаётся выключенным. Исходный datum остаётся доступен через getItem/getRow, даже если sampling не вывел его geometry.
|
|
70
|
+
|
|
71
|
+
## Специализированные возможности
|
|
72
|
+
|
|
73
|
+
| Семейство | Методы |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| Cartesian | `getScale`; scale: `getType`, `getAxis`, `getDomain`, `setDomain`, `getRange`, `map`, `invert`, `getTicks`; viewport: `getViewport`, `setViewport`, `panBy`, `zoomAt`, `fitContent`, `fitSelection`, `resetViewport`, `followTail` |
|
|
76
|
+
| Composed | `addSeries`, `updateSeries`, `removeSeries`, `setSeries`; series создаются через `BarChart.series`, `LineChart.series` и остальные Cartesian factories |
|
|
77
|
+
| Сценовая камера | `getCamera`, `setCamera`, `panBy`, `zoomAt`, `fitContent`, `fitSelection`, `resetCamera` |
|
|
78
|
+
| Tree/Treemap | `getExpanded`, `expand`, `collapse`, `expandAll`, `collapseAll`, navigation API |
|
|
79
|
+
| Tree/Treemap | `getDrilldown`, `drillTo`, `drillUp`, `resetDrilldown` |
|
|
80
|
+
| Graph | `getNode`, `getLink`, `upsertNodes`, `patchNodes`, `removeNodes`, `upsertLinks`, `patchLinks`, `removeLinks`, `getPositions`, `setPositions`, `getPinned`, `pin`, `unpin`, `runLayout`, `stopLayout` |
|
|
81
|
+
| Aggregation | `getDetail`, `setDetail`, `getGroups`, `setGroups`, navigation API |
|
|
82
|
+
| RouteMap | `getPlayback`, `play`, `pause`, `seek`, `setPlaybackRate`, `setLoop` |
|
|
83
|
+
| SeatMap | `getSelectionRules`, `setSelectionRules`, общая selection с правилами доступности, количества и секций |
|
|
84
|
+
|
|
85
|
+
Карты используют координаты viewBox; камера задаётся в этих координатах. Cartesian `panBy` и anchors `zoomAt` используют пиксели графика. Шкалы `linear`, `time`, `band` имеют стабильные IDs и могут задавать domain, limits, minSpan, ticks, visible и labelRotation. Composed назначает общий pixel range всем шкалам одной координаты; visible скрывает только ось. `sampling.minBarWidthPx` и `sampling.aggregation` управляют агрегацией плотных столбцов. Line/Area сохраняют разрывы null; sampling сохраняет extrema и границы непрерывных участков. При множестве разрывов минимальное число обязательных точек может превышать maxPoints.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const composed = ComposedChart.mount('#composed', {
|
|
89
|
+
data: rows, key: 'id',
|
|
90
|
+
scales: [{ id: 'x', axis: 'x', type: 'time', field: 'time' }, { id: 'y', axis: 'y', type: 'linear', field: 'value' }],
|
|
91
|
+
series: [AreaChart.series({ id: 'area', x: 'time', y: 'value' }), LineChart.series({ id: 'line', x: 'time', y: 'value' })],
|
|
92
|
+
})
|
|
93
|
+
composed.setSeriesVisible('area', false)
|
|
94
|
+
composed.getScale('x').setDomain([0, 60])
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Controlled state
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import type { ChartViewState, DatumRef, BucketRef } from '@nova-lab/charts'
|
|
101
|
+
let accepted: ChartViewState<DatumRef | BucketRef> = { selection: [], visibility: { main: true }, viewport: { ranges: { x: [0, 60], y: [0, 100] } } }
|
|
102
|
+
const controlled = LineChart.mount('#controlled', {
|
|
103
|
+
data: rows, key: 'id', x: 'time', y: 'value',
|
|
104
|
+
state: { mode: 'controlled', value: accepted, onRequestChange(request) {
|
|
105
|
+
accepted = request.current // Приложение может также вызвать request.reject().
|
|
106
|
+
controlled.setViewState(accepted, { requestId: request.id })
|
|
107
|
+
} },
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Пользователь, API-команды и sync запрашивают persistent state. Приложение утверждает его через `setViewState` с requestId либо отклоняет запрос. Поздний ответ отменённого запроса не применяется. Внешний commit без requestId заменяет состояние и отменяет ожидающие запросы. Hover, focus и tooltip остаются локальными. События содержат previous/current/origin; подтверждение сохраняет origin исходного запроса.
|
|
112
|
+
|
|
113
|
+
## Synchronization
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const sync = ChartSync.create({
|
|
117
|
+
participants: { first: controlled, second: composed },
|
|
118
|
+
links: [{ id: 'time', channel: 'viewport', direction: 'leader', leader: 'first', viewport: { mode: 'range', scales: { time: { first: 'x', second: 'x' } } } }],
|
|
119
|
+
})
|
|
120
|
+
sync.pause()
|
|
121
|
+
sync.resume() // Не вызывает resync.
|
|
122
|
+
sync.resync('first')
|
|
123
|
+
sync.getLinks()[0]?.pause()
|
|
124
|
+
sync.dispose()
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Каналы: viewport, cursor, selection, visibility, filters, drilldown, camera, brush, playback; нейтральные endpoints могут публиковать scrollY и ungroupedScrollY. Направление any либо leader. Frame scheduling сохраняет последнее изменение каждого канала; начальное состояние участников сохраняется. Транзакция предотвращает циклы. Controlled receiver сначала принимает/отклоняет изменение; дальше распространяется фактически принятое значение с учётом ограничений.
|
|
128
|
+
|
|
129
|
+
Selection сопоставляется по key/value/category/business либо явному mapper. Aggregates требуют политики reject/members/bucket; функциональные filters требуют mapper. Несовместимые ports отклоняются при подключении. Viewport поддерживает range/center/offset/relative и преобразования canonical единиц. Камера поддерживает center/offset/relative, playback — absolute/relative. `add`, `remove`, `link`, `getLinks`, `pause`, `resume`, `resync`, `dispose` управляют scope и каждой связью.
|
|
130
|
+
|
|
131
|
+
`timelineSync` импортируется из `@nova-lab/timeline/sync` и возвращает нейтральный Nova Core participant. Timeline не зависит от Charts. Совместный пример размещён в nova-demo `/charts/sync`.
|
|
132
|
+
|
|
133
|
+
## Plugins и presets
|
|
134
|
+
|
|
135
|
+
Crosshair: `getValue`, `setValue`, `clear`. Brush: `getBrush`, `setBrush`, `clear`; brush проходит controlled state. Annotations: `getData`, `setData`, `upsert`, `patch`, `remove`, `clear`.
|
|
136
|
+
|
|
137
|
+
`@nova-lab/charts/presets` предоставляет light/dark/compact и dashboard/editorial/financial/scientific/minimal/contrast. Встроенные layouts импортируются по `presets/seat-map/{airplane,train,planetarium,ice-arena,ferry}` и `presets/route-map/{apartment,science-museum,botanical-park}`. PNG backgrounds подключаются только выбранным preset.
|
|
138
|
+
|
|
139
|
+
## Проверка готовности
|
|
140
|
+
|
|
141
|
+
Публичные типы полностью описаны в declarations каждого entrypoint. Общие и специализированные contract tests находятся в `src/test`, browser acceptance запускается `node src/test/browser/run-acceptance.mjs`. Сравнение: `node src/test/browser/run-performance.mjs --diagnostic`; полный протокол закреплён в protocol.json и workspace test-specs. Команды полного прогона, A/A, stress, memory и аудита entrypoints описаны в [browser lab](src/test/browser/README.md).
|
|
142
|
+
|
|
143
|
+
Сохранённые unit/contract и browser-прогоны подтверждают проверенные сценарии реализации. Они не доказывают все сочетания modes, options и устройств ввода. Полная production acceptance ещё не завершена: performance ≤1,10 не подтверждён, строгому сравнению требуются A/A, visual parity и независимые полные прогоны; VoiceOver/Safari требует ручной проверки. Текущий этап разработки завершён с паузой в дальнейшей оптимизации. Diagnostic reports сохраняют статус inconclusive и не являются подтверждением performance acceptance.
|
|
144
|
+
|
|
145
|
+
Общая типографика задаётся через `font: { family: 'Arial', size: 12, weight: '400' }`.
|
|
146
|
+
Она применяется к осям, labels, легенде, tooltip и статусу; изменение проходит
|
|
147
|
+
через `setOptions({ font: ... })`. Размер должен быть положительным конечным числом.
|
|
148
|
+
|
|
149
|
+
Plugin context предоставляет `size()` и `plotBounds()`: первый возвращает
|
|
150
|
+
полные размеры графика, второй — область данных в его координатах, без полей
|
|
151
|
+
осей. Crosshair, brush и линии annotations используют область данных.
|
|
152
|
+
|
|
153
|
+
Категориальные шкалы принимают `paddingInner` (0…1) и `paddingOuter` (≥0).
|
|
154
|
+
Для сплошной Heatmap задайте им нулевые отступы и `gap: 0`; `gap` измеряется
|
|
155
|
+
в пикселях и применяется к каждой стороне ячейки.
|
|
156
|
+
|
|
157
|
+
В Graph координаты `nodes[].x/y` задают начальное размещение. Постоянные
|
|
158
|
+
позиции принадлежат view state: `setData()` сохраняет размещение существующих
|
|
159
|
+
узлов. Явное перемещение выполняется через `setPositions()`, включая controlled mode.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var I = (t, n, r) => n in t ? d(t, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[n] = r;
|
|
3
|
+
var p = (t, n, r) => I(t, typeof n != "symbol" ? n + "" : n, r);
|
|
4
|
+
var v = typeof Float32Array < "u" ? Float32Array : Array;
|
|
5
|
+
function b() {
|
|
6
|
+
var t = new v(9);
|
|
7
|
+
return v != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[5] = 0, t[6] = 0, t[7] = 0), t[0] = 1, t[4] = 1, t[8] = 1, t;
|
|
8
|
+
}
|
|
9
|
+
function u(t) {
|
|
10
|
+
var n = new v(9);
|
|
11
|
+
return n[0] = t[0], n[1] = t[1], n[2] = t[2], n[3] = t[3], n[4] = t[4], n[5] = t[5], n[6] = t[6], n[7] = t[7], n[8] = t[8], n;
|
|
12
|
+
}
|
|
13
|
+
function R(t, n, r, e, a, s, i, h, m) {
|
|
14
|
+
var o = new v(9);
|
|
15
|
+
return o[0] = t, o[1] = n, o[2] = r, o[3] = e, o[4] = a, o[5] = s, o[6] = i, o[7] = h, o[8] = m, o;
|
|
16
|
+
}
|
|
17
|
+
function $(t, n, r) {
|
|
18
|
+
var e = n[0], a = n[1], s = n[2], i = n[3], h = n[4], m = n[5], o = n[6], l = n[7], c = n[8], f = r[0], x = r[1], y = r[2], g = r[3], M = r[4], Y = r[5], X = r[6], w = r[7], _ = r[8];
|
|
19
|
+
return t[0] = f * e + x * i + y * o, t[1] = f * a + x * h + y * l, t[2] = f * s + x * m + y * c, t[3] = g * e + M * i + Y * o, t[4] = g * a + M * h + Y * l, t[5] = g * s + M * m + Y * c, t[6] = X * e + w * i + _ * o, t[7] = X * a + w * h + _ * l, t[8] = X * s + w * m + _ * c, t;
|
|
20
|
+
}
|
|
21
|
+
function q(t, n, r) {
|
|
22
|
+
var e = n[0], a = n[1], s = n[2], i = n[3], h = n[4], m = n[5], o = n[6], l = n[7], c = n[8], f = r[0], x = r[1];
|
|
23
|
+
return t[0] = e, t[1] = a, t[2] = s, t[3] = i, t[4] = h, t[5] = m, t[6] = f * e + x * i + o, t[7] = f * a + x * h + l, t[8] = f * s + x * m + c, t;
|
|
24
|
+
}
|
|
25
|
+
function E(t, n, r) {
|
|
26
|
+
var e = n[0], a = n[1], s = n[2], i = n[3], h = n[4], m = n[5], o = n[6], l = n[7], c = n[8], f = Math.sin(r), x = Math.cos(r);
|
|
27
|
+
return t[0] = x * e + f * i, t[1] = x * a + f * h, t[2] = x * s + f * m, t[3] = x * i - f * e, t[4] = x * h - f * a, t[5] = x * m - f * s, t[6] = o, t[7] = l, t[8] = c, t;
|
|
28
|
+
}
|
|
29
|
+
class T {
|
|
30
|
+
constructor(n, r, e = 32) {
|
|
31
|
+
p(this, "_cells", /* @__PURE__ */ new Map());
|
|
32
|
+
p(this, "_large");
|
|
33
|
+
if (this._cellSize = e, !Number.isFinite(e) || e <= 0)
|
|
34
|
+
throw new RangeError("[NovaCharts] Spatial cell size must be finite and positive");
|
|
35
|
+
const a = [];
|
|
36
|
+
for (const s of n) {
|
|
37
|
+
const i = r(s), h = Math.floor(i.x / e), m = Math.floor(i.y / e), o = Math.floor((i.x + i.width) / e), l = Math.floor((i.y + i.height) / e);
|
|
38
|
+
if ([h, m, o, l].every(Number.isFinite)) {
|
|
39
|
+
if ((o - h + 1) * (l - m + 1) > 64) {
|
|
40
|
+
a.push({ item: s, order: a.length, minX: i.x, minY: i.y, maxX: i.x + i.width, maxY: i.y + i.height });
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
for (let c = h; c <= o; c++)
|
|
44
|
+
for (let f = m; f <= l; f++) {
|
|
45
|
+
const x = `${c}:${f}`;
|
|
46
|
+
let y = this._cells.get(x);
|
|
47
|
+
y || (y = [], this._cells.set(x, y)), y.push(s);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this._large = a.length ? A(a) : void 0;
|
|
52
|
+
}
|
|
53
|
+
query(n, r, e = 0) {
|
|
54
|
+
if (![n, r, e].every(Number.isFinite) || e < 0)
|
|
55
|
+
throw new RangeError("[NovaCharts] Hit test requires finite coordinates and a nonnegative radius");
|
|
56
|
+
const a = [];
|
|
57
|
+
F(this._large, n - e, r - e, n + e, r + e, a), a.sort((l, c) => l.order - c.order);
|
|
58
|
+
const s = new Set(a.map((l) => l.item)), i = Math.floor((n - e) / this._cellSize), h = Math.floor((r - e) / this._cellSize), m = Math.floor((n + e) / this._cellSize), o = Math.floor((r + e) / this._cellSize);
|
|
59
|
+
if ((m - i + 1) * (o - h + 1) > this._cells.size) {
|
|
60
|
+
for (const l of this._cells.values())
|
|
61
|
+
for (const c of l)
|
|
62
|
+
s.add(c);
|
|
63
|
+
return [...s];
|
|
64
|
+
}
|
|
65
|
+
for (let l = i; l <= m; l++)
|
|
66
|
+
for (let c = h; c <= o; c++)
|
|
67
|
+
for (const f of this._cells.get(`${l}:${c}`) ?? [])
|
|
68
|
+
s.add(f);
|
|
69
|
+
return [...s];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function A(t) {
|
|
73
|
+
const n = { minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
74
|
+
for (const r of t)
|
|
75
|
+
n.minX = Math.min(n.minX, r.minX), n.minY = Math.min(n.minY, r.minY), n.maxX = Math.max(n.maxX, r.maxX), n.maxY = Math.max(n.maxY, r.maxY);
|
|
76
|
+
if (t.length <= 8)
|
|
77
|
+
n.entries = t;
|
|
78
|
+
else {
|
|
79
|
+
const r = n.maxX - n.minX >= n.maxY - n.minY;
|
|
80
|
+
t.sort(r ? (a, s) => a.minX + a.maxX - s.minX - s.maxX : (a, s) => a.minY + a.maxY - s.minY - s.maxY);
|
|
81
|
+
const e = Math.floor(t.length / 2);
|
|
82
|
+
n.left = A(t.slice(0, e)), n.right = A(t.slice(e));
|
|
83
|
+
}
|
|
84
|
+
return n;
|
|
85
|
+
}
|
|
86
|
+
function F(t, n, r, e, a, s) {
|
|
87
|
+
if (!(!t || t.maxX < n || t.minX > e || t.maxY < r || t.minY > a)) {
|
|
88
|
+
if (t.entries) {
|
|
89
|
+
for (const i of t.entries)
|
|
90
|
+
i.maxX >= n && i.minX <= e && i.maxY >= r && i.minY <= a && s.push(i);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
F(t.left, n, r, e, a, s), F(t.right, n, r, e, a, s);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
T as G,
|
|
98
|
+
u as a,
|
|
99
|
+
b as c,
|
|
100
|
+
R as f,
|
|
101
|
+
$ as m,
|
|
102
|
+
E as r,
|
|
103
|
+
q as t
|
|
104
|
+
};
|