Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Chore] Minor ts refactoring (#2825)

Igor Dykhtaaec75d819453
diff --git a/src/components/src/common/range-slider.tsx b/src/components/src/common/range-slider.tsx
index f56a66652..afbfbb4f5 100644
--- a/src/components/src/common/range-slider.tsx
+++ b/src/components/src/common/range-slider.tsx
@@ -239,8 +239,8 @@ export default function RangeSliderFactory(
timeFormat,
playbackControlWidth,
setFilterPlot,
- subAnimations: subAnimations,
animationWindow,
+ subAnimations: subAnimations,
filter,
datasets
} = this.props;
diff --git a/src/constants/src/time.ts b/src/constants/src/time.ts
index 562d13ab0..d874a0a1f 100644
--- a/src/constants/src/time.ts
+++ b/src/constants/src/time.ts
@@ -2,8 +2,6 @@
// Copyright contributors to the kepler.gl project
import keyMirror from 'keymirror';
-import {AGGREGATION_TYPES, PLOT_TYPES} from './';
-
import {
utcDay,
utcHour,
@@ -15,7 +13,9 @@ import {
utcYear
} from 'd3-time';
-type ValueOf<T> = T[keyof T];
+import {ValueOf} from '@kepler.gl/types';
+
+import {AGGREGATION_TYPES, PLOT_TYPES} from './';
export interface IntervalOption {
label: string;
diff --git a/src/utils/src/plot.ts b/src/utils/src/plot.ts
index 9b02720d0..614820d73 100644
--- a/src/utils/src/plot.ts
+++ b/src/utils/src/plot.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import {bisectLeft, bisector, extent, histogram as d3Histogram, ticks} from 'd3-array';
+import {bisectLeft, extent, histogram as d3Histogram, ticks} from 'd3-array';
import isEqual from 'lodash.isequal';
import {getFilterMappedValue, getInitialInterval, intervalToFunction} from './time';
import moment from 'moment';
@@ -446,28 +446,6 @@ export function splitSeries(series) {
return {lines, markers};
}
-export function filterSeriesByRange(series, range) {
- if (!series) {
- return [];
- }
- const [start, end] = range;
- const inRange: any[] = [];
-
- for (const serie of series) {
- if (!serie.length) {
- // eslint-disable-next-line no-console, no-undef
- console.warn('Serie shouldnt be empty', series);
- }
-
- const i0 = bisector((s: {x: any}) => s.x).left(serie, start);
- const i1 = bisector((s: {x: any}) => s.x).right(serie, end);
- const sliced = serie.slice(i0, i1);
- if (sliced.length) inRange.push(sliced);
- }
-
- return inRange;
-}
-
export function adjustValueToAnimationWindow(state: VisState, filter: TimeRangeFilter) {
const {
plotType,
@@ -637,7 +615,10 @@ export function updateRangeFilterPlotType(
};
}
-export function getChartTitle(yAxis, plotType: {aggregation: string}) {
+export function getChartTitle(
+ yAxis: {displayName?: string},
+ plotType: {aggregation: string}
+): string {
const yAxisName = yAxis?.displayName;
const {aggregation} = plotType;