HighChart标记数据加载问题

时间:2014-06-10 05:07:44

标签: javascript json highcharts

我正在从我们的数据中绘制图表。基本上绘制图形没有问题。唯一的问题是标志信息未加载并位于图形线上。让我告诉你这个问题。

  1. 如果数据超过900个项目,则无法将数据带入图表。
  2. 一项数据可能超过4000项。
  3. 使用一个大数据,我试图将一个数据溢出到一小段数据中。每条数据都有800个项目,它们可以按顺序加载到图表上。但是,这个过程并不容易。有时,图形模块无法精确加载每一块。而且,这个过程比使用一个数据需要花费很多时间。
  4. 我想知道是否有一种合适的方法可以加载包含许多项目的标记数据。

    $(function() {
        var report_data;
        $.ajax({
            type: "post",
            url:"/apps.chart/chart.reportShort",
            data:"callback=?&report_type=CO&business_code=005930",
            dataType:"json",
            success:function(report){
                report_data = report;
            }
        });
    
        $.getJSON('/apps.chart/chart.chartList?callback=?&report_type=CO&business_code=005930', function(data) {
    
            // Create the chart
            $('#chartView').highcharts('StockChart', {
                chart: {
                    plotBorderColor: '#346691',
                    plotBorderWidth: 2,
                    height: 600
                },
                rangeSelector : {
                    inputEnabled: $('#chartView').width() > 400,
                    selected : 1
                },
    
                title : {
                    text : 'SK'
                },
    
                tooltip: {
                    type: 'datetime',
                    dateTimeLabelFormats: {
                        day: '%Y년 %m월 %d일'
                    },
                    style: {
                        width: '300px'
                    },
                    valueDecimals: 0
                },
                xAxis: {
                    type: 'datetime',
                    dateTimeLabelFormats: {
                        day: '%m.%d',
                        week: '%m.%d',
                        month: '%Y.%m',
                        year: '%Y'
                    }
                },
                yAxis : {
                    labels : {
                        formatter : function() {
                            var n = this.value;
                            var reg = /(^[+-]?\d+)(\d{3})/;
                            n += '';
                            while (reg.test(n))
                            n = n.replace(reg, '$1' + ',' + '$2');
    
                            return n;
                        },
                        align : 'left',
                        x : 5,
                        y : 2
                    },
                    maxPadding: 0.2,
                    minPadding: 0,
                    minorTickInterval: 'auto',
                    title : {
                        text : '금액(원)',
                    }
                },
    
                series : [{
                    name : '종가',
                    data : data,
                    id : 'dataseries',
                    marker : {
                        enabled : true,
                        radius : 3
                    },
                    shadow : true,
                    tooltip : {
                        valueDecimals : 0
                    }
                }
                // the event marker flags
                ,{
                    type : 'flags',
                    data : report_data,
                    style: {
                        cursor: 'hand'
                    },
                    onSeries : 'dataseries',
                    shape : 'circlepin',
                    width : 15,
                    height : 15,
                    color : '#121212'
                }
                ]
            });
        });
    });
    

1 个答案:

答案 0 :(得分:0)

可能问题是你异步调用两个ajax,所以我建议你下一个ajax insiae第一个回调然后初始化图表。

相关问题