I am using Twitter Bootstrap AngularJS to build a web application. In a modal window, I like to show a JQuery Flot real-time graph similar to this: http://people.iola.dk/olau/flot/examples/realtime.html
I copied the code from http://people.iola.dk/olau/flot/examples/realtime.html and put it in a file called flot2.html on my server. It is working. I only specify the height and it automatically sets the width to 100%
However, when I put the code in my template file (index.html) and in the modal window, there are two problems. It gives me this error below if I don't specify the width:
Invalid dimensions for plot, width = 0, height = 300
I set width = 100%, but it looks like it only shows 100px.
Also, the labels for the Y axis are above the top of the left edge / border of the grid, and not a few pixels to the left of it.
Here is the code:
In index.app.html:
<!DOCTYPE HTML> <html ng-app="app"> ... <body ng-controller="AppCtrl"> ... <div class="container"> <div ng-view></div> </div> ... <script src="/js/jquery.min.js">
In the template (index.html):
... <div class="modal fade hide" id="chartModal"> ... <style> display:block!important; </style> <script src="/js/jquery.flot.min.js"></script> <script src="/js/flot/flot.demo.js"></script> <div id="placeholder" style="width:100%; height:300px; display:block"></div>
In bootstrap.css:
... .hide { display: none; }
I noticed that when I remove "hide" from:
<div class="modal fade hide" id="chartModal">
my two problems go away and the chart looks fine. But removing the βhideβ causes other problems on the site, and therefore I canβt remove it. Therefore, I added this code (as you can see above):
<style> display:block!important; </style>
But he does nothing. I tried almost all the options for display, such as display: auto, display: inline, display: table, etc., but none of them work.
Can anyone suggest a solution?