0

3 つの Y 軸を追加しようとしているので、データ系列ごとに 1 つの Y 軸があります。

これは有効な私の JSON です。

[{"name": "data1"、 "data":[[1361574000000,121201]、[1362006000000,122019]、[1363388400000,122788]、[1363820400000,123740]、[1364511600,000,124703]、[1363820400000,123740]、 ,[1365544800000,126553],[1366063200000,127496],[1366668000000,128500],[1367272800000,129433],[1368309600000,130277],[1368655200000,131267],[1369346400000,132191],[1369864800000,133143]]} ,{"名前":"データ 2","データ":[[1361574000000,0],[1362006000000,40.6],[1363388400000,35.7],[1363820400000,41.24],[1364511600000,40.56],[130651 、[1365544800000,39.8]、[1366063200000,40.58]、[1366668000000,40.79]、[1367272800000,38.06]、[1368309600000,37.95]、[13685200000,41.34,41.36441.3641696969696969696969696969696969696969696930]、 ,{"名前":"data3","データ":[[1361574000000,0],[1362006000000,1.46],[1363388400000,1.42],[1363820400000,1.42]、[1364511600000,1.37]、[1365112800000,1.41]、[1365544800000,1.41]、[1366063200000,1.35]、[136666680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ,1.36],[1369346400000,1.37],[1369864800000,1.359]]},{"名前":"データ4","データ":[[1361574000000,0],[1362006000000,59.276],[1363388400004],50. [1363820400000,58.5608],[1364511600000,55.5672],[1365112800000,54.9336],[1365544800000,56.118],[1366063200000,54.783],[1366668000000,59.1455],[1367272800000,51.7616],[1368309600000,51.612],[1368655200000 ,56.1816],[1369346400000,55.0192],[1369864800000,52.71561]]}]"data4"、 "data":[[1361574000000,0]、[1362006000000,59.276]、[1363388400000,50.694]、[1363820400,000,58.5608]、[1364511600000,55672]、[1365128554.554.554.554.554.554.554.554.554.5554.5554. 、[1366063200000,54.783]、[13666680000,59.1455]、[1367272800000,51.7616]、[1368309600000,51.612]、[13686655200000,000,00000,000]、[136933346464646665201616616]"data4"、 "data":[[1361574000000,0]、[1362006000000,59.276]、[1363388400000,50.694]、[1363820400,000,58.5608]、[1364511600000,55672]、[1365128554.554.554.554.554.554.554.554.554.5554.5554. 、[1366063200000,54.783]、[13666680000,59.1455]、[1367272800000,51.7616]、[1368309600000,51.612]、[13686655200000,000,00000,000]、[136933346464646665201616616]

JS コード

$(function() {

    $.getJSON('testdata.php', function(data) {
        // Create the chart
        $('#container').highcharts('StockChart', {


            title : {
                text : 'Temperature'
            },

            yAxis: [{
                title: {
                    text: 'A'
                }
            }, {
                title: {
                    text: 'B'
                }
            }, {
                title: {
                    text: 'C'
                }
            }, {
                title: {
                    text: 'D'
                }
            }],

            series: [{
                type: 'line',
                name: 'data1',
                data: data1,
        yAxis: 1,
                }
            }, {
                type: 'line',
                name: 'data2',
                yAxis: 2,
                data: data2
            }, {
                type: 'line',
                name: 'data3',
                yAxis: 3,
                data: data3
        }, {
                type: 'line',
                name: 'data4',
                yAxis: 4,
                data: data4
             }]
    });
   });
});

ただし、複数の Y 軸を追加するとすぐにグラフが読み込まれません。私は何を間違っていますか?

4

2 に答える 2

0

それは今ようやく動作します!ありがとうございました!!

作業コード (前述の JSON と組み合わせたもの):

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Highcharts Example</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="http://code.highcharts.com/stock/highstock.js"></script>
    <script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
    <script type="text/javascript">
$(function() {

    $.getJSON('testdata.php', function(data) {
        // Create the chart
        $('#container').highcharts('StockChart', {


            title : {
                text : 'Temperature'
            },

            yAxis: [{
                title: {
                    text: 'A'
                }
            }, {
                title: {
                    text: 'B'
                }
            }, {
                title: {
                    text: 'C'
                }
            }, {
                title: {
                    text: 'D'
                }
            }],

            series: [{
                type: 'line',
                name: 'data1',
                yAxis: 0,
                data: data[0].data,
            }, {
                type: 'line',
                name: 'data2',
                yAxis: 1,
                data: data[1].data
            }, {
                type: 'line',
                name: 'data3',
                yAxis: 2,
                data: data[2].data
            }, {
                type: 'line',
                name: 'data4',
                yAxis: 3,
                data: data[3].data
             }]
    });
   });
});
        </script>
    </head>
    <body>
    <div id="container" style="height: 500px; min-width: 500px"></div>
    </body>
</html>
于 2013-06-17T15:24:29.417 に答える