Skip to content
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

feat(declarative-chart): Create Scatter plot #33843

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
resolve comments
  • Loading branch information
Anush2303 committed Feb 25, 2025
commit f7e00b5c5bd7788a668a12ef2468dab72989f25a
Original file line number Diff line number Diff line change
@@ -473,8 +473,8 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
maxMarkerSizeForYAxis = this._getExtendedDomainValue(
startValue,
endValue,
margins.bottom!,
containerHeight - margins.top!,
containerHeight - margins.bottom!,
margins.top!,
);
}
return {
@@ -484,7 +484,11 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
};

private _getExtendedDomainValue = (x1: number, x2: number, y1: number, y2: number): number => {
return maxMarkerSize ? Math.abs((maxMarkerSize * (x2 - x1)) / (y2 - y1 - 2 * maxMarkerSize)) : 0;
return maxMarkerSize
? y2 > y1
? Math.abs((maxMarkerSize * (x2 - x1)) / (y2 - y1 - 2 * maxMarkerSize))
: Math.abs((-1 * maxMarkerSize * (x2 - x1)) / (y2 - y1 + 2 * maxMarkerSize))
: 0;
};

private _getMargins = (margins: IMargins) => {
@@ -690,7 +694,7 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
<circle
id={circleId}
key={circleId}
r={activePoint === circleId ? 5.5 : 3.5}
r={this._points[i].data[0].markerSize ?? 4}
cx={this._xAxisScale(x1)}
cy={this._yAxisScale(y1)}
fill={activePoint === circleId ? theme!.semanticColors.bodyBackground : lineColor}
@@ -1657,7 +1661,7 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
});
})!;

const maxMarkerSizeForXAxis = this._getExtendedDomainValue(xMax, xMin, width - margins.right!, margins.left!);
const maxMarkerSizeForXAxis = this._getExtendedDomainValue(xMin, xMax, width - margins.right!, margins.left!);
const rStartValue = margins.left!;
const rEndValue = width - margins.right!;