TARUNTEjjjj commented on code in PR #21842:
URL: https://github.com/apache/echarts/pull/21842#discussion_r4604554855


##########
test/ut/spec/component/grid.test.ts:
##########
@@ -0,0 +1,63 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+
+import { createChart, removeChart, getECModel } from '../../core/utHelper';
+import GridModel from '../../../../src/coord/cartesian/GridModel';
+
+
+describe('component/grid', function () {
+
+    function getGridHeight(inverse: boolean): number {
+        const chart = createChart({ width: 600, height: 400 });
+        chart.setOption({
+            grid: {
+                outerBoundsMode: 'same',
+                outerBoundsContain: 'axisLabel'
+            },
+            xAxis: {
+                type: 'category',
+                data: ['A', 'B', 'C', 'D']
+            },
+            yAxis: [
+                { type: 'value' },
+                { type: 'value', inverse: inverse, min: 0.4498, max: 0.6824 }
+            ],
+            series: [
+                { type: 'line', data: [10, 20, 30, 40] },
+                { type: 'line', yAxisIndex: 1, data: [0.5, 0.55, 0.6, 0.65] }
+            ]
+        });
+        const gridModel = getECModel(chart).getComponent('grid', 0) as 
GridModel;
+        const height = gridModel.coordinateSystem.getRect().height;
+        removeChart(chart);
+        return height;
+    }

Review Comment:
   I independently checked the transposed case: inverse x axes, which the added 
inverse-y regression does not cover. In a 600×400 chart with the same 
secondary-axis range `0.4498..0.6824`, the original implementation shrinks the 
inverse-x grid width to 112.5px versus 432px normally. With this patch it is 
about 433.38px. Top and bottom x axes also preserve the grid width with label 
rotations 0°, +45°, and −45° (all six cases pass).
   
   It would be useful to add the unrotated inverse-x case to this test, since 
it exercises the new inversion without the subsequent y-axis flip. The existing 
grid regression and the independent matrix pass using the repository's 
Jest/jsdom/canvas mocks; real-browser text metrics were not checked. 
AI-assisted review and local validation with OpenAI Codex.



-- 
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]

Reply via email to