javascript - Uncaught TypeError: data.map is not a function -


i'm using d3 try recreate pie chart. whenever pass data in (3 values), aforementioned error. believe know problem, problem 3 values not mapped anything. example, when tried mapped values supplierid's , therefore split multiple different segments correct. values wrong. have remedied values, not mapped , therefore not display. there way around this?

for example manually assign them id map to? or there way around this?

d3:

 <script>         var width = 960,     height = 500,     radius = math.min(width, height) / 2;          var color = d3.scale.ordinal()             .range(["#98abc5", "#8a89a6", "#7b6888"]);          var arc = d3.svg.arc()             .outerradius(radius - 10)             .innerradius(0);          var pie = d3.layout.pie()             .sort(null)             .value(function (d) { return d.querytotal; });          var svg = d3.select("body").append("svg")             .attr("width", width)             .attr("height", height)           .append("g")             .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");          var data = @html.raw(@model.output);          console.log(data);              var g = svg.selectall(".arc")                 .data(pie(data))               .enter().append("g")                 .attr("class", "arc");              g.append("path")                 .attr("d", arc)                 .style("fill", function (d) { return color("querytotal"); });              g.append("text")                 .attr("transform", function (d) { return "translate(" + arc.centroid(d) + ")"; })                 .attr("dy", ".35em")                 .style("text-anchor", "middle")             .text(function (d) { return "querytotal"; });     </script> 

data:

normaltotal: 0 querytotal: 131058.34 strongtotal: 0 

linq:

public totalvaluebysupplierandclaimtypemodel gettotalvaluebysupplierandclaimtype(int clientid, int reviewperiodid, int statuscategoryid) {             var rt =                 this.getvaluebysupplierandclaimtype(clientid, reviewperiodid, statuscategoryid);              totalvaluebysupplierandclaimtypemodel x = new totalvaluebysupplierandclaimtypemodel() {                 normaltotal = rt.sum(c=>c.normal) ?? 0,                 querytotal = rt.sum( c => c.query) ?? 0,                 strongtotal = rt.sum( c => c.strong) ?? 0             };              return x;         } 

update: need assign id each 1 of values in linq statement. have values in viewmodel. however, i'm not sure how this. else?


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -