Skip to content

Scene perf 2 #4246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/ag-charts-community/src/chart/chartAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { ModuleContextWithParent } from '../module/moduleContext';
import type { ModuleMap } from '../module/moduleMap';
import type { Scale } from '../scale/scale';
import type { BBox } from '../scene/bbox';
import type { Node } from '../scene/node';
import type { Group } from '../scene/group';
import type { TransformableText } from '../scene/shape/text';
import type { Padding } from '../util/padding';
import type { AxisPrimaryTickCount } from '../util/secondaryAxisTicks';
Expand Down Expand Up @@ -43,12 +43,12 @@ interface AxisLayoutConstraints {
}

export interface AxisGroups {
axisNode: Node;
gridNode: Node;
crossLineRangeNode: Node;
crossLineLineNode: Node;
crossLineLabelNode: Node;
labelNode: Node;
axisNode: Group;
gridNode: Group;
crossLineRangeNode: Group;
crossLineLineNode: Group;
crossLineLabelNode: Group;
labelNode: Group;
}

export interface ChartAxis {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class LegendMarkerLabel extends Translatable(Group) {
this.label.x = length + spacing;
}

protected override computeBBox(): BBox {
protected override computeBBox(): BBox | undefined {
this.layout();
return super.computeBBox();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { clamp, createId } from 'ag-charts-core';
import type { AgChartLegendOrientation, AgMarkerShape, FontStyle, FontWeight } from 'ag-charts-types';

import { TranslatableGroup } from '../../scene/group';
import type { Node } from '../../scene/node';
import { Group, TranslatableGroup } from '../../scene/group';
import { Text } from '../../scene/shape/text';
import { type RotatableType, Transformable } from '../../scene/transformable';
import { BaseProperties } from '../../util/properties';
Expand Down Expand Up @@ -308,7 +307,7 @@ export class Pagination extends BaseProperties {
this.chartUpdateCallback(ChartUpdateType.SCENE_RENDER);
}

attachPagination(node: Node) {
attachPagination(node: Group) {
node.append(this.group);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { pathMotion } from '../../../motion/pathMotion';
import { resetMotion } from '../../../motion/resetMotion';
import { BBox } from '../../../scene/bbox';
import { Group } from '../../../scene/group';
import type { Node } from '../../../scene/node';
import { PointerEvents } from '../../../scene/node';
import type { SizedPoint } from '../../../scene/point';
import type { Selection } from '../../../scene/selection';
Expand Down Expand Up @@ -127,16 +126,16 @@ export class AreaSeries extends CartesianSeries<
);
}

override attachSeries(seriesContentNode: Node, seriesNode: Node, annotationNode: Node | undefined): void {
override attachSeries(seriesContentNode: Group, seriesNode: Group, annotationNode: Group | undefined): void {
super.attachSeries(seriesContentNode, seriesNode, annotationNode);

seriesContentNode.appendChild(this.backgroundGroup);
}

override detachSeries(
seriesContentNode: Node | undefined,
seriesNode: Node,
annotationNode: Node | undefined
seriesContentNode: Group | undefined,
seriesNode: Group,
annotationNode: Group | undefined
): void {
super.detachSeries(seriesContentNode, seriesNode, annotationNode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,16 @@ export abstract class CartesianSeries<
);
}

override attachSeries(seriesContentNode: Node, seriesNode: Node, annotationNode: Node | undefined): void {
override attachSeries(seriesContentNode: Group, seriesNode: Group, annotationNode: Group | undefined): void {
super.attachSeries(seriesContentNode, seriesNode, annotationNode);

this.attachPaths(this.paths, seriesNode, annotationNode);
}

override detachSeries(
seriesContentNode: Node | undefined,
seriesNode: Node,
annotationNode: Node | undefined
seriesContentNode: Group | undefined,
seriesNode: Group,
annotationNode: Group | undefined
): void {
super.detachSeries(seriesContentNode, seriesNode, annotationNode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { AgHistogramBinDatum } from 'ag-charts-types';
import type { ModuleContext } from '../../../module/moduleContext';
import { fromToMotion } from '../../../motion/fromToMotion';
import type { BBox } from '../../../scene/bbox';
import { Group } from '../../../scene/group';
import { PointerEvents } from '../../../scene/node';
import type { Point } from '../../../scene/point';
import type { Selection } from '../../../scene/selection';
Expand Down Expand Up @@ -485,7 +486,7 @@ export class HistogramSeries extends CartesianSeries<

protected override initQuadTree(quadtree: QuadtreeNearest<HistogramNodeDatum>) {
const { value: childNode } = this.contentGroup.children().next();
if (childNode) {
if (childNode instanceof Group) {
addHitTestersToQuadtree(quadtree, childNode.children() as Iterable<Rect>);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LinearScale } from '../../../scale/linearScale';
import { BBox } from '../../../scene/bbox';
import type { GradientParams } from '../../../scene/gradient/gradient';
import { Group, TranslatableGroup } from '../../../scene/group';
import { Node, PointerEvents } from '../../../scene/node';
import { PointerEvents } from '../../../scene/node';
import type { Point } from '../../../scene/point';
import { Selection } from '../../../scene/selection';
import { Line } from '../../../scene/shape/line';
Expand Down Expand Up @@ -174,16 +174,16 @@ export class DonutSeries extends PolarSeries<DonutNodeDatum, DonutSeriesProperti
this.phantomGroup.opacity = 0.2;
}

override attachSeries(seriesContentNode: Node, seriesNode: Node, annotationNode: Node | undefined): void {
override attachSeries(seriesContentNode: Group, seriesNode: Group, annotationNode: Group | undefined): void {
super.attachSeries(seriesContentNode, seriesNode, annotationNode);

seriesContentNode?.appendChild(this.backgroundGroup);
}

override detachSeries(
seriesContentNode: Node | undefined,
seriesNode: Node,
annotationNode: Node | undefined
seriesContentNode: Group | undefined,
seriesNode: Group,
annotationNode: Group | undefined
): void {
super.detachSeries(seriesContentNode, seriesNode, annotationNode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LinearScale } from '../../../scale/linearScale';
import { BBox } from '../../../scene/bbox';
import type { GradientParams } from '../../../scene/gradient/gradient';
import { Group, TranslatableGroup } from '../../../scene/group';
import { Node, PointerEvents } from '../../../scene/node';
import { PointerEvents } from '../../../scene/node';
import type { Point } from '../../../scene/point';
import { Selection } from '../../../scene/selection';
import { Line } from '../../../scene/shape/line';
Expand Down Expand Up @@ -160,16 +160,16 @@ export class PieSeries extends PolarSeries<PieNodeDatum, PieSeriesProperties, Se
this.phantomGroup.opacity = 0.2;
}

override attachSeries(seriesContentNode: Node, seriesNode: Node, annotationNode: Node | undefined): void {
override attachSeries(seriesContentNode: Group, seriesNode: Group, annotationNode: Group | undefined): void {
super.attachSeries(seriesContentNode, seriesNode, annotationNode);

seriesContentNode.appendChild(this.backgroundGroup);
}

override detachSeries(
seriesContentNode: Node | undefined,
seriesNode: Node,
annotationNode: Node | undefined
seriesContentNode: Group | undefined,
seriesNode: Group,
annotationNode: Group | undefined
): void {
super.detachSeries(seriesContentNode, seriesNode, annotationNode);

Expand Down
4 changes: 2 additions & 2 deletions packages/ag-charts-community/src/chart/series/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,14 @@ export abstract class Series<
this.pickModes = pickModes;
}

attachSeries(seriesContentNode: Node, seriesNode: Node, annotationNode: Node | undefined) {
attachSeries(seriesContentNode: Group, seriesNode: Group, annotationNode: Group | undefined) {
seriesContentNode.appendChild(this.contentGroup);
seriesNode.appendChild(this.highlightGroup);
seriesNode.appendChild(this.labelGroup);
annotationNode?.appendChild(this.annotationGroup);
}

detachSeries(seriesContentNode: Node | undefined, seriesNode: Node, annotationNode: Node | undefined) {
detachSeries(seriesContentNode: Group | undefined, seriesNode: Group, annotationNode: Group | undefined) {
seriesContentNode?.removeChild(this.contentGroup);
seriesNode.removeChild(this.highlightGroup);
seriesNode.removeChild(this.labelGroup);
Expand Down
Loading
Loading