@reside-ic/skadi-chart 1.1.5 → 1.1.7-alpha.0

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,15 @@ 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
+ rotate?: number;
47
+ } & (Domain extends number ? {
48
+ count?: number;
44
49
  specifier?: string;
45
- };
50
+ } : {});
46
51
  export type LayerArgs = {
47
52
  id: string;
48
53
  getHtmlId: (layer: LayerType) => string;
@@ -50,7 +55,10 @@ declare module "types" {
50
55
  clipPathBounds: Bounds;
51
56
  globals: {
52
57
  animationDuration: number;
53
- tickConfig: XY<TickConfig>;
58
+ tickConfig: {
59
+ numerical: XY<TickConfig<number>>;
60
+ categorical: XY<TickConfig<string>>;
61
+ };
54
62
  };
55
63
  scaleConfig: {
56
64
  numericalScales: XY<ScaleNumeric>;
@@ -140,6 +148,7 @@ declare module "layers/AxesLayer" {
140
148
  constructor(labels: XYLabel, labelPositions: XY<number>);
141
149
  private drawAxis;
142
150
  draw: (layerArgs: LayerArgs) => void;
151
+ private rotateTickLabels;
143
152
  private drawCategoricalAxis;
144
153
  private drawNumericalAxis;
145
154
  private drawLinePerpendicularToAxis;
@@ -211,10 +220,11 @@ declare module "layers/TooltipsLayer" {
211
220
  export type TooltipHtmlCallback<Metadata> = (pointWithMetadata: PointWithMetadata<Metadata>) => string;
212
221
  export class TooltipsLayer<Metadata> extends OptionalLayer {
213
222
  tooltipHtmlCallback: TooltipHtmlCallback<Metadata>;
223
+ radiusPx: number;
214
224
  distanceAxis?: AxisType;
215
225
  type: LayerType;
216
226
  tooltipRadiusSq: number;
217
- constructor(tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, distanceAxis?: AxisType);
227
+ constructor(tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, radiusPx?: number, distanceAxis?: AxisType);
218
228
  private getDistanceSq;
219
229
  private getDistanceSqSC;
220
230
  private convertSCPointToCC;
@@ -263,7 +273,7 @@ declare module "Chart" {
263
273
  import { TracesOptions } from "layers/TracesLayer";
264
274
  import { ZoomOptions } from "layers/ZoomLayer";
265
275
  import { TooltipHtmlCallback } from "layers/TooltipsLayer";
266
- import { AllOptionalLayers, Bounds, Lines, PartialScales, Scales, ScatterPoints, XY, XYLabel, ClipPathBounds } from "types";
276
+ import { AllOptionalLayers, Bounds, LayerArgs, Lines, PartialScales, Scales, ScatterPoints, XY, XYLabel, ClipPathBounds, TickConfig } from "types";
267
277
  import { LifecycleHooks, OptionalLayer } from "layers/Layer";
268
278
  export type ChartOptions = {
269
279
  logScale: XY<boolean>;
@@ -271,6 +281,10 @@ declare module "Chart" {
271
281
  type PartialChartOptions = {
272
282
  logScale?: Partial<XY<boolean>>;
273
283
  animationDuration?: number;
284
+ tickConfig?: {
285
+ numerical?: Partial<XY<Partial<TickConfig<number>>>>;
286
+ categorical?: Partial<XY<Partial<TickConfig<string>>>>;
287
+ };
274
288
  };
275
289
  type CategoricalScales = Partial<XY<string[]>>;
276
290
  export class Chart<Metadata = any> {
@@ -279,15 +293,7 @@ declare module "Chart" {
279
293
  isResponsive: boolean;
280
294
  globals: {
281
295
  animationDuration: number;
282
- tickConfig: {
283
- x: {
284
- count: number;
285
- };
286
- y: {
287
- count: number;
288
- specifier: string;
289
- };
290
- };
296
+ tickConfig: LayerArgs["globals"]["tickConfig"];
291
297
  };
292
298
  defaultMargin: {
293
299
  top: number;
@@ -306,7 +312,7 @@ declare module "Chart" {
306
312
  addTraces: (lines: Lines<Metadata>, options?: Partial<TracesOptions>) => this;
307
313
  addArea: () => this;
308
314
  addZoom: (options?: ZoomOptions) => this;
309
- addTooltips: (tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, distanceAxis?: "x" | "y") => this;
315
+ addTooltips: (tooltipHtmlCallback: TooltipHtmlCallback<Metadata>, radiusPx?: number, distanceAxis?: "x" | "y") => this;
310
316
  private filterScatterPointsForLogAxis;
311
317
  private filterScatterPoints;
312
318
  addScatterPoints: (points: ScatterPoints<Metadata>) => this;