pissang commented on code in PR #16904:
URL: https://github.com/apache/echarts/pull/16904#discussion_r854858229
##########
src/coord/View.ts:
##########
@@ -127,11 +128,13 @@ class View extends Transformable implements
CoordinateSystemMaster, CoordinateSy
/**
* Set center of view
*/
- setCenter(centerCoord?: number[]): void {
+ setCenter(centerCoord?: (number | string)[]): void {
if (!centerCoord) {
return;
}
- this._center = centerCoord;
+ const rect = this.getBoundingRect();
+
+ this._center = [parsePercent(centerCoord[0], rect.width),
parsePercent(centerCoord[1], rect.height)];
Review Comment:
The percent value should be relative to the chart width and chart height.
Which can be get with `api.getWidth` and `api.getHeight()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]