5

I drew a line chart using flot in the studentchart div using:

$.plot(jQuery("#studentavgchart"), DATA, options);  

Graph will draw outside the div with class oneTwo. If I can remove the style of the div studentchart it shows javascript error. I need to draw the graph inside the parent div ie; in oneTwo

<div class="oneTwo">
    <div class="widget" >
        <div class="header">
            <span>
                <span class="ico gray info2"></span>Total Class No
            </span>
        </div>
        <div class="content">
            <div id="studentchart" style="width:100%;height:300px;"></div>
        </div>
    </div>
</div> 
sMaN
  • 3,667
  • 4
  • 23
  • 33
Sanu Saji
  • 137
  • 2
  • 9

1 Answers1

19

I see your plot function call is using "studentavgchart" and your div has the id of "studentchart"

I ran into this issue as well and found that my Plot div needed a style or a class that specified the height. Either in pixels or %.

Hope that helps.

Ethan
  • 400
  • 4
  • 10
  • If the height needs to be proportionate to the width (not a rare case, ime), this answer is relevant: http://stackoverflow.com/a/10441480/638544 – Brilliand Mar 14 '14 at 15:36