【问题标题】:while working with network chart, is there any why to color the common node with two different colors.?在使用网络图时,为什么要用两种不同的颜色为公共节点着色。?
【发布时间】:2021-05-04 14:14:29
【问题描述】:

我尝试使用线性渐变。我可以看到这两种颜色。但问题是它在线性变化。但我需要的是每种颜色应占节点的 50%。没有线性变化。

我的代码:

subchart.point.color = {

    linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
    
    stops: [[0, color[0]], 
    
    [0.75, color[1]] 

  ]};

谁能帮我解决这个问题?

例如:

当bar一半时我需要立即更改颜色。即我不想要线性变化。例如类似于我的问题。 我需要做到这一点

an example link for my question

【问题讨论】:

  • 请添加图表的完整代码和一些示例数据。
  • @MarcoAurelioFernandezReyes 更新了我的问题。你能帮帮我吗
  • @ppotaczek 你能帮忙吗
  • 您能否提供您想要实现的输出图像?我不确定我是否理解你。
  • @Sebastian Wędzel 更新了我的问题

标签: javascript d3.js highcharts


【解决方案1】:

您需要将您分享的演示中的颜色配置添加到网络图系列中:

  color: {
    linearGradient: {
      x1: 0,
      x2: 0,
      y1: 0,
      y2: 1
    },
    stops: [
      [0, '#003399'],
      [1, '#ff66AA']
    ]
  }

演示:https://jsfiddle.net/BlackLabel/e5b4kcpq/

【讨论】:

  • @sebastan 这里的颜色是线性变化的,要求节点应该是一半一种颜色,另一半是一种颜色
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-11
  • 2022-01-24
相关资源
最近更新 更多