我可以在 Highcharts 中用堆积柱为单个点着色吗?

Can I colour individual points with stacked columns in Highcharts?

我有一个使用 3 个系列数组构建的图表,每个数组有 5 个数据点,显示为 5 个独特产品中的每一个的堆叠柱形图。请参阅 this fiddle 以了解去除品牌的示例。

就我目前的所有研究而言,plotOptions.column.colorByPoints 选项似乎是最有可能的解决方案,但它只让我完成了一半。

按照系列结构,我需要图表颜色匹配以下结构:

[ /* note: this example uses pseudo colours */
  [transparent,  transparent,   transparent, transparent,    transparent],
  [lighter-blue, lighter-green, lighter-red, lighter-yellow, grey],
  [blue,         green,         red,         yellow,         black]
]

不幸的是,为每个系列设置颜色没有帮助,因为系列中的每个点都需要不同。

郑重声明,与colorByPoints关联的plotOptions.column.color选项似乎只接受一个数组(匹配数据结构的嵌套数组在这里不起作用),但它适用于每个堆栈一个整体,所以在我的例子中设置一个 15 种颜色的数组只使用前 5 种。

这让我很困惑,我是不是漏掉了一些愚蠢的东西,或者这对 Hichcharts 来说根本不可能吗?

在这种情况下,您需要在数据点对象中提供颜色。

即:

data: [
  {y:15, color:'blue'}, 
  {y:64, color:'red'}
]

示例: