2017-02-21 1 views
0

This is my multiple bar graph which i m getting Highcharts Spalte + line Kombinationstabelle mit mehreren Serien

In meinem Graph möchte ich beide Spalte Graph und Liniendiagramm (Trendlinie) für Zählung hinzuzufügen. Mein Code ist wie folgt:

     var crime_data=[]; 
          for(var i=0;i<result.themes.length;i++){ 
           var crime={}; 
           var test2 = result.themes[i]; 
           var test = test2[Object.keys(test2)]; 
           console.log("test",test); 
           crime.name = Object.keys(result.themes[i]); 
           crime.data = []; 
           var test1 = test.individualValueVariable; 
           for(var j=0;j<test1.length;j++){ 
           crime.data.push(test1[j].count); 
          }; 
           crime_data.push(crime); 
          }; 
     var crimeChart = new Highcharts.Chart({ 
      chart: { 
      renderTo: 'container1', 
      type: 'colomn' 
      }, 

      xAxis: { 
       categories:year, 
       crosshair: true 
      }, 
      yAxis: { 
       min: 0, 
       title: { 
        text: 'Count' 
       } 
      }, 
       credits: { 
        enabled: false 
      }, 
      tooltip: { 

       shared: true, 
      }, 
      plotOptions: { 

       column: { 
        pointPadding: 0.2, 
        borderWidth: 0, 
        depth: 25, 
        allowPointSelect: true, 
        cursor: 'pointer', 
        point: { 
          }, 
    } 
     }, 
      series:crime_data 
     }); 

Wenn ich Typ "Spline" in Reihe hinzufügen. Ich bekomme nicht einmal Daten und keine Trendlinie. Bitte schlagen Sie mir vor, wie ich in diesem Fall Trendlinie hinzufügen soll.

Und das ist meine JSON:

{ 
    "boundaries": { 
     "boundary": [{ 
      "boundaryId": "45083021025", 
      "boundaryType": "USA_POSTCODE", 
      "boundaryRef": "B1" 
     }] 
    }, 
    "themes": [{ 
     "TheftCrimeTheme": { 
      "boundaryRef": "B1", 
      "individualValueVariable": [{ 
       "name": "2012 Theft Crime", 
       "description": "Theft Crime for 2012", 
       "count": 310 
      }, { 
       "name": "2013 Theft Crime", 
       "description": "Theft Crime for 2013", 
       "count": 230 
      }] 
     } 
    }, { 
     "AssaultCrimeTheme": { 
      "boundaryRef": "B1", 
      "individualValueVariable": [{ 
       "name": "2012 Assault Crime", 
       "description": "Assault Crime for 2012", 
       "count": 50 
      }, { 
       "name": "2013 Assault Crime", 
       "description": "Assault Crime for 2013", 
       "count": 41 
      }] 
     } 
    }] 
} 

Bitte mir vorschlagen, wie sollte ich das tun.

Antwort

Verwandte Themen