I want to use (jquery) jqplot in my Joomla (3.3) view file - default.php, pls see code below.
However, when calling this file the frontpage does not show a chart and the console shows the error 'Uncaught typeError: Undefined is not a function' at the line of $(document).ready() function.
I suspect I embed the $(document).ready() function in the wrong way in the default.php file(?), but I don't know how to fix this. Any suggestions?
Joomla default.php view file:
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();
//add jqplot libraries
//JHtml::_('jquery.framework); //I tried this before - same console error
JHtml::_('jquery.framework', false);
JHTML::script('jquery.jqplot.min.js');
$document->addStyleSheet('media/system/js/jquery.jqplot.min.css');
JHTML::script('jquery.jqplot.min.css');
JHTML::script('jqplot.barRenderer.min.js');
JHTML::script('jqplot.categoryAxisRenderer.min.js');
JHTML::script('jqplot.pointLabels.min.js');
JHTML::script('jqplot.enhancedLegendRenderer.js');
JHTML::script('weqlib.js');
?>
<head>
<script type="text/javascript">
$(document).ready(function(){ //here the error console displays an error
var plot1 = $.jqplot ('chart1', [[3,7,9,1,4,6,8,2,5]]); //copied from example at http://www.jqplot.com/tests/line-charts.php
}); //$(document).ready
</script>
</head>
<!--<h1><?php echo $this->msg; ?></h1>-->
<body>
<div id="chart1" style="width:600px; height:250px;"> </div>
</body>