开发者

Highcharts won't show line through my dots

This is my full code:

    $(document).ready(function()
    {
       var options = 
       {
            chart: { renderTo: 'zb'  },
            title: { text: 'Test' },
            tooltip:
            {
                enabled: true,
                formatter: function()
                {
                    return '<b>' + this.x + ' ' + this.series.name + '</b><br/>' + this.y;
          开发者_开发百科      }
            },
            xAxis: { categories: [] },
            yAxis: { title: { text: 'Visits Num' } },
            series: [],
            plotOptions:{ line: { lineWidth : 2 } }
       };
       var tpo;
       $.ajax({url: 'utils/request2.php', success: function(data)
       {
            var lines = data.split('\n');
            var series = 
            {
                type: 'line',
                name: 'Visits',
                data: [],
                marker: { enabled: true, radius : 3 }
            };
            var cats = [];
            $.each(lines, function(lineNo, line)
            {
                var line_data = line.split(',');
                series.data.push(parseInt(line_data[1]));
            });

            options.series.push(series);

            var chart = new Highcharts.Chart(options);
       }});
    });

It calls to the request2.php file that have data (saved in UTF8 without BOM if it matters) separated with comma, 2 values per row

When I'm showing the data without the parseInt it's showing the line, but the numbers are wrong because it's string - like showing 1500 as 20

Anyone have an idea why?

Thanks alot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜