2016-05-14 11 views
1

Ich erstelle Multibarchart mit eckigen nvd3. Es zeigt die Daten korrekt in gruppiertem Format an, aber wenn auf gestapelt geklickt wird, werden nur einzelne Farben angezeigt. Ich hatte einen Plünderer dafür geschaffen. Irgendwelche Ideen, was ich falsch mache?Angular nvd3 multibarchart gestapelt nicht richtig angezeigt

$scope.options = { 
     chart: { 
      type: 'multiBarChart', 
      height: 450, 
      margin : { 
       top: 20, 
       right: 20, 
       bottom: 45, 
       left: 45 
      }, 
      clipEdge: true, 
      duration:500, 
      xAxis: { 
       axisLabel: 'Date/Hour', 
       showMaxMin: false, 
       tickFormat: function(d){ 
        if($scope.hourly === 'Y') 
         return d3.format(',f')(d); 
        else { 
         var dt = new Date(d); 
         dt.setTime(dt.getTime() + dt.getTimezoneOffset() * 60 * 1000); 
         return d3.time.format('%Y-%m-%d')(dt); 
        } 
       } 
      }, 
      yAxis: { 
       axisLabel: 'Count', 
       axisLabelDistance: -20, 
       tickFormat: function(d){ 
        return d3.format(',f')(d); 
       } 
      } 
     } 
    }; 

    $scope.data = [ { 
    "key":"5-ISSUED", 
    "values":[ 
    { 
     "x":"2016-05-12", 
     "y":"736" 
    }, 
    { 
     "x":"2016-05-11", 
     "y":"1051" 
    }, 
    { 
     "x":"2016-05-10", 
     "y":"1369" 
    }, 
    { 
     "x":"2016-05-09", 
     "y":"937" 
    }, 
    { 
     "x":"2016-05-08", 
     "y":"118" 
    }, 
    { 
     "x":"2016-05-07", 
     "y":"59" 
    }, 
    { 
     "x":"2016-05-06", 
     "y":"430" 
    } 
    ] 
}, 
{ 
    "key":"4-PAID", 
    "values":[{ 
     "x":"2016-05-12", 
     "y":"628" 
    }, 
    { 
     "x":"2016-05-11", 
     "y":"1052" 
    }, 
    { 
     "x":"2016-05-10", 
     "y":"1624" 
    }, 
    { 
     "x":"2016-05-09", 
     "y":"1256" 
    }, 
    { 
     "x":"2016-05-08", 
     "y":"116" 
    }, 
    { 
     "x":"2016-05-07", 
     "y":"59" 
    }, 
    { 
     "x":"2016-05-06", 
     "y":"395" 
    } 
    ] 
}, 
{ 
    "key":"0-ABANDONDED", 
    "values":[ 
    { 
     "x":"2016-05-12", 
     "y":"89" 
    }, 
    { 
     "x":"2016-05-11", 
     "y":"102" 
    }, 
    { 
     "x":"2016-05-10", 
     "y":"77" 
    }, 
    { 
     "x":"2016-05-09", 
     "y":"59" 
    }, 
    { 
     "x":"2016-05-08", 
     "y":"2" 
    }, 
    { 
     "x":"2016-05-07", 
     "y":"4" 
    }, 
    { 
     "x":"2016-05-06", 
     "y":"49" 
    } 
    ] 
} 
] 

Link to Plunker

Antwort

1

Sie einen String-Wert in der y vorbei

"x":"2016-05-09", 
"y":"59" //this is wrong should be a number not a string 

es sollte eine Zahl wie unten sein:

"x":"2016-05-09", 
"y":59 //this is the right way to give number 

korrigierte Code here

+0

Danke, Cyril, dass du dir Zeit genommen hast, dich zu korrigieren. – Apu

+0

@Apu, wenn Sie das Gefühl haben, ich habe Ihre Frage beantwortet, können Sie es als Antwort hier markieren, wie es funktioniert http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Cyril

+0

Hallo Cyril Ich habe nicht genug Ruf, um es als Antwort zu markieren, aber es war völlig korrekt. – Apu

Verwandte Themen