@reside-ic/skadi-chart 1.1.5 → 1.1.6

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.
@@ -39,10 +39,14 @@ declare module "types" {
39
39
  main: d3.ScaleBand<string>;
40
40
  bands: Record<string, ScaleNumeric>;
41
41
  };
42
- export type TickConfig = {
43
- count: number;
42
+ export type TickConfig<Domain> = {
43
+ padding?: number;
44
+ size?: number;
45
+ formatter?: (domainValue: Domain, index: number) => string;
46
+ } & (Domain extends number ? {
47
+ count?: number;
44
48
  specifier?: string;
45
- };
49
+ } : {});
46
50
  export type LayerArgs = {
47
51
  id: string;
48
52
  getHtmlId: (layer: LayerType) => string;
@@ -50,7 +54,10 @@ declare module "types" {
50
54
  clipPathBounds: Bounds;
51
55
  globals: {
52
56
  animationDuration: number;
53
- tickConfig: XY<TickConfig>;
57
+ tickConfig: {
58
+ numerical: XY<TickConfig<number>>;
59
+ categorical: XY<TickConfig<string>>;
60
+ };
54
61
  };
55
62
  scaleConfig: {
56
63
  numericalScales: XY<ScaleNumeric>;
@@ -211,10 +218,11 @@ declare module "layers/TooltipsLayer" {
211
218
  export type TooltipHtmlCallback<Metadata> = (pointWithMetadata: PointWithMetadata<Metadata>) => string;
212
219
  export class TooltipsLayer<Metadata> extends OptionalLayer {
213
220
  tooltipHtmlCallback: TooltipHtmlCallback<Metadata>;
221
+ radiusPx: number;
214
222
  distanceAxis?: AxisType;
215
223
  type: LayerType;
216
224
  tooltipRadiusSq: number;
217
- constructor(tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, distanceAxis?: AxisType);
225
+ constructor(tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, radiusPx?: number, distanceAxis?: AxisType);
218
226
  private getDistanceSq;
219
227
  private getDistanceSqSC;
220
228
  private convertSCPointToCC;
@@ -263,7 +271,7 @@ declare module "Chart" {
263
271
  import { TracesOptions } from "layers/TracesLayer";
264
272
  import { ZoomOptions } from "layers/ZoomLayer";
265
273
  import { TooltipHtmlCallback } from "layers/TooltipsLayer";
266
- import { AllOptionalLayers, Bounds, Lines, PartialScales, Scales, ScatterPoints, XY, XYLabel, ClipPathBounds } from "types";
274
+ import { AllOptionalLayers, Bounds, LayerArgs, Lines, PartialScales, Scales, ScatterPoints, XY, XYLabel, ClipPathBounds, TickConfig } from "types";
267
275
  import { LifecycleHooks, OptionalLayer } from "layers/Layer";
268
276
  export type ChartOptions = {
269
277
  logScale: XY<boolean>;
@@ -271,6 +279,10 @@ declare module "Chart" {
271
279
  type PartialChartOptions = {
272
280
  logScale?: Partial<XY<boolean>>;
273
281
  animationDuration?: number;
282
+ tickConfig?: {
283
+ numerical?: Partial<XY<Partial<TickConfig<number>>>>;
284
+ categorical?: Partial<XY<Partial<TickConfig<string>>>>;
285
+ };
274
286
  };
275
287
  type CategoricalScales = Partial<XY<string[]>>;
276
288
  export class Chart<Metadata = any> {
@@ -279,15 +291,7 @@ declare module "Chart" {
279
291
  isResponsive: boolean;
280
292
  globals: {
281
293
  animationDuration: number;
282
- tickConfig: {
283
- x: {
284
- count: number;
285
- };
286
- y: {
287
- count: number;
288
- specifier: string;
289
- };
290
- };
294
+ tickConfig: LayerArgs["globals"]["tickConfig"];
291
295
  };
292
296
  defaultMargin: {
293
297
  top: number;
@@ -306,7 +310,7 @@ declare module "Chart" {
306
310
  addTraces: (lines: Lines<Metadata>, options?: Partial<TracesOptions>) => this;
307
311
  addArea: () => this;
308
312
  addZoom: (options?: ZoomOptions) => this;
309
- addTooltips: (tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, distanceAxis?: "x" | "y") => this;
313
+ addTooltips: (tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, radiusPx?: number, distanceAxis?: "x" | "y") => this;
310
314
  private filterScatterPointsForLogAxis;
311
315
  private filterScatterPoints;
312
316
  addScatterPoints: (points: ScatterPoints<Metadata>) => this;