Skip to content

Commit

Permalink
remove refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
KleinMichalGit committed Aug 16, 2023
1 parent 353a4eb commit cd80e17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
5 changes: 3 additions & 2 deletions packages/charts/src/core/plugins/zoom-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// THE SOFTWARE.

import { BrushBehavior, BrushSelection, brushX } from "d3-brush";
import { event } from "d3-selection";
import defaultsDeep from "lodash/defaultsDeep";
import isEmpty from "lodash/isEmpty";
import isUndefined from "lodash/isUndefined";
Expand Down Expand Up @@ -116,10 +117,10 @@ export class ZoomPlugin extends ChartPlugin {
this.chart
.getGrid()
.getInteractiveArea()
.on("pointerdown", (event) =>
.on("pointerdown", () =>
event.target.setPointerCapture(event.pointerId)
)
.on("pointerup", (event) =>
.on("pointerup", () =>
event.target.releasePointerCapture(event.pointerId)
);
}
Expand Down
39 changes: 1 addition & 38 deletions packages/charts/src/renderers/bar/bar-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,24 +271,6 @@ export class BarRenderer extends XYRenderer<IRectangleAccessors> {
return data;
}

private getAccessor(
name: string,
dataSeries: IDataSeries<IRectangleAccessors>,
accessors: IRectangleDataAccessors,
accessorSuffix: string
): any {
const accessor =
(name: string) => (d: any, i: number, arr: ArrayLike<unknown>) =>
accessors[name + accessorSuffix]?.(
d,
i,
Array.from(arr),
dataSeries
);

return accessor(name);
}

public getDomain(
data: any[],
dataSeries: IDataSeries<IRectangleAccessors>,
Expand All @@ -308,26 +290,7 @@ export class BarRenderer extends XYRenderer<IRectangleAccessors> {
if (scale.isContinuous()) {
return !data || data.length === 0
? EMPTY_CONTINUOUS_DOMAIN
: [
min(
data,
this.getAccessor(
"start",
dataSeries,
accessors,
accessorSuffix
)
),
max(
data,
this.getAccessor(
"start",
dataSeries,
accessors,
accessorSuffix
)
),
];
: [min(data, accessor("start")), max(data, accessor("end"))];
} else {
const values =
data && data.length > 0 ? data.map(accessor("start")) : [];
Expand Down

0 comments on commit cd80e17

Please sign in to comment.