@reside-ic/skadi-chart 1.1.13 → 1.1.14

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 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.
@@ -137,22 +137,51 @@ declare module "layers/Layer" {
137
137
  }
138
138
  export type LifecycleHooks = Omit<OptionalLayer, "type" | "properties" | "draw">;
139
139
  }
140
+ declare module "layers/ScatterLayer" {
141
+ import { LayerArgs, ScatterPoints } from "types";
142
+ import { LayerType, OptionalLayer } from "layers/Layer";
143
+ export class ScatterLayer<Metadata> extends OptionalLayer {
144
+ points: ScatterPoints<Metadata>;
145
+ type: LayerType;
146
+ constructor(points: ScatterPoints<Metadata>);
147
+ draw: (layerArgs: LayerArgs) => void;
148
+ }
149
+ }
150
+ declare module "layers/TracesLayer" {
151
+ import { LayerArgs, Lines, Point, ZoomExtents } from "types";
152
+ import { LayerType, OptionalLayer } from "layers/Layer";
153
+ export type TracesOptions = {
154
+ RDPEpsilon: number | null;
155
+ };
156
+ export const RDPAlgorithm: (linesSC: Point[][], epsilon: number) => Point[][];
157
+ export class TracesLayer<Metadata> extends OptionalLayer {
158
+ linesDC: Lines<Metadata>;
159
+ options: TracesOptions;
160
+ type: LayerType;
161
+ private traces;
162
+ lowResLinesSC: Point[][];
163
+ getNewPoint: null | ((x: number, y: number, t: number) => Point);
164
+ getNewPointInverse: null | ((x: number, y: number, t: number) => Point);
165
+ constructor(linesDC: Lines<Metadata>, options: TracesOptions);
166
+ private customTween;
167
+ private updateLowResLinesSC;
168
+ draw: (layerArgs: LayerArgs, currentExtentsDC: ZoomExtents) => void;
169
+ }
170
+ }
140
171
  declare module "helpers" {
141
- import { LayerArgs, ScaleNumeric, XY, Point, Scales, AxisType, D3Selection } from "types";
172
+ import { ScatterLayer } from "layers/ScatterLayer";
173
+ import { TracesLayer } from "layers/TracesLayer";
174
+ import { LayerArgs, ScaleNumeric, XY, Point, Scales, AxisType, D3Selection, PointWithMetadata } from "types";
142
175
  export const customLineGen: (lineSC: Point[], layerArgs: LayerArgs) => string[];
143
176
  export const numScales: (bands: Partial<XY<string>> | undefined, layerArgs: LayerArgs) => XY<ScaleNumeric>;
144
- export const getXYMinMax: (points: Point[]) => Scales;
177
+ export const getXYMinMax: <Metadata>(traceLayers: TracesLayer<Metadata>[], scatterLayers: ScatterLayer<Metadata>[]) => Scales;
145
178
  export const getSvgRectPath: (xStart: number, xEnd: number, yStart: number, yEnd: number) => string;
146
179
  export const mapScales: <T>(layerArgs: LayerArgs, callback: (scale: ScaleNumeric, axis: AxisType) => T) => [Record<string, T>, Record<string, Record<string, T>>];
147
180
  export const drawLine: (baseLayer: D3Selection<SVGGElement>, coordsSC: XY<{
148
181
  start: number;
149
182
  end: number;
150
183
  }>, color: string) => import("d3-selection").Selection<SVGLineElement, Point, null, undefined>;
151
- export type DebounceConfig = {
152
- timeout: NodeJS.Timeout | undefined;
153
- time: number;
154
- };
155
- export const debounce: (cfg: DebounceConfig, callback: () => any) => void;
184
+ export const iterateOverPoints: <Metadata>(traceLayers: TracesLayer<Metadata>[], scatterLayers: ScatterLayer<Metadata>[], callback: (point: PointWithMetadata<Metadata>) => void) => void;
156
185
  }
157
186
  declare module "layers/AxesLayer" {
158
187
  import { LayerType, OptionalLayer } from "layers/Layer";
@@ -174,27 +203,6 @@ declare module "layers/AxesLayer" {
174
203
  private axisConfig;
175
204
  }
176
205
  }
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
206
  declare module "layers/ZoomLayer" {
199
207
  import { LayerType, OptionalLayer } from "layers/Layer";
200
208
  import { D3Selection, LayerArgs } from "types";
@@ -215,16 +223,6 @@ declare module "layers/ZoomLayer" {
215
223
  draw: (layerArgs: LayerArgs) => void;
216
224
  }
217
225
  }
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
226
  declare module "layers/TooltipsLayer" {
229
227
  import { LayerType, OptionalLayer } from "layers/Layer";
230
228
  import { AxisType, LayerArgs, PointWithMetadata } from "types";