Highchart蜘蛛网更多类别

时间:2015-02-03 06:18:42

标签: javascript jquery highcharts

我遇到问题的高图 - 蜘蛛网。 图表工作得很好,但当我想添加更多类别时,我有问题。 现在我有8个类别,但我想要更多,甚至100到150。 用这张图表可以实现这个目的吗? 下面是我的图表

    $(function () {

    $('#genrechart').highcharts({

        chart: {
            polar: true,
            type: 'line',
            margin: 0
        },

        exporting: {
            enabled: false,
            buttons: {
                enabled: false
            }
        },

        title: {
            text: '&nbsp',
            x: -80,
            useHTML: true
        },

        pane: {
            size: '70%'
        },

        xAxis: {
            categories: ['Sales', 'Marketing', 'Development', 'Customer Support', 'Information Technology', 'Administration', 'bororo', 'text-center', 'fere'],
            tickmarkPlacement: 'on',
            lineWidth: 0,
            labels: {
                align: 'center',
                distance: 2
            }
        },

        yAxis: {
            gridLineInterpolation: 'polygon',
            lineWidth: 0,
            min: 0,
            endOnTick: true,
            showLastLabel: true,
            tickPositions: [0, 5, 6, 7, 8]
        },

        tooltip: {
            shared: true,
            headerFormat: '<span style="font-size: 12px">{point.key}:</span>&nbsp;&nbsp;<b>{point.y:,.2f}</b>',
            pointFormat: '',
            useHTML: true
        },

        legend: {
            enabled: false,
            align: 'right',
            verticalAlign: 'top',
            y: 70,
            layout: 'vertical'
        },

        series: [{
            name: '',
            data: [1, 2, 3, 4, 5, 6, 7],
            pointPlacement: 'on'
        }]

    });
});

http://jsfiddle.net/sanczopan/qybn6m2u/

寻求帮助。

1 个答案:

答案 0 :(得分:0)

如果您愿意,可以添加数百个类别,但如果系列数据阵列中没有足够的值,则不会显示它们。因此,如果要在图表中添加类别,则系列数据数组和类别数组必须具有相同的长度才能显示所有类别。如果没有值,只需添加null或0,但需要它。

也许最好不要使用类别。

http://jsfiddle.net/qybn6m2u/3/

$(function () {

    $('#container').highcharts({

        chart: {
            polar: true,
            type: 'line',
            margin: 0
        },

        exporting: {
            enabled: false,
            buttons: {
                enabled: false
            }
        },

        title: {
            text: '&nbsp',
            x: -80,
            useHTML: true
        },

        pane: {
            size: '70%'
        },

        xAxis: {
            tickmarkPlacement: 'on',
            lineWidth: 0,
            labels: {
                align: 'center',
                distance: 20
            }
        },

        yAxis: {
            gridLineInterpolation: 'polygon',
            lineWidth: 0,
            min: 0,
            endOnTick: true,
            showLastLabel: true,
            tickPositions: [0, 5, 6, 7, 8]
        },

        tooltip: {
            shared: true,
            headerFormat: '<span style="font-size: 12px">{point.key}:</span>&nbsp;&nbsp;<b>{point.y:,.2f}</b>',
            pointFormat: '',
            useHTML: true
        },

        legend: {
            enabled: false,
            align: 'right',
            verticalAlign: 'top',
            y: 70,
            layout: 'vertical'
        },

        series: [{
            name: '',
            data: [1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4],
            pointPlacement: 'on'
        }]

    });
});

无论如何,一个包含数百个类别的蜘蛛网图表似乎不是一个非常好的数据可视化选择,但我真的不知道你想要实现什么,所以我猜它&# 39;没关系。

和平!