javascript - Failed building a chart in meteor using dc-js, d3.js and crossfilter -


i'm new forum, meteor, , dc.js, , want add charts in project i'm working at, found tutorial doing making dashboards dc.js, tried adapt in meteor, passed first part without problems, face problem in 2nd part, because have done can see no chart, there no errors in console, nothing happen.

this parts of code:

chart1.html

<div id="chart-line-hitsperday"></div> <div id="chart-ring-year"></div> {{exemple1}} 

chart1.js

    template.chart1.helpers({     'exemple1' : function(){          hitslinechart  = dc.linechart("#chart-line-hitsperday");           function print_filter(filter){             var f=eval(filter);             if (typeof(f.length) != "undefined") {}else{}             if (typeof(f.top) != "undefined") {f=f.top(infinity);}else{}             if (typeof(f.dimension) != "undefined") {f=f.dimension(function(d) { return "";}).top(infinity);}else{}             console.log(filter+"("+f.length+") = "+json.stringify(f).replace("[","[\n\t").replace(/}\,/g,"},\n\t").replace("]","\n]"));         }           var data = [         {date: "12/27/2012", http_404: 2, http_200: 190, http_302: 100},         {date: "12/28/2012", http_404: 2, http_200: 10, http_302: 100},         {date: "12/29/2012", http_404: 1, http_200: 300, http_302: 200},         {date: "12/30/2012", http_404: 2, http_200: 90, http_302: 0},         {date: "12/31/2012", http_404: 2, http_200: 90, http_302: 0},         {date: "01/01/2013", http_404: 2, http_200: 90, http_302: 0},         {date: "01/02/2013", http_404: 1, http_200: 10, http_302: 1},         {date: "01/03/2013", http_404: 2, http_200: 90, http_302: 0},         {date: "01/04/2013", http_404: 2, http_200: 90, http_302: 0},         {date: "01/05/2013", http_404: 2, http_200: 90, http_302: 0},         {date: "01/06/2013", http_404: 2, http_200: 200, http_302: 1},         {date: "01/07/2013", http_404: 1, http_200: 200, http_302: 100}         ];          var ndx = crossfilter(data);          var parsedate = d3.time.format("%m/%d/%y").parse;          data.foreach(function(d) {             d.date = parsedate(d.date);             d.total= d.http_404+d.http_200+d.http_302;         });         print_filter("data");            var datedim = ndx.dimension(function(d) {return d.date;});         var hits = datedim.group().reducesum(function(d) {return d.total;});          //var hits = datedim.group().reducesum(dc.pluck('total'));           print_filter("datedim");           datedim.filterall();          print_filter("hits");            var mindate = datedim.bottom(1)[0].date;         var maxdate = datedim.top(1)[0].date;           hitslinechart             .width(500).height(200)             .dimension(datedim)             .group(hits)             .x(d3.time.scale().domain([mindate,maxdate]));           dc.renderall();        } }); 

and main template contains first template: pdv.html

    <template name="pdv">            ...       {{>chart1}}     </template> 

please me !!


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -