When using the Flot module with the Apache Solr Autocomplete module, it does not display the plot. The style classes are rendered and the javascript is added to the page, but the div for the graph is blank. In other words, there is a blank div block where the graph should be displayed. When Apache Solr Autocomplete is disabled, it displays the plot as expected.

This may be a bug with the flot library. I'll do a search there too.
I am seeing one console error related to autocomplete.js:
jquery.autocomplete.js?nl5r0y:82 Uncaught TypeError: Cannot read property 'opera' of undefined

Should we consider involving the Apache Solr Autocomplete dev team?

This is the node template code I was using to plot:

          $j=0;
          $d=array();
          for($i=0; $i < M_PI * 2; $i+=0.25) {
             $x=$i;
                 $y=cos($i);
                 $d[$j]=array($x,$y);
                 $j++;
          }
          $fd=new flotData($d);
          $fd->label=t('cos(x)');
          $options = new flotStyle();
          $options->series->points->show=TRUE;
          $options->series->lines->show=TRUE;
          print theme('flot_graph', array('data'=>array($fd),'element'=>array( 'style'=> "width:100%;height:400px"),'zoom'=>TRUE,'legend'=>TRUE,'options'=>$options));

I put this code in a node--#.php.tpl file to display the flot graph in a particular node.

The flot module is providing this style information in the content div:

<div class="content">
    <div style="width:100%;height:400px" class="flot  flot-with-zoom" id="flot-view-zoomable-0"></div><div id="flot-view-zoomable-0-zoom" style="width:100%;height:100px" class="flot-zoom"></div><div></div>  </div>

Then the flot module is providing this javascript to display the graph:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

    jQuery(document).ready(function() {
      Drupal.flot['flot_view_zoomable_0'] = {};
      Drupal.flot['flot_view_zoomable_0']['flot'] = jQuery.plot(jQuery("#flot-view-zoomable-0"), [{"data":[[0,1],[0.25,0.96891242171064],[0.5,0.87758256189037],[0.75,0.73168886887382],[1,0.54030230586814],[1.25,0.31532236239527],[1.5,0.070737201667703],[1.75,-0.17824605564949],[2,-0.41614683654714],[2.25,-0.62817362272274],[2.5,-0.80114361554693],[2.75,-0.92430237863246],[3,-0.98999249660045],[3.25,-0.99412967608055],[3.5,-0.9364566872908],[3.75,-0.82055935733956],[4,-0.65364362086361],[4.25,-0.44608748991379],[4.5,-0.21079579943078],[4.75,0.037602152887977],[5,0.28366218546323],[5.25,0.51208547724184],[5.5,0.70866977429126],[5.75,0.86119241716152],[6,0.96017028665037],[6.25,0.9994494182245]],"series":{"lines":{},"bars":{},"points":{},"pie":{}},"grid":{},"label":"cos(x)"}], {"grid":{"labelMargin":0,"tickColor":"#eee","backgroundColor":"#f8f8f8","borderWidth":0,"hoverable":true,"autoHighlight":true,"clickable":false},"series":{"lines":{"show":true},"bars":{},"points":{"show":true},"pie":{}},"shadowSize":0,"selection":{"mode":"x"},"legend":{"show":true,"position":"ne"}});
      Drupal.flot['flot_view_zoomable_0']['options'] = {"grid":{"labelMargin":0,"tickColor":"#eee","backgroundColor":"#f8f8f8","borderWidth":0,"hoverable":true,"autoHighlight":true,"clickable":false},"series":{"lines":{"show":true},"bars":{},"points":{"show":true},"pie":{}},"shadowSize":0,"selection":{"mode":"x"},"legend":{"show":true,"position":"ne"}};
      Drupal.flot['flot_view_zoomable_0']['data'] = [{"data":[[0,1],[0.25,0.96891242171064],[0.5,0.87758256189037],[0.75,0.73168886887382],[1,0.54030230586814],[1.25,0.31532236239527],[1.5,0.070737201667703],[1.75,-0.17824605564949],[2,-0.41614683654714],[2.25,-0.62817362272274],[2.5,-0.80114361554693],[2.75,-0.92430237863246],[3,-0.98999249660045],[3.25,-0.99412967608055],[3.5,-0.9364566872908],[3.75,-0.82055935733956],[4,-0.65364362086361],[4.25,-0.44608748991379],[4.5,-0.21079579943078],[4.75,0.037602152887977],[5,0.28366218546323],[5.25,0.51208547724184],[5.5,0.70866977429126],[5.75,0.86119241716152],[6,0.96017028665037],[6.25,0.9994494182245]],"series":{"lines":{},"bars":{},"points":{},"pie":{}},"grid":{},"label":"cos(x)"}];
    });
  
//--><!]]>
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--

      jQuery(document).ready(function() {
        Drupal.flot['flot_view_zoomable_0_zoom'] = {};
        Drupal.flot['flot_view_zoomable_0_zoom']['flot'] = jQuery.plot(jQuery("#flot-view-zoomable-0-zoom"), [{"data":[[0,1],[0.25,0.96891242171064],[0.5,0.87758256189037],[0.75,0.73168886887382],[1,0.54030230586814],[1.25,0.31532236239527],[1.5,0.070737201667703],[1.75,-0.17824605564949],[2,-0.41614683654714],[2.25,-0.62817362272274],[2.5,-0.80114361554693],[2.75,-0.92430237863246],[3,-0.98999249660045],[3.25,-0.99412967608055],[3.5,-0.9364566872908],[3.75,-0.82055935733956],[4,-0.65364362086361],[4.25,-0.44608748991379],[4.5,-0.21079579943078],[4.75,0.037602152887977],[5,0.28366218546323],[5.25,0.51208547724184],[5.5,0.70866977429126],[5.75,0.86119241716152],[6,0.96017028665037],[6.25,0.9994494182245]],"series":{"lines":{},"bars":{},"points":{},"pie":{}},"grid":{},"label":"cos(x)"}], {"grid":{"labelMargin":0,"tickColor":"#eee","backgroundColor":"#f8f8f8","borderWidth":0,"hoverable":false,"autoHighlight":true,"clickable":false},"series":{"lines":{"show":true,"lineWidth":1},"bars":{},"points":{"show":false},"pie":{},"shadowSize":0},"shadowSize":0,"selection":{"mode":"x"},"legend":{"show":false,"position":"ne"}});
        Drupal.flot['flot_view_zoomable_0_zoom']['options'] = {"grid":{"labelMargin":0,"tickColor":"#eee","backgroundColor":"#f8f8f8","borderWidth":0,"hoverable":false,"autoHighlight":true,"clickable":false},"series":{"lines":{"show":true,"lineWidth":1},"bars":{},"points":{"show":false},"pie":{},"shadowSize":0},"shadowSize":0,"selection":{"mode":"x"},"legend":{"show":false,"position":"ne"}};
        Drupal.flot['flot_view_zoomable_0_zoom']['data'] = [{"data":[[0,1],[0.25,0.96891242171064],[0.5,0.87758256189037],[0.75,0.73168886887382],[1,0.54030230586814],[1.25,0.31532236239527],[1.5,0.070737201667703],[1.75,-0.17824605564949],[2,-0.41614683654714],[2.25,-0.62817362272274],[2.5,-0.80114361554693],[2.75,-0.92430237863246],[3,-0.98999249660045],[3.25,-0.99412967608055],[3.5,-0.9364566872908],[3.75,-0.82055935733956],[4,-0.65364362086361],[4.25,-0.44608748991379],[4.5,-0.21079579943078],[4.75,0.037602152887977],[5,0.28366218546323],[5.25,0.51208547724184],[5.5,0.70866977429126],[5.75,0.86119241716152],[6,0.96017028665037],[6.25,0.9994494182245]],"series":{"lines":{},"bars":{},"points":{},"pie":{}},"grid":{},"label":"cos(x)"}];
      });
    
//--><!]]>
</script>

Comments

attiks’s picture

Looking at the error jquery.autocomplete.js?nl5r0y:82 Uncaught TypeError: Cannot read property 'opera' of undefined I think it is something from apache solr, do you get this error on other pages as well? I guess the error stops all execution of javascript, hence you don't see the graph.

orange-wedge’s picture

Yep, when I enable Apache Solr autocomplete, the jquery error arises on other pages too.

beakerboy’s picture

Status: Active » Closed (won't fix)