0

我对 android 和 java 很陌生。所以不要求明确的答案只是一个正确的方向。网站正在使用 highcharts,我得到的是 highchart 数据。

http://webpage/javascript/city/newyork.js


new Highcharts.Chart({
chart: { renderTo: 'graph1' },
yAxis: { min: 0, max: 100 },
plotOptions: { line: { dataLabels: { y: 20 } } },
series: [{ data: [95,96,96,45,37,36,42,51,54,61,62,49,42,39,47,56,60,63,61,49,35,35,39,46,52] }]
});

new Highcharts.Chart({
chart: { renderTo: 'graph2', defaultSeriesType: 'column' },
yAxis: { min: 0, max: 3 },
plotOptions: { column: { pointPadding: 0.2, borderWidth: 0 } },
series: [{ data: [0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00] }]
});

new Highcharts.Chart({
chart: { renderTo: 'graph4' },
plotOptions: { line: { dataLabels: { formatter: function() { if(this.x != ' ') return this.y; } } } },
series: [{ data: [1015,1016,1018,1018,1017,1015,1015,1016,1017,1017,1018,1017,1015,1013,1012,1013,1011,1010,1011,1010,1008,1006,1007,1008,1009] }]
});

$(document).ready(
function($){

    $('#sevendays > li').live(
        'click hover',
        function(){
            $('#sevendays > li').removeClass('selected');
            $(this).addClass('selected');
            $('.day').hide();
            $('#chosen-day > div:nth-child(' + ($(this).index() + 1) + ')').show();
        }
    );

    $('#chonsen-city a').click(
        function(){
            icity = $(this).attr('rel');
            $('#chosen-city').load('/ajax/chosen-city.php', {ig: icity});
            return false;
        }
    );
});

我需要的是获取graph1、graph2和graph4数据的数字数组,这样我就可以绘制自己的图表。大多数教程都是关于 json 解析的,但是由于这不是 json 格式,我有点迷失了。再一次,只是正确的方向,一些可读的材料。谢谢你。

4

1 回答 1

0

您可以遍历每个图表的系列并构建一个 y 值数组:

http://jsfiddle.net/jlbriggs/JVNjs/298/

var data1 = new Array();
for(var i = 0; i < chart1.series[0].data.length;i++){
    data1.push(chart1.series[0].data[i].y);
}
于 2013-05-13T13:16:12.503 回答