don't generate zero for null values
[MojoFacets.git] / public / facet_graph.js
index e20a4fc..21b8dd9 100644 (file)
@@ -1,3 +1,12 @@
+$(document).ready( function() {
+
+var count = parseInt( $('#facet-count').text() );
+if ( count > 5000 ) {
+       console.debug( 'skip graph', count );
+       return;
+}
+console.debug( 'drawing graph', count );
+
 var data = {
        x: {
                min: Number.MAX_VALUE,
@@ -90,7 +99,7 @@ while( i_float < elements ) {
                data.x.px.push( x );
        } else {
                var x_px = i * data.x.inc_bar;
-               console.debug( x_px, y );
+//             console.debug( x_px, y );
                ctx.fillRect( x_px, 0, data.x.inc_bar, -y );
                ctx.strokeRect( x_px, 0, data.x.inc_bar, -y );
        }
@@ -129,3 +138,4 @@ draw_labels( 'labels-y', data.y, data.height, 'bottom', 'bottom:'+data.height+'p
 
 console.debug( 'data', data );
 
+}); // document.ready