我是否可以通过创建名称及其颜色作为单独的数据来在高级图表中显示图例?
如果这是我的数据:
[{
"x": 0.92,
"y": 1.12,
"date": "05-18-2003",
"color": "#0082c8",
"idNo": 3,
"mc": "green",
"symbol": "circle"
},
{
"x": 0.92,
"y": 1.13,
"date": "05-18-2003",
"color": "#0082c8",
"idNo": 10,
"mc": "green",
"symbol": "circle"
},
{
"x": 0.96,
"y": 1.05,
"date": "06-10-2003",
"color": "#f58231",
"idNo": 3,
"mc": "green",
"symbol": "circle"
},
{
"x": 0.96,
"y": 1.09,
"date": "06-11-2003",
"color": "#911eb4",
"idNo": 3,
"mc": "green",
"symbol": "circle"
},
{
"x": 0.96,
"y": 1.1,
"date": "06-11-2003",
"color": "#911eb4",
"idNo": 10,
"mc": "green",
"symbol": "circle"
}
]
我根据上述数据动态创建的图例数据是 legendData =
[{name: "05-18-2003", color1: "#0082c8"}
{name: "06-11-2003", color1: "#f58231"}
{name: "06-10-2003", color1: "#911eb4"}]
如何从这个legendData变量创建图例?
感谢。
答案 0 :(得分:0)
要修改图例项标签,您可以使用labelFormatter
功能。至于每个图例项目的不同颜色,您可以使用样式模式并使用CSS设置样式。看看下面发布的示例。
DOCS参考:
https://www.highcharts.com/docs/chart-design-and-style/style-by-css
API参考:
http://api.highcharts.com/highcharts/legend.labelFormatter