From d14465db34b64f8298eb3b9174103393a5fd54d7 Mon Sep 17 00:00:00 2001 From: vargburz Date: Mon, 20 Nov 2023 19:19:47 +0300 Subject: [PATCH 1/2] remove unused methods --- src/index.ts | 43 ------------------------------------------- src/types.ts | 8 ++++---- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/index.ts b/src/index.ts index ac4eb65..66c46d4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -807,37 +807,6 @@ abstract class ChartwerkPod { this.options.callbackZoomOut(centers); } - getd3TimeRangeEvery(count: number): d3.TimeInterval { - if(this.options.allOptions.timeInterval.timeFormat === undefined) { - return d3.timeMinute.every(count); - } - switch(this.options.allOptions.timeInterval.timeFormat) { - case TimeFormat.SECOND: - return d3.utcSecond.every(count); - case TimeFormat.MINUTE: - return d3.utcMinute.every(count); - case TimeFormat.HOUR: - return d3.utcHour.every(count); - case TimeFormat.DAY: - return d3.utcDay.every(count); - case TimeFormat.MONTH: - return d3.utcMonth.every(count); - case TimeFormat.YEAR: - return d3.utcYear.every(count); - default: - return d3.utcMinute.every(count); - } - } - - get serieTimestampRange(): number | undefined { - if(!this.series.isSeriesAvailable) { - return undefined; - } - const startTimestamp = first(this.series.visibleSeries[0].datapoints)[0]; - const endTimestamp = last(this.series.visibleSeries[0].datapoints)[0]; - return (endTimestamp - startTimestamp) / 1000; - } - getAxisTicksFormatter(axisOptions: AxisOption): (d: any, i: number) => any { // TODO: ticksCount === 0 -> suspicious option if(axisOptions.ticksCount === 0) { @@ -868,18 +837,6 @@ abstract class ChartwerkPod { } } - get timeInterval(): number { - if(this.series.isSeriesAvailable && this.series.visibleSeries[0].datapoints.length > 1) { - const interval = this.series.visibleSeries[0].datapoints[1][0] - this.series.visibleSeries[0].datapoints[0][0]; - return interval; - } - if(this.options.allOptions.timeInterval.count !== undefined) { - //TODO: timeFormat to timestamp - return this.options.allOptions.timeInterval.count * MILISECONDS_IN_MINUTE; - } - return MILISECONDS_IN_MINUTE; - } - get width(): number { return this.d3Node.node().clientWidth - this.margin.left - this.margin.right; } diff --git a/src/types.ts b/src/types.ts index 91d29e7..94c69f2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -148,10 +148,10 @@ export enum yAxisOrientation { RIGHT = 'right', } export type SvgElParams = { - height: number, - width: number, - xScale: d3.ScaleLinear, - yScale: d3.ScaleLinear, + height: number; + width: number; + xScale: d3.ScaleLinear; + yScale: d3.ScaleLinear; } export type ZoomEvents = { -- 2.34.1 From 509a79d93dd99328eba88a211fc3d8196fb2f056 Mon Sep 17 00:00:00 2001 From: vargburz Date: Mon, 20 Nov 2023 19:25:43 +0300 Subject: [PATCH 2/2] remove unused options --- README.md | 17 ----------------- src/models/options.ts | 5 ----- src/types.ts | 4 ---- 3 files changed, 26 deletions(-) diff --git a/README.md b/README.md index c640e1a..f79fade 100755 --- a/README.md +++ b/README.md @@ -64,23 +64,6 @@ margin = { ['red', 'blue', 'green'] ``` -- `timeInterval`: interval in minutes (max value = 60) affecting grid and x-axis ticks. - -- `tickFormat`: config to control the axes ticks format. -```js -{ - xAxis: string; // x-axis time format (see [d3-time-format](https://github.com/d3/d3-time-format#locale_format) } - xTickOrientation: TickOrientation; // horizontal, diagonal or vertical orientation -} -``` -for example: -```js -{ - xAxis: '%Y-%m-%d %H:%M', - xTickOrientation: TickOrientation.DIAGONAL -} -``` - - `labelFormat`: labels for axes. ``` { diff --git a/src/models/options.ts b/src/models/options.ts index 1f414f3..791a5df 100644 --- a/src/models/options.ts +++ b/src/models/options.ts @@ -90,11 +90,6 @@ export const CORE_DEFAULT_OPTIONS: Options = { crosshair: DEFAULT_CROSSHAIR_OPTIONS, renderLegend: true, margin: DEFAULT_MARGIN, - // remove options below - renderTicksfromTimestamps: false, - timeInterval: { - timeFormat: TimeFormat.MINUTE - }, eventsCallbacks: {}, } diff --git a/src/types.ts b/src/types.ts index 94c69f2..ba6356b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -34,10 +34,6 @@ export type Options = { axis?: AxesOptions; grid?: GridOptions; crosshair?: CrosshairOptions; - timeInterval?: { - timeFormat?: TimeFormat; - count?: number; - }; zoomEvents?: ZoomEvents; renderTicksfromTimestamps?: boolean; renderLegend?: boolean; -- 2.34.1