Skip to content

[Bug] 热力图对于空数据的表现不一致 #21290

Open

Description

@Cenmingyang

Version

6.0.0

Link to Minimal Reproduction

https://codepen.io/gicocqqo-the-lessful/pen/OPMVYzw

Steps to Reproduce

1-9
2-9
的数据都是空,但是在图表上的表现不一样,一个有背景色,一个无背景色

Current Behavior

在进行热力图开发时遇到的问题

Expected Behavior

应该表现一致

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Activity

  1. added
    pending
    on Sep 24, 2025
  2. echarts-bot commented on Sep 24, 2025

    @echarts-bot

    @Cenmingyang It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

    TRANSLATED

    TITLE

    [Bug] The heatmap performs inconsistently with empty data.

    BODY

    Version6.0.0### Link to Minimal Reproductionhttps://codepen.io/gicocqqo-the-lessful/pen/OPMVYzw### Steps to Reproduce1-92-9The data is empty, but the performance on the chart is different; one has a background color and one does not.### Current BehaviorThe issue encountered during the development of the heat map.### Expected BehaviorThe performance should be consistent.### Environmentmarkdown- OS:- Browser:- Framework:### Any additional comments?No response

  3. helgasoft commented on Sep 24, 2025

    @helgasoft

    remove splitArea from axes ?
    📌 please close issue if problem solved

  4. Cenmingyang commented on Sep 25, 2025

    @Cenmingyang
    Author

    It can solve the problem, but I’d prefer to add splitArea, and I hope their behavior can be consistent.

  5. helgasoft commented on Sep 25, 2025

    @helgasoft

    It appears to be a bug in splitArea. Workaround is to set areaStyle:{opacity:0.99} in xAxis.splitArea.

  6. plainheart commented on Sep 26, 2025

    @plainheart
    Member

    I don't think this is a bug since the documentation says:

    yAxis.splitArea.areaStyle.color = ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)']

    Color of split area. SplitArea color could also be set in color array, which the split lines would take as their colors in turns. Dark and light colors in turns are used by default.

  7. added and removed
    pending
    on Sep 26, 2025
  8. helgasoft commented on Sep 26, 2025

    @helgasoft

    yes, explicitly setting areaStyle.color fixes it, but OP was relying on the default color setting with splitArea: {show: true}.
    Demo
    Similar issue reported already in #20634. Their example is with custom areaStyle.color and still shows the same problem in the upper left corner - Demo

  9. plainheart commented on Sep 26, 2025

    @plainheart
    Member

    @helgasoft Thanks for your information. It should be a bug, as I can see the different behavior between SVG renderer and Canvas renderer in your demo.

  10. added this to the 6.x milestone on Sep 26, 2025
  11. mynk2611 commented on Oct 20, 2025

    @mynk2611
    Contributor

    Hello, @helgasoft @plainheart,

    I've been looking into this issue and found that the default order for splitArea.areaStyle.color in v6 is different from previous versions.

    I found that by reverting the default color order in src/coord/axisDefault.ts, the inconsistent behavior is resolved for heatmaps with empty data. This fix works for both the Canvas and SVG renderers.

    Here is the code change I tested locally:

    Diff

    /src/coord/axisDefault.ts
    /src/coord/axisDefault.ts
    @@ -121,8 +121,8 @@
       splitArea: {
         show: false,
         areaStyle: {
           color: [
     -       tokens.color.backgroundTint,
     -       tokens.color.backgroundTransparent
     +       tokens.color.backgroundTransparent,
     +       tokens.color.backgroundTint
           ]
         }
       },
    
    

    This change directly fixes the visual inconsistency on the test file that im running :

    <!DOCTYPE html>
    <html style="height: 100%">
      <head>
        <meta charset="utf-8" />
        <title>Heatmap Minimal</title>
        <style>
          body {
            margin: 0;
            height: 100%;
          }
          #main {
            width: 100%;
            height: 100vh;
          }
        </style>
        <script src="../dist/echarts.min.js"></script>
      </head>
      <body>
        <div id="main"></div>
        <script>
          var hours = ['12a', '1a', '2a', '3a', '4a', '5a', '6a', '7a'];
          var days = ['Sat', 'Fri', 'Thu', 'Wed', 'Tue', 'Mon', 'Sun'];
    
          var chartDom = document.getElementById('main');
          var myChart = echarts.init(chartDom);
          var option;
    
          option = {
            tooltip: {
              show: false
            },
            grid: {
              height: '50%',
              top: '10%',
              left: '10%',
              right: '10%'
            },
            xAxis: {
              type: 'category',
              data: hours,
              splitArea: {
                show: true
              }
            },
            yAxis: {
              type: 'category',
              data: days,
              splitArea: {
                show: true
              }
            },
            visualMap: null,
            series: [
              {
                name: 'Heatmap',
                type: 'heatmap',
                data: [],
                label: {
                  show: false
                },
                silent: true
              }
            ],
            animation: false
          };
    
          myChart.setOption(option);
        </script>
      </body>
    </html>
    

    Before: The color of the top-left block is inconsistent with the rest of its column. Image

    After: The color is now consistent for both SVG and Canvas renderers. Image

    Let me know if this seems like the right approach. If so, I would be happy to create a pull request to resolve this issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions