zzhmark opened a new issue #14577:
URL: https://github.com/apache/echarts/issues/14577


   ### Version
   5.0.2
   
   ### Steps to reproduce
   I made a heatmap using your 
[demo](https://echarts.apache.org/examples/en/editor.html?c=heatmap-cartesian).
   I want to make a brush on click feature, which doesn't look good (have a 
shift of coordRange) due to the categorical axes, so I added my own value axes 
to circumvent the issue, but it works only with one of them.
   
   Here is Axis options:
   
   ```json
   xAxis: [
       {
           triggerEvent: true,
           type: "category",
           data: colname,
           axisLabel: {
               interval: 0,
           },
           splitArea: {
               show: true,
               interval: 0,
           },
       },
       {
           type: "value",
           show: "false",
           min: 0,
           max: colname.length,
           interval: 1,
       },
   ],
   yAxis: [
        {
           triggerEvent: true,
           type: "category",
           data: rowname,
           axisLabel: {
               interval: 0,
           },
           splitArea: {
               interval: 0,
               show: true,
           },
       },
       {
           type: "value",
           show: "false",
           min: 0,
           max: rowname.length,
           interval: 1,
        },
   ],
   ```
   
   And here is brush options:
   
   ```json
   brush: {
               brushMode: 'multiple',
               yAxisIndex: 1,
               xAxisIndex: 1,
               transformable: false,
               brushStyle: {
                 color: "rgba(50, 200, 50, 0.6)",
                 borderWidth: 2,
               },
             },
   ```
   
   Here is the action:
   
   ```javascript
   inst.dispatchAction({
                       type: 'brush',
                       areas: [{
                         brushType: 'rect',
                         yAxisIndex: 1,
                         xAxisIndex: 1,
                         coordRange: [[j, j   1], [i, i   1]]
                       }],
   ```
   The action draws a rect by getting the x and y coordinates from the event.
   
   ### What is expected?
   The brush rect would appear correctly with respect to the y axis, but the 
shift is still there with respect to x axis. If you comment the yAxisIndex 
setting in the brush options, the problem switches to the y axis. Nothing 
specific changes if you change anything in the action.
   
   ### What is actually happening?
   For categorical axes, the coordRange given by actions will be rounded to 
categorical positions, leading to the shift of brush. I think setting the x and 
y axis indices for brush in the meantime results in y axis being set to the 
right one but x axis left to the wrong one.
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->


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

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