没有显示jq图

时间:2013-06-11 10:02:39

标签: javascript jqplot

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>


 <script language="javascript" type="text/javascript" src="http://www.prioritymarketers.com/jqplot/src/jquery.jqplot.js"></script>
<script language="javascript" type="text/javascript" src="http://www.prioritymarketers.com/jqplot/src/plugins/jqplot.barRenderer.js"></script>
<script language="javascript" type="text/javascript" src="http://www.prioritymarketers.com/jqplot/src/plugins/jqplot.categoryAxisRenderer.js"></script>
<script language="javascript" type="text/javascript" src="http://www.prioritymarketers.com/jqplot/src/plugins/jqplot.pointLabels.js"></script>

<link rel="stylesheet" type="text/css" href="http://www.prioritymarketers.com/jqplot/src/jquery.jqplot.css">

<script type="text/javascript">
function drawChart() {

      var s1 = [2, 6, 7];
      var s2 = [7, 5, 3];
      var s3 = [2, 3, 5];
      var s4 = [1, 7, 2];

      // chart data
      var dataArray = [s1, s2, s3, s4];

      // x-axis ticks
      var ticks = ['Jan', 'Feb', 'Mar'];

      // chart rendering options
      var options = {
        seriesDefaults: {
          renderer:$.jqplot.BarRenderer
        },
        axes: {
          xaxis: {
            renderer: $.jqplot.CategoryAxisRenderer,
            ticks: ticks
          }
        }
      };

      // draw the chart
      $.jqplot('chartDivId', dataArray, options);
    }
</script>
</head>
<body onload='drawChart()'>

   <div id="chartDivId" style="margin-top:20px; margin-left:20px; width:400px; height:300px;"></div>

        </tr>
</body>
</html>

这是上述程序成功运行的jsfiddle(http://jsfiddle.net/JWhmQ/2023/)。 但是在eclipse上运行时没有显示任何js图。

即使我包含js文件仍然没有显示任何情节

请给我一些解决方案..

1 个答案:

答案 0 :(得分:1)

在页面中包含Jquery 1.7文件

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script>