Inforian
Inforian

Reputation: 1736

Issues with jqplot piecharts

I am using jqplot for making pie charts , I have used the sample code given in jqplot documentation but I am getting some errors like e.jqplot is undefined , my code is follows :

<script src="js/jquery.js"></script>

<script type="text/javascript" src="js/piechart/jqplot.pieRenderer.min.js"></script>
<script type="text/javascript" src="js/piechart/jqplot.donutRenderer.min.js"></script>

<script>
$(document).ready(function(){
  var data = [
    ['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14],
    ['Out of home', 16],['Commuting', 7], ['Orientation', 9]
  ];
  var plot1 = jQuery.jqplot ('weeklyProjectSummary', [data],
    {
      seriesDefaults: {
        // Make this a pie chart.
        renderer: jQuery.jqplot.PieRenderer,
        rendererOptions: {
          // Put data labels on the pie slices.
          // By default, labels show the percentage of the slice.
          showDataLabels: true
        }
      },
      //legend: { show:true, location: 'e' }
    }
  );
});
</script>


<div id="weeklyProjectSummary"></div>

Can someone suggest me the correct way to create pie charts Thanks !

Upvotes: 0

Views: 1268

Answers (2)

jack
jack

Reputation: 1

maybe you got jquery.jqplot.min.js in jqplot. you must add jquery.jqplot.min.js first before use pieRenderer.min.js

Upvotes: 0

4b0
4b0

Reputation: 22323

add jquery lib first before use jqplot.

<script src="js/jquery.js"></script>
<script type="text/javascript" src="js/YourJqueryPath/jquery-1.9.1.js"></script> //Add js lib

<script type="text/javascript" src="js/piechart/jqplot.pieRenderer.min.js"></script>
<script type="text/javascript" src="js/piechart/jqplot.donutRenderer.min.js"></script>

<script>

Upvotes: 1

Related Questions