更正 JSON 具有自定义属性和 3+ 值的点?

Correct JSON for points with custom attributes and 3+ values?

当涉及 3 个以上的值图表(例如 HeatMap 和 BoxPlot)时,我对有关点值表示法的文档感到有点困惑。

我看到点值可以作为 n 个长度数组提供:

data: [
                [760, 801, 848, 895, 965],
                [733, 853, 939, 980, 1080]...
            ]

并且它们可以是具有 additional/custom 属性的配置对象:

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 as value, 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]