- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
PowerBI 的 sankey 图有很多可能性,但正如您可以在 github 网站上阅读的那样,存在一些重要的限制。首先是无法为节点着色。此外,也无法更改节点(源和目标)的顺序。
附上一个例子 PowerBI file其中显示了一个 sankey。在这个文件中指出了节点应该有哪些颜色以及节点的顺序应该是什么。
最好的解决方案当然是使用 PowerBI 来指示颜色,如本示例中的链接。但可能更容易在代码本身中用硬值指示节点(名称)的颜色,这也是一个不错的选择。同样适用于节点的排序
我查看了 d3 的 colorscale 函数将其链接到 fillcolor。但我收到一条错误消息,指出字符串值无法链接到色标。
可以在此处找到包含代码的 Github 页面:
https://github.com/microsoft/powerbi-visuals-sankey
我认为这行代码应该改变:
nodeFillColor = this.colorHelper.isHighContrast ? this.colorHelper.getThemeColor() : this.colorPalette.getColor(index.toString()).value;
console.log(nodeFillColor);
nodeStrokeColor = this.colorHelper.getHighContrastColor("foreground", nodeFillColor);
最佳答案
看起来如果您需要注入(inject)一些第 3 方颜色值(无论是十六进制还是其他格式),您可以在突出显示为“作弊”的代码中使用 ColorHelper 实例。以下示例可在此处的 powerbi 文档中找到:https://github.com/microsoft/powerbi-visuals-utils-colorutils/blob/master/docs/api/colorUtils.md#calculatehighlightcolor
import ColorUtility = powerbi.extensibility.utils.color;
let yellow = "#FFFF00",
yellowRGB = ColorUtility.parseColorString(yellow);
ColorUtility.calculateHighlightColor(yellowRGB, 0.8, 0.2);
// returns: '#CCCC00'
ColorUtility.parseColorString('<colorhex>')
// thanks Paul Irish: https://www.paulirish.com/2009/random-hex-color-code-snippets/
let randcolor = '#'+Math.floor(Math.random()*16777215).toString(16)
// Then to replace the example code you had in your question...
nodeFillColor = this.colorHelper.parseColorString(randcolor)
nodeStrokeColor = this.colorHelper.getHighContrastColor("foreground", nodeFillColor);
关于javascript - 带有颜色节点和排序的桑基图 PowerBI 自定义视觉对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59602736/
在默认的 Highcharts Sankey 图表中,您可以将鼠标悬停在各个路径上,这些路径会突出显示。 我希望能够悬停在节点上 - 例如下面示例中的加拿大 - 并在悬停在该节点上时突出显示所有红色路
我想知道一个特定的节点是否可以在类似states in hover(linkOpacity)的Click上高亮显示并在单击其他节点/系列时将其替换为之前的颜色。 简而言之,加载图表时,最上面的节点最初
(Plotly 4.10.0、Python 3.8.0、Ubuntu 20.04) 我正在使用 Plotly Sankeys,但自动放置看起来很麻烦(可惜我无法手动放置节点)。 import plot
如何根据过渡在 x 轴上显示动态文本。在我的第一个案例中,我得到两个转换(足球 -> 篮球和篮球 -> Gerard),因此我将显示两个标签,如下所示 但是当我们只得到一个转换时,如何处理 x 轴上的
我需要在桑基图之外显示标签,但我很难在外面显示。我尝试使用一些属性,如裁剪、溢出和对齐。尽管如此,它仍然不起作用。我需要在图表外部显示左侧和右侧的标签。 这是我的代码 Highcharts.chart
我是一名优秀的程序员,十分优秀!