Skip to content

Text and hovertext for heat maps needs to have same dimension as Z #386

@andrei-ng

Description

@andrei-ng

Also it seems like for using the text or hovertext parameters in conjunction with the heatmap, it needs to have the same dimensions as the z value.

I made a small example demonstrating how the resulting js needs to look like (demonstrating both, the {x,y}gap and the {hover,}text parameter:

    Plotly.newPlot("TCNx0eInClUJYtdkzJ1A", {
  "data": [
    {
      "xgap": 2,
      "ygap": 1,
      "type": "heatmap",
      "hoverinfo": "text",
      "text": [
        [
          "a",
          "b",
          "c",
          "d",
        ],
        [
          "e",
          "f",
          "g",
          "h"
        ]
      ],
      "x": [
        0.0,
        1.0,
        2.0,
        3.0,
      ],
      "y": [
        "abcd",
        "efgh"
      ],
      "z": [
        [
          0.0,
          1.0,
          2.0,
          3.0,
        ],
        [
          0.0,
          2.0,
          1.0,
          2.0,
        ]
      ]
    }
  ],
});

with

<script src="https://cdn.plot.ly/plotly-3.3.1.min.js"></script>
<body>
  <div id="TCNx0eInClUJYtdkzJ1A" class="plotly-graph-div" style="height:100%; width:100%;"></div>
</body>

If the text parameter is simply a Vec<String> as it is basically enforced right now, the hover is simply not shown (I had to test this myself as I found the plotly docs not very readable on this one though).

Originally posted by @atticus-sullivan in #383

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions