Power Bi -deneb图表显示了相反的工具提示

发布于 2025-02-09 16:42:54 字数 207 浏览 2 评论 0原文

我在Deneb中创建了一个简单的堆叠条形图,用户可以突出显示到位:X轴为组,突出显示为层。我还创建了一个工具提示,该工具提示应显示每个条的名称,并且应该匹配条上的标签。奇怪的是,工具提示以相反的顺序显示:指向d,f show e等。 。)我试图将排序插入到酒吧中;那没用。我的偏爱是将条形图保持原样,并且工具提示显示以匹配;但是,可以扭转条形的顺序是可以的(不太理想的)。如何获得工具提示以匹配标签?

I've created a simple stacked bar chart in Deneb where the user can highlight in place: x-axis is group, highlight is tiers. I've also created a tooltip that should show the name for each bar and should match the label on the bar. What's strange is that the tooltip shows in reverse order: pointing to A shows D, F shows E, etc. (See this pbix file.) I've attempted to insert sorting to the bars; that didn't work. My preference is to have the bars remain as they are and the tooltips show to match; however, it would be ok (less desirable) to reverse the order of the bars. How can I get the tooltip to match the label?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一个人的夜不怕黑 2025-02-16 16:42:54

这清理了规格有效。

如果这解决了您的问题,请不要忘记接受答案。

{
  "data": {"name": "dataset"},
  "transform": [
    {
      "stack": "test2",
      "as": ["a", "b"],
      "groupby": ["group"]
    }
  ],
  "layer": [
    {
      "mark": {
        "type": "bar",
        "stroke": "black",
        "strokeWidth": 1,
        "opacity": 0.3
      },
      "encoding": {
        "color": {
          "field": "group",
          "type": "nominal",
          "scale": {
            "domain": [
              "Low",
              "Med",
              "High"
            ],
            "range": [
              "#e15759",
              "#ffff00",
              "#59a14f"
            ]
          },
          "legend": null
        }
      }
    },
    {
      "mark": {
        "type": "bar",
        "stroke": "black",
        "strokeWidth": 1,
        "tooltip": true
      },
      "encoding": {
        "color": {
          "field": "group",
          "type": "nominal",
          "scale": {
            "domain": [
              "Low",
              "Med",
              "High"
            ],
            "range": [
              "#e15759",
              "#ffff00",
              "#59a14f"
            ]
          },
          "legend": null
        },
        "opacity": {
          "condition": {
            "test": "datum['test2__highlight']!=null",
            "value": 1
          },
          "value": 0
        }
      }
    },
    {
      "mark": {
        "type": "text",
        "color": "black",
        "dy": -90
      },
      "encoding": {
        "text": {"field": "name"}
      }
    }
  ],
  "encoding": {
    "y": {
      "field": "a",
      "type": "quantitative",
      "axis": {
        "title": "Number of Projects",
        "tickMinStep": 1
      }
    },
    "y2": {"field": "b"},
    "x": {
      "field": "group",
      "type": "nominal",
      "axis": {
        "title": null,
        "labelAngle": 0
      }
    }
  }
}

This cleaned up spec works.

Don't forget to accept the answer if this solves your problem.

enter image description here

{
  "data": {"name": "dataset"},
  "transform": [
    {
      "stack": "test2",
      "as": ["a", "b"],
      "groupby": ["group"]
    }
  ],
  "layer": [
    {
      "mark": {
        "type": "bar",
        "stroke": "black",
        "strokeWidth": 1,
        "opacity": 0.3
      },
      "encoding": {
        "color": {
          "field": "group",
          "type": "nominal",
          "scale": {
            "domain": [
              "Low",
              "Med",
              "High"
            ],
            "range": [
              "#e15759",
              "#ffff00",
              "#59a14f"
            ]
          },
          "legend": null
        }
      }
    },
    {
      "mark": {
        "type": "bar",
        "stroke": "black",
        "strokeWidth": 1,
        "tooltip": true
      },
      "encoding": {
        "color": {
          "field": "group",
          "type": "nominal",
          "scale": {
            "domain": [
              "Low",
              "Med",
              "High"
            ],
            "range": [
              "#e15759",
              "#ffff00",
              "#59a14f"
            ]
          },
          "legend": null
        },
        "opacity": {
          "condition": {
            "test": "datum['test2__highlight']!=null",
            "value": 1
          },
          "value": 0
        }
      }
    },
    {
      "mark": {
        "type": "text",
        "color": "black",
        "dy": -90
      },
      "encoding": {
        "text": {"field": "name"}
      }
    }
  ],
  "encoding": {
    "y": {
      "field": "a",
      "type": "quantitative",
      "axis": {
        "title": "Number of Projects",
        "tickMinStep": 1
      }
    },
    "y2": {"field": "b"},
    "x": {
      "field": "group",
      "type": "nominal",
      "axis": {
        "title": null,
        "labelAngle": 0
      }
    }
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文