如何更改高图列表中每个类别的颜色? [英] How do you change the colour of each category within a highcharts column chart?

查看:82
本文介绍了如何更改高图列表中每个类别的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个类别的柱状图,每个类别都有一个数据点(例如像这样一个)。是否可以更改每个类别栏的颜色?即所以每个酒吧将有自己的独特的颜色,而不是所有的蓝色?

解决方案

你也可以分别为每个设置颜色如果将数据数组更改为配置对象而不是数字,则可以使用点/条。

  data:[
{y :34.4,颜色:'red'},//此点是红色
21.8,//默认蓝色
{y:20.1,颜色:'#aaff99'},//这将变成绿色
20] //默认蓝色

jsfiddle上的示例


I have have a column chart which has a number of categories, each with a single data point (e.g. like this one). Is it possible to change the colour of the bar for each category? i.e. so each bar would have its own unique colour rather than all being blue?

解决方案

You can also set the color individually for each point/bar if you change the data array to be configuration objects instead of numbers.

data: [
      {y: 34.4, color: 'red'},     // this point is red
      21.8,                        // default blue
      {y: 20.1, color: '#aaff99'}, // this will be greenish
      20]                          // default blue

Example on jsfiddle

这篇关于如何更改高图列表中每个类别的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆