1

highChartsのxmlチャートに問題があります。毎月稼いだものがわかるチャートを作ってみました。しかし、私は2012年から12月にすべてをまとめる方法などを理解できません。

これは私のXMLファイルからのテストです

<invoices>
    <invoice>
        <ID>0000152</ID>
        <Date>2012 17 12</Date>
        <Client>Wunderman</Client>
        <Amount>9,171.87</Amount>
        <Status>Sent</Status>
    </invoice>
    <invoice>
        <ID>0000151</ID>
        <Date>2012 19 12</Date>
        <Client>Valtech</Client>
        <Amount>83,281.25</Amount>
        <Status>Paid</Status>
    </invoice>
    <invoice>
        <ID>0000150</ID>
        <Date>2011 16 11</Date>
        <Client>Skanlog</Client>
        <Amount>3,125.00</Amount>
        <Status>Due</Status>
    </invoice>
</invoices>

そして、これが私のJSファイルです。

$.get('includes/invoices.xml', function(xml) {

    // Split the lines
    var $xml = $(xml);
    var yearArray = new Array();

    // Push Years
     $xml.find('invoice').each(function(i, invoices) {
         var seriesOptions = {
         name : $(invoices).find('Date').text().substring(0, 4),
         data : []
     };

     if(jQuery.inArray(seriesOptions.name, yearArray) == -1) {
            $('<p></p>').html(seriesOptions.name).appendTo('body');
            yearArray.push(seriesOptions.name);             
        }


        // Push Amount ?        
        $(invoices).find('Amount').each(function(i, amounts) {
            var thisYear = $(invoices).find('Date').text().substring(0, 4)
            var thisMonth = $(invoices).find('Date').text().substring(8, 10)


            if($(invoices).find("Date").indexOf('2012') > -1){
                alert("sss");                   
            }
         });

        // add it to the options
        options.series.push(seriesOptions);
    });

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

});

あなたが助けてくれることを願っています、それで私は先に進むことができます:(

4

0 に答える 0