0

我正在动态添加 highchart 系列。我的设置如下。

new Highcharts.Chart({
    "name": "Ratingovertijrrrrrrrrr",
    "CID": 59,
    "type": 1,
    "chart": {
        "type": "area",
        "zoomType": "xy",
        "animation": true,
        "renderTo": "CHART_01"
    },
    "colors": ["#fae570", "#e4b9b9", "#dc7474"],
    "exporting": {
        "enabled": true
    },
    "legend": {
        "enabled": true,
        "floating": false,
        "layout": "horizontal",
        "align": "center",
        "verticalAlign": "bottom",
        "backgroundColor": ""
    },
    "plotOptions": {
        "series": {
            "allowPointSelect": false,
            "animation": true,
            "showInLegend": true,
            "dataLabels": {
                "enabled": false
            },
            "stacking": "normal"
        }
    },
    "subtitle": {
        "text": "over tijd",
        "style": {
            "fontFamily": "Arial",
            "fontSize": "14px",
            "fontWeight": "normal",
            "fontStyle": "normal",
            "color": "#000000"
        }
    },
    "title": {
        "text": "Rating",
        "style": {
            "fontFamily": "Arial",
            "fontSize": "18px",
            "fontWeight": "normal",
            "fontStyle": "normal",
            "color": "#000000"
        }
    },
    "tooltip": {
        "enabled": true,
        "shared": true,
        "animation": true,
        "crosshairs": [true, false],
        "backgroundColor": "#79e538",
        "formatter": function () {
            return '<b>' + this.series.name + ':</b>' + this.y;
        }
    },
    "xAxis": {
        "title": {
            "text": "Date",
            "enabled": false,
            "style": {
                "fontFamily": "Arial",
                "fontSize": "8px",
                "fontWeight": "normal",
                "fontStyle": "normal",
                "color": ""
            }
        },
        "type": "datetime",
        "minRange": "60000",
        "startOfWeek": "1",
        "dateTimeLabelFormats": {
            "millisecond": "%H:%M:%S.%L",
            "second": "%H:%M:%S",
            "minute": "%H:%M",
            "hour": "%H:%M",
            "day": "%e. %b",
            "week": "%e. %b",
            "month": "%b '%y",
            "year": "%Y"
        },
        "categories": [""],
        "labels": {
            "enabled": true,
            "align": "center",
            "rotation": "0",
            "x": "0",
            "y": "15"
        }
    },
    "yAxis": {
        "title": {
            "text": "Rating",
            "enabled": false,
            "style": {
                "fontFamily": "Arial",
                "fontSize": "8px",
                "fontWeight": "normal",
                "fontStyle": "normal",
                "color": ""
            }
        },
        "type": "linear",
        "minRange": "",
        "startOfWeek": "1",
        "dateTimeLabelFormats": {
            "millisecond": "%H:%M:%S.%L",
            "second": "%H:%M:%S",
            "minute": "%H:%M",
            "hour": "%H:%M",
            "day": "%e. %b",
            "week": "%e. %b",
            "month": "%b '%y",
            "year": "%Y"
        },
        "categories": [""],
        "labels": {
            "enabled": true,
            "align": "center",
            "rotation": "",
            "x": "",
            "y": ""
        }
    },
    "series": [{
        "data": [0],
        "name": "Loading...",
        "loadingSeries": true
    }],
    credits: {
        enabled: false
    }
});

CHART_01是容器 id。最初加载将显示..之后 ajax 发送到服务器以获取系列列表.. 并且系列在 ajax 函数的成功回调时动态添加。

问题是浏览器停止工作


编辑 :

当我将类型更改为linear

"xAxis": {       
        "type": "linear",
        "minRange": "0"

它工作......有什么问题"type": "datetime"

4

1 回答 1

1

问题在于设置 xAxis。在 Highcharts 中,不能同时设置分类轴和datetime. 此外,当minRange为分类图表设置一些高值(如 60 000)时,Highcharts 期望显示至少 60 000 个类别,这不可能在宽度约为 1000 像素的图表上显示 xAxis 的 60 000 个标签。

于 2013-06-28T11:39:40.703 回答