Highcharts json数据格式

lsmd5eda  于 2022-11-11  发布在  Highcharts
关注(0)|答案(1)|浏览(177)

我正在使用highcharts风玫瑰图示例,我正在尝试实现这一点:https://jsfiddle.net/bqwprojc/1/从表读取数据:

data: {
        table: 'freq',
        startRow: 1,
        endRow: 17,
        endColumn: 7
    },

这个例子是从内联表中阅读数据,我需要从json中读取数据,但是我不知道我应该传递什么json格式作为序列。
这是我目前所尝试的:https://jsfiddle.net/e97cr6js/
我尝试的系列数据:

series: [{
        "name": "High",
        "data": [
            ["Unsafe device behavior", 1],
            ["Hardware", 1],
            ["OS/FIRMWARE", 0],
            ["Configuration", 0],
            ["Applications", 0],
            ["Vulnerabilities", 0],
            ["Policies", 0]
        ],
        "_colorIndex": 2
    },
    {
        "name": "Med",
        "data": [
            ["Unsafe device behavior", 1],
            ["Hardware", 1],
            ["OS/FIRMWARE", 0],
            ["Configuration", 0],
            ["Applications", 0],
            ["Vulnerabilities", 0],
            ["Policies", 1]
        ],
        "_colorIndex": 1
    },
    {
        "name": "Low",
        "data": [
            ["Unsafe device behavior", 1],
            ["Hardware", 1],
            ["OS/FIRMWARE", 0],
            ["Configuration", 1],
            ["Applications", 1],
            ["Vulnerabilities", 0],
            ["Policies", 1]
        ],
        "_colorIndex": 0
    }],
colors: ['#009F5C', '#FFBD2F', '#FF001D'],
wi3ka0sx

wi3ka0sx1#

我设法通过向xAxis添加类别来解决这个问题,xaxis使图表旋转并使所有内容对齐。

xAxis: {
    categories: categories
    },

https://jsfiddle.net/chbw28dg/

相关问题