当前位置: 代码迷 >> Java Web开发 >> 刚刚接触html和js,求大神帮看下这段demo
  详细解决方案

刚刚接触html和js,求大神帮看下这段demo

热度:3174   发布时间:2016-04-11 00:03:59.0
刚接触html和js,求大神帮看下这段demo
<div class="panel" id="panel-14">
              <header>

                <i class="icon-signal"></i>
                <span>Server load</span>
                
              </header>
              <div class="content">

                <table class="table-key-numbers">
                  <tr>
                    <td>10,962</td>
                    <td>56%</td>
                    <td>129</td>
                  </tr>
                  <tr>
                    <th>Unique Visitors</th>
                    <th>New Visitors</th>
                    <th>New Accounts</th>
                  </tr>
                </table>

                <div id="stats-area-chart" ></div>

              </div>
            </div>


这段代码会显示这样的一个图:


我想要再复制出来一个这样的效果,就把那段代码在下面复制了一遍,但效果图出来是这样的:


调用的js部分代码如下:
jQuery(document).ready(function ($) {

// this should come from the server
var datapoints = [33,34,45,80,60];

function random_datapoints(length, min, max) {
var result = [fix((min + max) / 2 + Math.random() * 10 - 5)];
for (var i = 1; i < length; ++i) {
result[i] = fix(result[i - 1] + Math.random() * 10 - 5);
}
function fix(x) {
if (x < min) return min;
else if (x > max) return max;
else return x;
}
return result;
}

// convert the datapoints in an array of [x, y] pairs
function make_dataseries(datapoints) {
var result = [];
for (var i = 0; i < datapoints.length; ++i)
result.push([i, datapoints[i]]);
return result;
}

// setup plot
var options = {
// series: { shadowSize: 0 },
yaxis: { min: 0, max: 100 },
xaxis: { min: 0, max: 10 },
colors: ["#48e", "#222", "#666", "#BBB"],
series: {
shadowSize: 0,
lines: { 
lineWidth: 2, 
fill: true,
fillColor: { colors: [ { opacity: 0.6 }, { opacity: 0.2 } ] },
steps: false
}
}
};


//$.plot($("#stats-area-chart"), [make_dataseries(random_datapoints(100, 0, 100))], options);
//$.plot($("#stats-area-chart1"), [make_dataseries(datapoints)], options);
$.plot($("#stats-area-chart"), [make_dataseries(datapoints)], options);

});



我复制那段div之后,是没能加载那个js吗?为什么啊?求大神指点。
html js jquery
  相关解决方案