8000 Fix/crosshair marker position by xile611 · Pull Request #2611 · VisActor/VChart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix/crosshair marker position #2611

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

Merged
merged 2 commits into from
Apr 29, 2024
Merged
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
11 changes: 11 additions & 0 deletions common/changes/@visactor/vchart/develop_2024-04-29-08-40.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: fix error of position when update viewBox\n\n",
"type": "none",
"packageName": "@visactor/vchart"
}
],
"packageName": "@visactor/vchart",
"email": "dingling112@gmail.com"
}
1 change: 1 addition & 0 deletions packages/vchart/src/chart/interface/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface IChart extends ICompilable {

setCanvasRect: (width: number, height: number) => void;
getCanvasRect: () => ILayoutRect;
getViewRect: () => ILayoutRect;

getOption: () => IChartOption;

Expand Down
2 changes: 1 addition & 1 deletion packages/vchart/src/component/crosshair/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export abstract class BaseCrossHair<T extends ICartesianCrosshairSpec | IPolarCr

protected _getLimitBounds() {
if (!this._limitBounds) {
const { width, height } = this._option.globalInstance.getChart()?.getCanvasRect() ?? {
const { width, height } = this._option.globalInstance.getChart()?.getViewRect() ?? {
width: 0,
height: 0
};
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart/src/component/marker/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export function positionLayout(positions: MarkerPositionPoint[], series: ISeries
});
}

const { width: canvasWidth, height: canvasHeight } = series.getOption().getChart().getCanvasRect();
const { width: canvasWidth, height: canvasHeight } = series.getOption().getChart().getViewRect();
return positions.map(position => {
let { x, y } = position;
if (isPercent(x)) {
Expand Down
0