0

我正在使用 Highcharts 并试图在 xAxis 上的任何点之间获得多个点。(例如,我希望在 10 月和 11 月之间获得 4 分。)我该怎么做?

我尝试在 y: 上添加 [] 来指定多个值,但这不起作用。我似乎无法得到任何工作,并且在我可以找到的 highcharts 网站上没有任何示例。

http://jsfiddle.net/wUDBW/1/

$(function () {
    var chart;
    $(document).ready(function () {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'area'
            },
            title: {
                text: "Title"
            },
            credits: {
                enabled: false
            },
            xAxis: {
                categories: ["October", "November", "December", "January", "February", "March"],
                tickmarkPlacement: 'on',
                title: {
                    enabled: false
                }
            },
            yAxis: {
                title: {
                    text: 'Counts'
                },
                labels: {
                    formatter: function () {
                        return this.value;
                    }
                }
            },
            tooltip: {
                formatter: function () {
                    return '<strong>Count:</strong> ' + this.y + '<br><strong>Date:</strong> ' + this.point.date;
                }
            },
            plotOptions: {
                area: {
                    stacking: 'normal',
                    lineColor: '#666666',
                    lineWidth: 1,
                    marker: {
                        lineWidth: 1,
                        lineColor: '#666666'
                    }
                }
            },
            series: [{
                name: 'Views',
                data: [{
                    y: 3,
                    date: 'October 9th, 2012',
                    unlocked: 1,
                    potential: 1,
                }, {
                    y: 5,
                    date: 'October 12th, 2012',
                    unlocked: 1,
                    potential: 2,
                }, {
                    y: 7,
                    date: 'October 14th, 2012',
                    unlocked: 1,
                    potential: 3,
                }, {
                    y: 7,
                    date: 'October 18th, 2012',
                    unlocked: 1,
                    potential: 3,
                }, {
                    y: 7,
                    date: 'October 22nd, 2012',
                    unlocked: 1,
                    potential: 3,
                }, {
                    y: 7,
                    date: 'October 23rd, 2012',
                    unlocked: 1,
                    potential: 3,
                }, ]
            }, {
                name: 'Replies',
                data: [{
                    y: 3,
                    date: 'October 9th, 2012',
                    unlocked: 1,
                    potential: 1,
                }, {
                    y: 5,
                    date: 'October 12th, 2012',
                    unlocked: 1,
                    potential: 2,
                }, {
                    y: 7,
                    date: 'October 14th, 2012',
                    unlocked: 1,
                    potential: 3,
                }, {
                    y: 7,
                    date: 'October 18th, 2012',
                    unlocked: 1,
                    potential: 3,
                }, {
                    y: 7,
                    date: 'October 22nd, 2012',
                    unlocked: 1,
                    potential: 3,
                }, {
                    y: 7,
                    date: 'October 23rd, 2012',
                    unlocked: 1,
                    potential: 3,
                }, ]
            }],
            exporting: {
                enabled: false
            }
        });
    });
});
4

1 回答 1

1

您需要指定 x 轴值

data: [{
                y: 3,
                x: Date.UTC(2012, 9, 9)
                date: 'October 9th, 2012',
                unlocked: 1,
                potential: 1,
            }, {

您还需要删除 xaxis 类别,并使 xa 类型为 'datetime' 一个示例在这里http://www.highcharts.com/demo/spline-irregular-time

于 2013-03-21T07:01:33.000 回答