当我使用highchart时,我收到此错误“无法读取属性'类型'未定义”

时间:2014-06-02 13:57:22

标签: jquery-plugins highcharts

我正在使用来自highchart插件的时间序列图表如下:

var series1={
                            type: 'area',
                            color:lineColors[numOfLines],
                            name: legends[numOfLines],
                            pointInterval: 24 * 3600 * 1000,
                            pointStart:Date.UTC(dateStart[0], dateStart[1], dateStart[2]) ,
                            data: democrat};
                    var series2={
                            type: 'area',
                            color:lineColors[numOfLines+1],
                            name: legends[numOfLines+1],
                            pointInterval: 24 * 3600 * 1000,
                            pointStart:Date.UTC(dateStart[0], dateStart[1], dateStart[2]) ,
                            data: repub};
                    youDynamicSeries.push(series1);
                    youDynamicSeries.push(series2);}

在创建系列后,我创建了这样的图表:

highcharttimeseries(youDynamicSeries,xLabel,'trend_chart');

和highcharttimeseries功能如下:

function highcharttimeseries(series,date,chartcontainer)

{

 $('#'+chartcontainer).highcharts({
            chart: {
                zoomType: 'xy'
            },
            title: {
                text: ''
            },
            subtitle: {
                text: ''
            },
            xAxis: {
                type: 'datetime',
                minRange: 7 * 24 * 3600000 // fourteen days
            },
            yAxis: {
                title: {
                    text: ''
                }
            },
            legend: {
                layout: 'horizontal',
                align: 'middle',
                verticalAlign: 'top',
                borderWidth: 0
            },
            plotOptions: {
                area: {
 fillColor: {
                        linearGradient: { x1:0, y1: 5, x2: 0, y2: 0},
                        stops: [
                            [0, Highcharts.getOptions().colors[0]],
                            [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba(f,f,f,f)')]
                        ]                   
                    },
                    marker: {
                        radius: 2
                    },
                    lineWidth: 2,
                    states: {
                        hover: {
                            lineWidth: 3
                        }
                    },
                    threshold: null
                }
            },

            series:series

      });
    }

现在,当我运行它时,我收到以下错误:

enter image description here

任何人都可以帮助我的代码出错吗?(我提前感谢任何帮助)

0 个答案:

没有答案