@reside-ic/skadi-chart 1.1.13 → 1.1.15
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/README.md +9 -0
- package/dist/skadi-chart.d.ts +38 -38
- package/dist/skadi-chart.js +1198 -1191
- package/dist/skadi-chart.umd.cjs +4 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -282,3 +282,12 @@ any functions that will remove layers after the chart is appended to the DOM.
|
|
|
282
282
|
The pattern we use for reactivity outside of the scope of lifecycle hooks is to recreate the
|
|
283
283
|
chart from scratch. The `appendTo` function will remove anything inside the chart `div` and
|
|
284
284
|
append the new `Chart` into it. To see examples of reactivity see [here](./src/demo/App.vue).
|
|
285
|
+
|
|
286
|
+
### Note for performance regarding reactivity
|
|
287
|
+
|
|
288
|
+
Proxy objects can degrade performance. Frameworks like Vue proxy objects for reactivity or
|
|
289
|
+
you may be manually creating them. Skadi chart does not modify arguments passed into it
|
|
290
|
+
(i.e. does not use setters for any argument) however, Skadi chart does use getters many times
|
|
291
|
+
as different layers scan your arguments, particularly your data. If you are experiencing
|
|
292
|
+
performance issues, make sure to remove the proxy or remove getters. For example, in Vue
|
|
293
|
+
you can use `markRaw` or `shallowRef` to prevent Vue from creating deep proxy objects.
|
package/dist/skadi-chart.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare module "d3" {
|
|
|
6
6
|
export { create, type BaseType, type Selection, type ClientPointEvent, pointer } from "d3-selection";
|
|
7
7
|
export { brush, type D3BrushEvent } from "d3-brush";
|
|
8
8
|
export { scaleBand, scaleLinear, scaleLog, type NumberValue, type ScaleBand, type ScaleContinuousNumeric } from "d3-scale";
|
|
9
|
+
export { format } from "d3-format";
|
|
9
10
|
}
|
|
10
11
|
declare module "types" {
|
|
11
12
|
import { ChartOptions } from "Chart";
|
|
@@ -137,22 +138,51 @@ declare module "layers/Layer" {
|
|
|
137
138
|
}
|
|
138
139
|
export type LifecycleHooks = Omit<OptionalLayer, "type" | "properties" | "draw">;
|
|
139
140
|
}
|
|
141
|
+
declare module "layers/ScatterLayer" {
|
|
142
|
+
import { LayerArgs, ScatterPoints } from "types";
|
|
143
|
+
import { LayerType, OptionalLayer } from "layers/Layer";
|
|
144
|
+
export class ScatterLayer<Metadata> extends OptionalLayer {
|
|
145
|
+
points: ScatterPoints<Metadata>;
|
|
146
|
+
type: LayerType;
|
|
147
|
+
constructor(points: ScatterPoints<Metadata>);
|
|
148
|
+
draw: (layerArgs: LayerArgs) => void;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
declare module "layers/TracesLayer" {
|
|
152
|
+
import { LayerArgs, Lines, Point, ZoomExtents } from "types";
|
|
153
|
+
import { LayerType, OptionalLayer } from "layers/Layer";
|
|
154
|
+
export type TracesOptions = {
|
|
155
|
+
RDPEpsilon: number | null;
|
|
156
|
+
};
|
|
157
|
+
export const RDPAlgorithm: (linesSC: Point[][], epsilon: number) => Point[][];
|
|
158
|
+
export class TracesLayer<Metadata> extends OptionalLayer {
|
|
159
|
+
linesDC: Lines<Metadata>;
|
|
160
|
+
options: TracesOptions;
|
|
161
|
+
type: LayerType;
|
|
162
|
+
private traces;
|
|
163
|
+
lowResLinesSC: Point[][];
|
|
164
|
+
getNewPoint: null | ((x: number, y: number, t: number) => Point);
|
|
165
|
+
getNewPointInverse: null | ((x: number, y: number, t: number) => Point);
|
|
166
|
+
constructor(linesDC: Lines<Metadata>, options: TracesOptions);
|
|
167
|
+
private customTween;
|
|
168
|
+
private updateLowResLinesSC;
|
|
169
|
+
draw: (layerArgs: LayerArgs, currentExtentsDC: ZoomExtents) => void;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
140
172
|
declare module "helpers" {
|
|
141
|
-
import {
|
|
173
|
+
import { ScatterLayer } from "layers/ScatterLayer";
|
|
174
|
+
import { TracesLayer } from "layers/TracesLayer";
|
|
175
|
+
import { LayerArgs, ScaleNumeric, XY, Point, Scales, AxisType, D3Selection, PointWithMetadata } from "types";
|
|
142
176
|
export const customLineGen: (lineSC: Point[], layerArgs: LayerArgs) => string[];
|
|
143
177
|
export const numScales: (bands: Partial<XY<string>> | undefined, layerArgs: LayerArgs) => XY<ScaleNumeric>;
|
|
144
|
-
export const getXYMinMax: (
|
|
178
|
+
export const getXYMinMax: <Metadata>(traceLayers: TracesLayer<Metadata>[], scatterLayers: ScatterLayer<Metadata>[]) => Scales;
|
|
145
179
|
export const getSvgRectPath: (xStart: number, xEnd: number, yStart: number, yEnd: number) => string;
|
|
146
180
|
export const mapScales: <T>(layerArgs: LayerArgs, callback: (scale: ScaleNumeric, axis: AxisType) => T) => [Record<string, T>, Record<string, Record<string, T>>];
|
|
147
181
|
export const drawLine: (baseLayer: D3Selection<SVGGElement>, coordsSC: XY<{
|
|
148
182
|
start: number;
|
|
149
183
|
end: number;
|
|
150
184
|
}>, color: string) => import("d3-selection").Selection<SVGLineElement, Point, null, undefined>;
|
|
151
|
-
export
|
|
152
|
-
timeout: NodeJS.Timeout | undefined;
|
|
153
|
-
time: number;
|
|
154
|
-
};
|
|
155
|
-
export const debounce: (cfg: DebounceConfig, callback: () => any) => void;
|
|
185
|
+
export const iterateOverPoints: <Metadata>(traceLayers: TracesLayer<Metadata>[], scatterLayers: ScatterLayer<Metadata>[], callback: (point: PointWithMetadata<Metadata>) => void) => void;
|
|
156
186
|
}
|
|
157
187
|
declare module "layers/AxesLayer" {
|
|
158
188
|
import { LayerType, OptionalLayer } from "layers/Layer";
|
|
@@ -174,27 +204,6 @@ declare module "layers/AxesLayer" {
|
|
|
174
204
|
private axisConfig;
|
|
175
205
|
}
|
|
176
206
|
}
|
|
177
|
-
declare module "layers/TracesLayer" {
|
|
178
|
-
import { LayerArgs, Lines, Point, ZoomExtents } from "types";
|
|
179
|
-
import { LayerType, OptionalLayer } from "layers/Layer";
|
|
180
|
-
export type TracesOptions = {
|
|
181
|
-
RDPEpsilon: number | null;
|
|
182
|
-
};
|
|
183
|
-
export const RDPAlgorithm: (linesSC: Point[][], epsilon: number) => Point[][];
|
|
184
|
-
export class TracesLayer<Metadata> extends OptionalLayer {
|
|
185
|
-
linesDC: Lines<Metadata>;
|
|
186
|
-
options: TracesOptions;
|
|
187
|
-
type: LayerType;
|
|
188
|
-
private traces;
|
|
189
|
-
lowResLinesSC: Point[][];
|
|
190
|
-
getNewPoint: null | ((x: number, y: number, t: number) => Point);
|
|
191
|
-
getNewPointInverse: null | ((x: number, y: number, t: number) => Point);
|
|
192
|
-
constructor(linesDC: Lines<Metadata>, options: TracesOptions);
|
|
193
|
-
private customTween;
|
|
194
|
-
private updateLowResLinesSC;
|
|
195
|
-
draw: (layerArgs: LayerArgs, currentExtentsDC: ZoomExtents) => void;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
207
|
declare module "layers/ZoomLayer" {
|
|
199
208
|
import { LayerType, OptionalLayer } from "layers/Layer";
|
|
200
209
|
import { D3Selection, LayerArgs } from "types";
|
|
@@ -215,16 +224,6 @@ declare module "layers/ZoomLayer" {
|
|
|
215
224
|
draw: (layerArgs: LayerArgs) => void;
|
|
216
225
|
}
|
|
217
226
|
}
|
|
218
|
-
declare module "layers/ScatterLayer" {
|
|
219
|
-
import { LayerArgs, ScatterPoints } from "types";
|
|
220
|
-
import { LayerType, OptionalLayer } from "layers/Layer";
|
|
221
|
-
export class ScatterLayer<Metadata> extends OptionalLayer {
|
|
222
|
-
points: ScatterPoints<Metadata>;
|
|
223
|
-
type: LayerType;
|
|
224
|
-
constructor(points: ScatterPoints<Metadata>);
|
|
225
|
-
draw: (layerArgs: LayerArgs) => void;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
227
|
declare module "layers/TooltipsLayer" {
|
|
229
228
|
import { LayerType, OptionalLayer } from "layers/Layer";
|
|
230
229
|
import { AxisType, LayerArgs, PointWithMetadata } from "types";
|
|
@@ -302,6 +301,7 @@ declare module "Chart" {
|
|
|
302
301
|
categorical?: Partial<XY<Partial<TickConfig<string>>>>;
|
|
303
302
|
};
|
|
304
303
|
};
|
|
304
|
+
export const defaultFormatter: (val: number) => string;
|
|
305
305
|
export class Chart<Metadata = any> {
|
|
306
306
|
id: string;
|
|
307
307
|
optionalLayers: AllOptionalLayers[];
|