当涉及 3 个以上的值图表(例如 HeatMap 和 BoxPlot)时,我对有关点值表示法的文档感到有点困惑。
我看到点值可以作为 n 个长度数组提供:
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080]...
]
并且它们可以是具有附加/自定义属性的配置对象:
data: [{
name: 'Point 1',
color: '#00FF00',
x: 1,
y: 3
}, {
name: 'Point 2',
color: '#FF00FF',
x: 2,
y: 5
}]
但是,当唯一记录的值属性似乎是“x”和“y”时,如何使用 HeatMap/BoxPlot 的配置对象表示法呢?
是否有将被解释为 n 长度数组的配置对象的受支持属性?是这样的吗?
data: [{
name: 'Point 1',
color: '#00FF00',
values: [1,2,3]
}, {
name: 'Point 2',
color: '#FF00FF',
values: [4,5,6]
}]
最佳答案
这取决于图表的类型。
对于热图 ( reference ):
A heat map has an X and Y axis like any cartesian series. The point definitions however, take three values,
x
,y
as well asvalue
, which serves as the value for color coding the point. These values can also be given as an array of three numbers.
换句话说,您可以执行 { x: 0, y: 1, value: 10 }
或 [0,1,10]
。
对于箱线图(reference):
Each point in a box plot has five values: low, q1, median, q3 and high. Highcharts recognizes three ways of defining a point:
Object literal. The X value is optional.
{ x: Date.UTC(2013, 1, 7), low: 0, q1: 1, median: 2, q3: 3, high: 4 }
Array of 5 values. The X value is inferred.
[0, 1, 2, 3, 4]
Array of 6 values. The X value is the first position.
[Date.UTC(2013, 1, 7), 0, 1, 2, 3, 4]
关于highcharts - 为具有自定义属性和 3 个以上值的点更正 JSON?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28352237/