簡體   English   中英

高圖表顯示xAxis之間的多個數據點

[英]Highcharts multiple data points between xAxis

我正在使用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
            }
        });
    });
});

您需要指定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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM