I'm trying to do chart with jqplot. Problem is that it don't create bars with results(only empty area with title and numbers on left axis). I don't know what seems to be the problem, i included needed scripts, code works when i'm trying it on jsfiddle. I don't have any errors. My included scripts and sheets:

<link href="default.css" rel="stylesheet" type="text/css" />
  <script type='text/javascript' src='scripts/script.js'></script>
 <script type='text/javascript' src='scripts/jquery-1.10.2.min.js'></script>
  <script type='text/javascript' src='scripts/jquery-1.9.2.ui.min.js'></script>
   <link rel='stylesheet' type='text/css' href='jquery-ui-1.10.3.custom.min.css'>
 <script type='text/javascript' src='scripts/script-jquery.js'></script>


  <script type='text/javascript' src='scripts/jquery.jqplot.min.js'></script>
<link rel='stylesheet' type='text/css' href='jquery.jqplot.min.css' >

Code:

var line1 = [['Nissan', 4],['Porche', 6],['Acura', 2],['Aston Martin', 5],['Rolls Royce', 6]];

    $('#chart1').jqplot([line1], {
        title:'Default Bar Chartasd',
        seriesDefaults:{
            renderer:$.jqplot.BarRenderer
        },
        axes:{
            xaxis:{
                renderer: $.jqplot.CategoryAxisRenderer
            }
        }
    });
有帮助吗?

解决方案

The BarRenderer and CategoryAxisRenderer come in their own script files and are not included in the main jqplot file. You will need to either bundle those in your script file or include separate script tag references to them, e.g.:

<script type="text/javascript" language="javascript" src="plugins/jqplot.categoryAxisRenderer.js"></script>
<script type="text/javascript" language="javascript" src="plugins/jqplot.barRenderer.js"></script>

Probably it worked on jsfiddle because the sample you used had those files referenced as external resources.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top