Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobp100 committed Jan 7, 2025
1 parent 0e74939 commit f900390
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/ag-charts-community/src/chart/axis/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ export abstract class Axis<
this.animatable = animatable;
}

_scaleNiceDomainRange: number = NaN;
_scaleNiceDomainRangeExtent: number = NaN;
calculateLayout(initialPrimaryTickCount?: number) {
const { scale, label, visibleRange, nice } = this;

Expand All @@ -483,15 +483,15 @@ export abstract class Axis<

this.updateScale();

const range = findRangeExtent(this.range);
const rangeExtent = findRangeExtent(this.range);

const domain = this.dataDomain.domain;
let tickLayoutDomain: D[] | undefined;
if (visibleRange[0] === 0 && visibleRange[1] === 1) {
tickLayoutDomain = undefined;
} else if (!nice) {
tickLayoutDomain = domain;
} else if (this._scaleNiceDomainRange === range) {
} else if (this._scaleNiceDomainRangeExtent === rangeExtent) {
tickLayoutDomain = this.scale.domain;
} else {
tickLayoutDomain = this.calculateTickLayout(domain, NiceMode.TickAndDomain, [0, 1]).niceDomain;
Expand All @@ -514,7 +514,7 @@ export abstract class Axis<

this.scale.domain = niceDomain;

this._scaleNiceDomainRange = nice ? range : NaN;
this._scaleNiceDomainRangeExtent = nice ? rangeExtent : NaN;

const specifier = label.format;
this.labelFormatter =
Expand Down
8 changes: 4 additions & 4 deletions packages/ag-charts-community/src/scale/timeScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function getDefaultDateTicks({
visibleRange: [number, number];
}) {
const t = getTickInterval(start, stop, tickCount, minTickCount, maxTickCount);
return t ? t.range(new Date(start), new Date(stop), undefined, visibleRange) : []; // inclusive stop
return t ? t.range(new Date(start), new Date(stop), { visibleRange }) : []; // inclusive stop
}

export function getDateTicksForInterval({
Expand All @@ -132,7 +132,7 @@ export function getDateTicksForInterval({
}

if (interval instanceof TimeInterval) {
const ticks = interval.range(new Date(start), new Date(stop), undefined, visibleRange);
const ticks = interval.range(new Date(start), new Date(stop), { visibleRange });
if (isDenseInterval(ticks.length, availableRange)) {
return;
}
Expand All @@ -148,7 +148,7 @@ export function getDateTicksForInterval({

if (timeInterval) {
const i = timeInterval.timeInterval.every(absInterval / (timeInterval.duration / timeInterval.step));
return i.range(new Date(start), new Date(stop), undefined, visibleRange);
return i.range(new Date(start), new Date(stop), { visibleRange });
}

let date = new Date(start);
Expand Down Expand Up @@ -183,7 +183,7 @@ function updateNiceDomainIteration(d0: Date, d1: Date, ticks: ScaleTickParams<Ti
}

if (i) {
const intervalRange = i.range(new Date(start), new Date(stop), true);
const intervalRange = i.range(new Date(start), new Date(stop), { extend: true });
const domain = isReversed ? [...intervalRange].reverse() : intervalRange;
const n0 = domain[0];
const n1 = domain.at(-1)!;
Expand Down
6 changes: 5 additions & 1 deletion packages/ag-charts-community/src/util/time/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export class TimeInterval {
* @param stop Range end.
* @param extend If specified, the requested range will be extended to the closest "nice" values.
*/
range(start: Date, stop: Date, extend: boolean = false, visibleRange?: [number, number]): Date[] {
range(
start: Date,
stop: Date,
{ extend = false, visibleRange }: { extend?: boolean; visibleRange?: [number, number] } = {}
): Date[] {
const rangeCallback = this._rangeCallback?.(start, stop);

const e0 = this._encode(extend ? this.floor(start) : this.ceil(start));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export class RangeMask extends Path {

clippedRoundRect(path, ax, ay, aw, ah, cornerRadiusParams, new BBox(ax, ay, minX - ax, ah));
clippedRoundRect(path, ax, ay, aw, ah, cornerRadiusParams, new BBox(maxX, ay, aw + ax - maxX, ah));
clippedRoundRect(visiblePath, ax, ay, aw, ah, cornerRadiusParams, new BBox(minX, ay, maxX - minX, ah));
if (maxX - minX > 1) {
clippedRoundRect(visiblePath, ax, ay, aw, ah, cornerRadiusParams, new BBox(minX, ay, maxX - minX, ah));
}
}

protected override renderStroke(ctx: _ModuleSupport.CanvasContext, path?: Path2D): void {
Expand Down

0 comments on commit f900390

Please sign in to comment.