Austin Gayler
Austin Gayler

Reputation: 4356

Why is my Flot plot function not working?

I'm trying to follow this tutorial to make a simple graph. However, I'm getting an empty divider when I load the page.

Relevant code:

<head>
<script language="javascript" type="text/javascript" src="js/flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="js/flot/jquery.flot.js"></script>

<script type="text/javascript">
$(function() {
    $.plot($("#graphs"), [[[0,0],[1,1]]);
});
</script>

</head>

<body>
<div id="graphs" style="width:600px; height:400px">
</div> 
</body>

I have page.php in the www directory, then the two .js files in www/js/flot

Upvotes: 0

Views: 1239

Answers (1)

Badr Hari
Badr Hari

Reputation: 8374

You have an unnecessary bracket in your code.

$(document).ready(function(){
    $.plot($("#graph"), [[0,0],[1,1]]);
});

Working example: http://jsfiddle.net/ym6dbt10/3/

You should use your browser console to debug that kind of problems, if you don't understand the error it gives, write it down here to maybe people can help, if you just write it doesn't work, it gives no information.

Upvotes: 1

Related Questions