new pisilinux web sites
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
$(document).ready(function () {
|
||||
// === Prepare peity charts === //
|
||||
maruti.peity();
|
||||
|
||||
// === Prepare the chart data ===/
|
||||
var sin = [],
|
||||
cos = [];
|
||||
for (var i = 0; i < 14; i += 0.5) {
|
||||
sin.push([i, Math.sin(i)]);
|
||||
cos.push([i, Math.cos(i)]);
|
||||
}
|
||||
|
||||
// === Make chart === //
|
||||
var plot = $.plot(
|
||||
$(".chart"),
|
||||
[
|
||||
{ data: sin, label: "sin(x)", color: "#ee7951" },
|
||||
{ data: cos, label: "cos(x)", color: "#4fb9f0" },
|
||||
],
|
||||
{
|
||||
series: {
|
||||
lines: { show: true },
|
||||
points: { show: true },
|
||||
},
|
||||
grid: { hoverable: true, clickable: true },
|
||||
yaxis: { min: -1.6, max: 1.6 },
|
||||
}
|
||||
);
|
||||
|
||||
// === Point hover in chart === //
|
||||
var previousPoint = null;
|
||||
$(".chart").bind("plothover", function (event, pos, item) {
|
||||
if (item) {
|
||||
if (previousPoint != item.dataIndex) {
|
||||
previousPoint = item.dataIndex;
|
||||
|
||||
$("#tooltip").fadeOut(200, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
var x = item.datapoint[0].toFixed(2),
|
||||
y = item.datapoint[1].toFixed(2);
|
||||
|
||||
maruti.flot_tooltip(
|
||||
item.pageX,
|
||||
item.pageY,
|
||||
item.series.label + " of " + x + " = " + y
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#tooltip").fadeOut(200, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
+1317
File diff suppressed because it is too large
Load Diff
+2737
File diff suppressed because it is too large
Load Diff
+631
@@ -0,0 +1,631 @@
|
||||
(function (b) {
|
||||
function c(D) {
|
||||
var h = null;
|
||||
var L = null;
|
||||
var n = null;
|
||||
var B = null;
|
||||
var p = null;
|
||||
var M = 0;
|
||||
var F = true;
|
||||
var o = 10;
|
||||
var w = 0.95;
|
||||
var A = 0;
|
||||
var d = false;
|
||||
var z = false;
|
||||
var j = [];
|
||||
D.hooks.processOptions.push(g);
|
||||
D.hooks.bindEvents.push(e);
|
||||
|
||||
function g(O, N) {
|
||||
if (N.series.pie.show) {
|
||||
N.grid.show = false;
|
||||
if (N.series.pie.label.show == "auto") {
|
||||
if (N.legend.show) {
|
||||
N.series.pie.label.show = false;
|
||||
} else {
|
||||
N.series.pie.label.show = true;
|
||||
}
|
||||
}
|
||||
if (N.series.pie.radius == "auto") {
|
||||
if (N.series.pie.label.show) {
|
||||
N.series.pie.radius = 3 / 4;
|
||||
} else {
|
||||
N.series.pie.radius = 1;
|
||||
}
|
||||
}
|
||||
if (N.series.pie.tilt > 1) {
|
||||
N.series.pie.tilt = 1;
|
||||
}
|
||||
if (N.series.pie.tilt < 0) {
|
||||
N.series.pie.tilt = 0;
|
||||
}
|
||||
O.hooks.processDatapoints.push(E);
|
||||
O.hooks.drawOverlay.push(H);
|
||||
O.hooks.draw.push(r);
|
||||
}
|
||||
}
|
||||
|
||||
function e(P, N) {
|
||||
var O = P.getOptions();
|
||||
if (O.series.pie.show && O.grid.hoverable) {
|
||||
N.unbind("mousemove").mousemove(t);
|
||||
}
|
||||
if (O.series.pie.show && O.grid.clickable) {
|
||||
N.unbind("click").click(l);
|
||||
}
|
||||
}
|
||||
|
||||
function G(O) {
|
||||
var P = "";
|
||||
|
||||
function N(S, T) {
|
||||
if (!T) {
|
||||
T = 0;
|
||||
}
|
||||
for (var R = 0; R < S.length; ++R) {
|
||||
for (var Q = 0; Q < T; Q++) {
|
||||
P += "\t";
|
||||
}
|
||||
if (typeof S[R] == "object") {
|
||||
P += "" + R + ":\n";
|
||||
N(S[R], T + 1);
|
||||
} else {
|
||||
P += "" + R + ": " + S[R] + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
N(O);
|
||||
alert(P);
|
||||
}
|
||||
|
||||
function q(P) {
|
||||
for (var N = 0; N < P.length; ++N) {
|
||||
var O = parseFloat(P[N].data[0][1]);
|
||||
if (O) {
|
||||
M += O;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function E(Q, N, O, P) {
|
||||
if (!d) {
|
||||
d = true;
|
||||
h = Q.getCanvas();
|
||||
L = b(h).parent();
|
||||
a = Q.getOptions();
|
||||
Q.setData(K(Q.getData()));
|
||||
}
|
||||
}
|
||||
|
||||
function I() {
|
||||
A = L.children().filter(".legend").children().width();
|
||||
n = Math.min(h.width, h.height / a.series.pie.tilt) / 2;
|
||||
p = h.height / 2 + a.series.pie.offset.top;
|
||||
B = h.width / 2;
|
||||
if (a.series.pie.offset.left == "auto") {
|
||||
if (a.legend.position.match("w")) {
|
||||
B += A / 2;
|
||||
} else {
|
||||
B -= A / 2;
|
||||
}
|
||||
} else {
|
||||
B += a.series.pie.offset.left;
|
||||
}
|
||||
if (B < n) {
|
||||
B = n;
|
||||
} else {
|
||||
if (B > h.width - n) {
|
||||
B = h.width - n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function v(O) {
|
||||
for (var N = 0; N < O.length; ++N) {
|
||||
if (typeof O[N].data == "number") {
|
||||
O[N].data = [[1, O[N].data]];
|
||||
} else {
|
||||
if (
|
||||
typeof O[N].data == "undefined" ||
|
||||
typeof O[N].data[0] == "undefined"
|
||||
) {
|
||||
if (
|
||||
typeof O[N].data != "undefined" &&
|
||||
typeof O[N].data.label != "undefined"
|
||||
) {
|
||||
O[N].label = O[N].data.label;
|
||||
}
|
||||
O[N].data = [[1, 0]];
|
||||
}
|
||||
}
|
||||
}
|
||||
return O;
|
||||
}
|
||||
|
||||
function K(Q) {
|
||||
Q = v(Q);
|
||||
q(Q);
|
||||
var P = 0;
|
||||
var S = 0;
|
||||
var N = a.series.pie.combine.color;
|
||||
var R = [];
|
||||
for (var O = 0; O < Q.length; ++O) {
|
||||
Q[O].data[0][1] = parseFloat(Q[O].data[0][1]);
|
||||
if (!Q[O].data[0][1]) {
|
||||
Q[O].data[0][1] = 0;
|
||||
}
|
||||
if (Q[O].data[0][1] / M <= a.series.pie.combine.threshold) {
|
||||
P += Q[O].data[0][1];
|
||||
S++;
|
||||
if (!N) {
|
||||
N = Q[O].color;
|
||||
}
|
||||
} else {
|
||||
R.push({
|
||||
data: [[1, Q[O].data[0][1]]],
|
||||
color: Q[O].color,
|
||||
label: Q[O].label,
|
||||
angle: (Q[O].data[0][1] * (Math.PI * 2)) / M,
|
||||
percent: (Q[O].data[0][1] / M) * 100,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (S > 0) {
|
||||
R.push({
|
||||
data: [[1, P]],
|
||||
color: N,
|
||||
label: a.series.pie.combine.label,
|
||||
angle: (P * (Math.PI * 2)) / M,
|
||||
percent: (P / M) * 100,
|
||||
});
|
||||
}
|
||||
return R;
|
||||
}
|
||||
|
||||
function r(S, Q) {
|
||||
if (!L) {
|
||||
return;
|
||||
}
|
||||
ctx = Q;
|
||||
I();
|
||||
var T = S.getData();
|
||||
var P = 0;
|
||||
while (F && P < o) {
|
||||
F = false;
|
||||
if (P > 0) {
|
||||
n *= w;
|
||||
}
|
||||
P += 1;
|
||||
N();
|
||||
if (a.series.pie.tilt <= 0.8) {
|
||||
O();
|
||||
}
|
||||
R();
|
||||
}
|
||||
if (P >= o) {
|
||||
N();
|
||||
L.prepend(
|
||||
'<div class="error">Could not draw pie with labels contained inside canvas</div>'
|
||||
);
|
||||
}
|
||||
if (S.setSeries && S.insertLegend) {
|
||||
S.setSeries(T);
|
||||
S.insertLegend();
|
||||
}
|
||||
|
||||
function N() {
|
||||
ctx.clearRect(0, 0, h.width, h.height);
|
||||
L.children().filter(".pieLabel, .pieLabelBackground").remove();
|
||||
}
|
||||
|
||||
function O() {
|
||||
var Z = 5;
|
||||
var Y = 15;
|
||||
var W = 10;
|
||||
var X = 0.02;
|
||||
if (a.series.pie.radius > 1) {
|
||||
var U = a.series.pie.radius;
|
||||
} else {
|
||||
var U = n * a.series.pie.radius;
|
||||
}
|
||||
if (
|
||||
U >= h.width / 2 - Z ||
|
||||
U * a.series.pie.tilt >= h.height / 2 - Y ||
|
||||
U <= W
|
||||
) {
|
||||
return;
|
||||
}
|
||||
ctx.save();
|
||||
ctx.translate(Z, Y);
|
||||
ctx.globalAlpha = X;
|
||||
ctx.fillStyle = "#000";
|
||||
ctx.translate(B, p);
|
||||
ctx.scale(1, a.series.pie.tilt);
|
||||
for (var V = 1; V <= W; V++) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, U, 0, Math.PI * 2, false);
|
||||
ctx.fill();
|
||||
U -= V;
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function R() {
|
||||
startAngle = Math.PI * a.series.pie.startAngle;
|
||||
if (a.series.pie.radius > 1) {
|
||||
var U = a.series.pie.radius;
|
||||
} else {
|
||||
var U = n * a.series.pie.radius;
|
||||
}
|
||||
ctx.save();
|
||||
ctx.translate(B, p);
|
||||
ctx.scale(1, a.series.pie.tilt);
|
||||
ctx.save();
|
||||
var Y = startAngle;
|
||||
for (var W = 0; W < T.length; ++W) {
|
||||
T[W].startAngle = Y;
|
||||
X(T[W].angle, T[W].color, true);
|
||||
}
|
||||
ctx.restore();
|
||||
ctx.save();
|
||||
ctx.lineWidth = a.series.pie.stroke.width;
|
||||
Y = startAngle;
|
||||
for (var W = 0; W < T.length; ++W) {
|
||||
X(T[W].angle, a.series.pie.stroke.color, false);
|
||||
}
|
||||
ctx.restore();
|
||||
J(ctx);
|
||||
if (a.series.pie.label.show) {
|
||||
V();
|
||||
}
|
||||
ctx.restore();
|
||||
|
||||
function X(ab, Z, aa) {
|
||||
if (ab <= 0) {
|
||||
return;
|
||||
}
|
||||
if (aa) {
|
||||
ctx.fillStyle = Z;
|
||||
} else {
|
||||
ctx.strokeStyle = Z;
|
||||
ctx.lineJoin = "round";
|
||||
}
|
||||
ctx.beginPath();
|
||||
if (Math.abs(ab - Math.PI * 2) > 1e-9) {
|
||||
ctx.moveTo(0, 0);
|
||||
} else {
|
||||
if (b.browser.msie) {
|
||||
ab -= 0.0001;
|
||||
}
|
||||
}
|
||||
ctx.arc(0, 0, U, Y, Y + ab, false);
|
||||
ctx.closePath();
|
||||
Y += ab;
|
||||
if (aa) {
|
||||
ctx.fill();
|
||||
} else {
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
function V() {
|
||||
var ac = startAngle;
|
||||
if (a.series.pie.label.radius > 1) {
|
||||
var Z = a.series.pie.label.radius;
|
||||
} else {
|
||||
var Z = n * a.series.pie.label.radius;
|
||||
}
|
||||
for (var ab = 0; ab < T.length; ++ab) {
|
||||
if (T[ab].percent >= a.series.pie.label.threshold * 100) {
|
||||
aa(T[ab], ac, ab);
|
||||
}
|
||||
ac += T[ab].angle;
|
||||
}
|
||||
|
||||
function aa(ap, ai, ag) {
|
||||
if (ap.data[0][1] == 0) {
|
||||
return;
|
||||
}
|
||||
var ar = a.legend.labelFormatter,
|
||||
aq,
|
||||
ae = a.series.pie.label.formatter;
|
||||
if (ar) {
|
||||
aq = ar(ap.label, ap);
|
||||
} else {
|
||||
aq = ap.label;
|
||||
}
|
||||
if (ae) {
|
||||
aq = ae(aq, ap);
|
||||
}
|
||||
var aj = (ai + ap.angle + ai) / 2;
|
||||
var ao = B + Math.round(Math.cos(aj) * Z);
|
||||
var am = p + Math.round(Math.sin(aj) * Z) * a.series.pie.tilt;
|
||||
var af =
|
||||
'<span class="pieLabel" id="pieLabel' +
|
||||
ag +
|
||||
'" style="position:absolute;top:' +
|
||||
am +
|
||||
"px;left:" +
|
||||
ao +
|
||||
'px;">' +
|
||||
aq +
|
||||
"</span>";
|
||||
L.append(af);
|
||||
var an = L.children("#pieLabel" + ag);
|
||||
var ad = am - an.height() / 2;
|
||||
var ah = ao - an.width() / 2;
|
||||
an.css("top", ad);
|
||||
an.css("left", ah);
|
||||
if (
|
||||
0 - ad > 0 ||
|
||||
0 - ah > 0 ||
|
||||
h.height - (ad + an.height()) < 0 ||
|
||||
h.width - (ah + an.width()) < 0
|
||||
) {
|
||||
F = true;
|
||||
}
|
||||
if (a.series.pie.label.background.opacity != 0) {
|
||||
var ak = a.series.pie.label.background.color;
|
||||
if (ak == null) {
|
||||
ak = ap.color;
|
||||
}
|
||||
var al = "top:" + ad + "px;left:" + ah + "px;";
|
||||
b(
|
||||
'<div class="pieLabelBackground" style="position:absolute;width:' +
|
||||
an.width() +
|
||||
"px;height:" +
|
||||
an.height() +
|
||||
"px;" +
|
||||
al +
|
||||
"background-color:" +
|
||||
ak +
|
||||
';"> </div>'
|
||||
)
|
||||
.insertBefore(an)
|
||||
.css("opacity", a.series.pie.label.background.opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function J(N) {
|
||||
if (a.series.pie.innerRadius > 0) {
|
||||
N.save();
|
||||
innerRadius =
|
||||
a.series.pie.innerRadius > 1
|
||||
? a.series.pie.innerRadius
|
||||
: n * a.series.pie.innerRadius;
|
||||
N.globalCompositeOperation = "destination-out";
|
||||
N.beginPath();
|
||||
N.fillStyle = a.series.pie.stroke.color;
|
||||
N.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
||||
N.fill();
|
||||
N.closePath();
|
||||
N.restore();
|
||||
N.save();
|
||||
N.beginPath();
|
||||
N.strokeStyle = a.series.pie.stroke.color;
|
||||
N.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
||||
N.stroke();
|
||||
N.closePath();
|
||||
N.restore();
|
||||
}
|
||||
}
|
||||
|
||||
function s(Q, R) {
|
||||
for (var S = false, P = -1, N = Q.length, O = N - 1; ++P < N; O = P) {
|
||||
((Q[P][1] <= R[1] && R[1] < Q[O][1]) ||
|
||||
(Q[O][1] <= R[1] && R[1] < Q[P][1])) &&
|
||||
R[0] <
|
||||
((Q[O][0] - Q[P][0]) * (R[1] - Q[P][1])) / (Q[O][1] - Q[P][1]) +
|
||||
Q[P][0] &&
|
||||
(S = !S);
|
||||
}
|
||||
return S;
|
||||
}
|
||||
|
||||
function u(R, P) {
|
||||
var T = D.getData(),
|
||||
O = D.getOptions(),
|
||||
N =
|
||||
O.series.pie.radius > 1
|
||||
? O.series.pie.radius
|
||||
: n * O.series.pie.radius;
|
||||
for (var Q = 0; Q < T.length; ++Q) {
|
||||
var S = T[Q];
|
||||
if (S.pie.show) {
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, 0);
|
||||
ctx.arc(0, 0, N, S.startAngle, S.startAngle + S.angle, false);
|
||||
ctx.closePath();
|
||||
x = R - B;
|
||||
y = P - p;
|
||||
if (ctx.isPointInPath) {
|
||||
if (ctx.isPointInPath(R - B, P - p)) {
|
||||
ctx.restore();
|
||||
return {
|
||||
datapoint: [S.percent, S.data],
|
||||
dataIndex: 0,
|
||||
series: S,
|
||||
seriesIndex: Q,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
p1X = N * Math.cos(S.startAngle);
|
||||
p1Y = N * Math.sin(S.startAngle);
|
||||
p2X = N * Math.cos(S.startAngle + S.angle / 4);
|
||||
p2Y = N * Math.sin(S.startAngle + S.angle / 4);
|
||||
p3X = N * Math.cos(S.startAngle + S.angle / 2);
|
||||
p3Y = N * Math.sin(S.startAngle + S.angle / 2);
|
||||
p4X = N * Math.cos(S.startAngle + S.angle / 1.5);
|
||||
p4Y = N * Math.sin(S.startAngle + S.angle / 1.5);
|
||||
p5X = N * Math.cos(S.startAngle + S.angle);
|
||||
p5Y = N * Math.sin(S.startAngle + S.angle);
|
||||
arrPoly = [
|
||||
[0, 0],
|
||||
[p1X, p1Y],
|
||||
[p2X, p2Y],
|
||||
[p3X, p3Y],
|
||||
[p4X, p4Y],
|
||||
[p5X, p5Y],
|
||||
];
|
||||
arrPoint = [x, y];
|
||||
if (s(arrPoly, arrPoint)) {
|
||||
ctx.restore();
|
||||
return {
|
||||
datapoint: [S.percent, S.data],
|
||||
dataIndex: 0,
|
||||
series: S,
|
||||
seriesIndex: Q,
|
||||
};
|
||||
}
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function t(N) {
|
||||
m("plothover", N);
|
||||
}
|
||||
|
||||
function l(N) {
|
||||
m("plotclick", N);
|
||||
}
|
||||
|
||||
function m(N, T) {
|
||||
var O = D.offset(),
|
||||
R = parseInt(T.pageX - O.left),
|
||||
P = parseInt(T.pageY - O.top),
|
||||
V = u(R, P);
|
||||
if (a.grid.autoHighlight) {
|
||||
for (var Q = 0; Q < j.length; ++Q) {
|
||||
var S = j[Q];
|
||||
if (S.auto == N && !(V && S.series == V.series)) {
|
||||
f(S.series);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (V) {
|
||||
k(V.series, N);
|
||||
}
|
||||
var U = { pageX: T.pageX, pageY: T.pageY };
|
||||
L.trigger(N, [U, V]);
|
||||
}
|
||||
|
||||
function k(O, P) {
|
||||
if (typeof O == "number") {
|
||||
O = series[O];
|
||||
}
|
||||
var N = C(O);
|
||||
if (N == -1) {
|
||||
j.push({ series: O, auto: P });
|
||||
D.triggerRedrawOverlay();
|
||||
} else {
|
||||
if (!P) {
|
||||
j[N].auto = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function f(O) {
|
||||
if (O == null) {
|
||||
j = [];
|
||||
D.triggerRedrawOverlay();
|
||||
}
|
||||
if (typeof O == "number") {
|
||||
O = series[O];
|
||||
}
|
||||
var N = C(O);
|
||||
if (N != -1) {
|
||||
j.splice(N, 1);
|
||||
D.triggerRedrawOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
function C(P) {
|
||||
for (var N = 0; N < j.length; ++N) {
|
||||
var O = j[N];
|
||||
if (O.series == P) {
|
||||
return N;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function H(Q, R) {
|
||||
var P = Q.getOptions();
|
||||
var N =
|
||||
P.series.pie.radius > 1 ? P.series.pie.radius : n * P.series.pie.radius;
|
||||
R.save();
|
||||
R.translate(B, p);
|
||||
R.scale(1, P.series.pie.tilt);
|
||||
for (i = 0; i < j.length; ++i) {
|
||||
O(j[i].series);
|
||||
}
|
||||
J(R);
|
||||
R.restore();
|
||||
|
||||
function O(S) {
|
||||
if (S.angle < 0) {
|
||||
return;
|
||||
}
|
||||
R.fillStyle =
|
||||
"rgba(255, 255, 255, " + P.series.pie.highlight.opacity + ")";
|
||||
R.beginPath();
|
||||
if (Math.abs(S.angle - Math.PI * 2) > 1e-9) {
|
||||
R.moveTo(0, 0);
|
||||
}
|
||||
R.arc(0, 0, N, S.startAngle, S.startAngle + S.angle, false);
|
||||
R.closePath();
|
||||
R.fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
var a = {
|
||||
series: {
|
||||
pie: {
|
||||
show: false,
|
||||
radius: "auto",
|
||||
innerRadius: 0,
|
||||
startAngle: 3 / 2,
|
||||
tilt: 1,
|
||||
offset: { top: 0, left: "auto" },
|
||||
stroke: { color: "#FFF", width: 1 },
|
||||
label: {
|
||||
show: "auto",
|
||||
formatter: function (d, e) {
|
||||
return (
|
||||
'<div style="font-size:x-small;text-align:center;padding:2px;color:' +
|
||||
e.color +
|
||||
';">' +
|
||||
d +
|
||||
"<br/>" +
|
||||
Math.round(e.percent) +
|
||||
"%</div>"
|
||||
);
|
||||
},
|
||||
radius: 1,
|
||||
background: { color: null, opacity: 0 },
|
||||
threshold: 0,
|
||||
},
|
||||
combine: { threshold: -1, color: null, label: "Other" },
|
||||
highlight: { opacity: 0.5 },
|
||||
},
|
||||
},
|
||||
};
|
||||
b.plot.plugins.push({ init: c, options: a, name: "pie", version: "1.0" });
|
||||
})(jQuery);
|
||||
|
||||
jQuery.browser = {};
|
||||
(function () {
|
||||
jQuery.browser.msie = false;
|
||||
jQuery.browser.version = 0;
|
||||
if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
|
||||
jQuery.browser.msie = true;
|
||||
jQuery.browser.version = RegExp.$1;
|
||||
}
|
||||
})();
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
(function (n, p, u) {
|
||||
var w = n([]),
|
||||
s = (n.resize = n.extend(n.resize, {})),
|
||||
o,
|
||||
l = "setTimeout",
|
||||
m = "resize",
|
||||
t = m + "-special-event",
|
||||
v = "delay",
|
||||
r = "throttleWindow";
|
||||
s[v] = 250;
|
||||
s[r] = true;
|
||||
n.event.special[m] = {
|
||||
setup: function () {
|
||||
if (!s[r] && this[l]) {
|
||||
return false;
|
||||
}
|
||||
var a = n(this);
|
||||
w = w.add(a);
|
||||
n.data(this, t, { w: a.width(), h: a.height() });
|
||||
if (w.length === 1) {
|
||||
q();
|
||||
}
|
||||
},
|
||||
teardown: function () {
|
||||
if (!s[r] && this[l]) {
|
||||
return false;
|
||||
}
|
||||
var a = n(this);
|
||||
w = w.not(a);
|
||||
a.removeData(t);
|
||||
if (!w.length) {
|
||||
clearTimeout(o);
|
||||
}
|
||||
},
|
||||
add: function (b) {
|
||||
if (!s[r] && this[l]) {
|
||||
return false;
|
||||
}
|
||||
var c;
|
||||
|
||||
function a(d, h, g) {
|
||||
var f = n(this),
|
||||
e = n.data(this, t);
|
||||
e.w = h !== u ? h : f.width();
|
||||
e.h = g !== u ? g : f.height();
|
||||
c.apply(this, arguments);
|
||||
}
|
||||
if (n.isFunction(b)) {
|
||||
c = b;
|
||||
return a;
|
||||
} else {
|
||||
c = b.handler;
|
||||
b.handler = a;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function q() {
|
||||
o = p[l](function () {
|
||||
w.each(function () {
|
||||
var d = n(this),
|
||||
a = d.width(),
|
||||
b = d.height(),
|
||||
c = n.data(this, t);
|
||||
if (a !== c.w || b !== c.h) {
|
||||
d.trigger(m, [(c.w = a), (c.h = b)]);
|
||||
}
|
||||
});
|
||||
q();
|
||||
}, s[v]);
|
||||
}
|
||||
})(jQuery, this);
|
||||
(function (b) {
|
||||
var a = {};
|
||||
|
||||
function c(f) {
|
||||
function e() {
|
||||
var h = f.getPlaceholder();
|
||||
if (h.width() == 0 || h.height() == 0) {
|
||||
return;
|
||||
}
|
||||
f.resize();
|
||||
f.setupGrid();
|
||||
f.draw();
|
||||
}
|
||||
|
||||
function g(i, h) {
|
||||
i.getPlaceholder().resize(e);
|
||||
}
|
||||
|
||||
function d(i, h) {
|
||||
i.getPlaceholder().unbind("resize", e);
|
||||
}
|
||||
f.hooks.bindEvents.push(g);
|
||||
f.hooks.shutdown.push(d);
|
||||
}
|
||||
b.plot.plugins.push({ init: c, options: a, name: "resize", version: "1.0" });
|
||||
})(jQuery);
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
// Peity jQuery plugin version 0.6.0
|
||||
// (c) 2011 Ben Pickles
|
||||
//
|
||||
// http://benpickles.github.com/peity/
|
||||
//
|
||||
// Released under MIT license.
|
||||
(function (i, k) {
|
||||
function o(a, h) {
|
||||
var b = k.createElement("canvas");
|
||||
b.setAttribute("width", a * m);
|
||||
b.setAttribute("height", h * m);
|
||||
m != 1 && b.setAttribute("style", "width:" + a + "px;height:" + h + "px");
|
||||
return b;
|
||||
}
|
||||
var g = (i.fn.peity = function (a, h) {
|
||||
k.createElement("canvas").getContext &&
|
||||
this.each(function () {
|
||||
i(this)
|
||||
.change(function () {
|
||||
var b = i.extend({}, h),
|
||||
d = this;
|
||||
i.each(b, function (a, c) {
|
||||
i.isFunction(c) && (b[a] = c.call(d));
|
||||
});
|
||||
var f = i(this).html();
|
||||
g.graphers[a].call(this, i.extend({}, g.defaults[a], b));
|
||||
i(this).trigger("chart:changed", f);
|
||||
})
|
||||
.trigger("change");
|
||||
});
|
||||
return this;
|
||||
});
|
||||
g.graphers = {};
|
||||
g.defaults = {};
|
||||
g.add = function (a, h, b) {
|
||||
g.graphers[a] = b;
|
||||
g.defaults[a] = h;
|
||||
};
|
||||
var m = window.devicePixelRatio || 1;
|
||||
g.add(
|
||||
"pie",
|
||||
{ colours: ["#e9b104", "#FF9900"], delimeter: "/", diameter: 16 },
|
||||
function (a) {
|
||||
var h = i(this),
|
||||
b = h.text().split(a.delimeter),
|
||||
d = parseFloat(b[0]),
|
||||
f = parseFloat(b[1]),
|
||||
b = -Math.PI / 2,
|
||||
d = (d / f) * Math.PI * 2,
|
||||
f = o(a.diameter, a.diameter),
|
||||
e = f.getContext("2d"),
|
||||
c = f.width / 2;
|
||||
e.beginPath();
|
||||
e.moveTo(c, c);
|
||||
e.arc(c, c, c, d + b, d == 0 ? Math.PI * 2 : b, !1);
|
||||
e.fillStyle = a.colours[0];
|
||||
e.fill();
|
||||
e.beginPath();
|
||||
e.moveTo(c, c);
|
||||
e.arc(c, c, c, b, d + b, !1);
|
||||
e.fillStyle = a.colours[1];
|
||||
e.fill();
|
||||
h.wrapInner(i("<span>").hide()).append(f);
|
||||
}
|
||||
);
|
||||
g.add(
|
||||
"line",
|
||||
{
|
||||
colour: "#c6d9fd",
|
||||
strokeColour: "#4d89f9",
|
||||
strokeWidth: 1,
|
||||
delimeter: ",",
|
||||
height: 16,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 32,
|
||||
},
|
||||
function (a) {
|
||||
var h = i(this),
|
||||
b = o(a.width, a.height),
|
||||
d = h.text().split(a.delimeter);
|
||||
d.length == 1 && d.push(d[0]);
|
||||
var f = Math.max.apply(Math, d.concat([a.max])),
|
||||
e = Math.min.apply(Math, d.concat([a.min])),
|
||||
c = b.getContext("2d"),
|
||||
g = b.width,
|
||||
l = b.height,
|
||||
q = g / (d.length - 1),
|
||||
f = l / (f - e),
|
||||
n = [],
|
||||
j;
|
||||
c.beginPath();
|
||||
c.moveTo(0, l + e * f);
|
||||
for (j = 0; j < d.length; j++) {
|
||||
var k = j * q,
|
||||
p = l - f * (d[j] - e);
|
||||
n.push({ x: k, y: p });
|
||||
c.lineTo(k, p);
|
||||
}
|
||||
c.lineTo(g, l + e * f);
|
||||
c.fillStyle = a.colour;
|
||||
c.fill();
|
||||
if (a.strokeWidth) {
|
||||
c.beginPath();
|
||||
c.moveTo(0, n[0].y);
|
||||
for (j = 0; j < n.length; j++) c.lineTo(n[j].x, n[j].y);
|
||||
c.lineWidth = a.strokeWidth * m;
|
||||
c.strokeStyle = a.strokeColour;
|
||||
c.stroke();
|
||||
}
|
||||
h.wrapInner(i("<span>").hide()).append(b);
|
||||
}
|
||||
);
|
||||
g.add(
|
||||
"bar",
|
||||
{
|
||||
colour: "#4D89F9",
|
||||
delimeter: ",",
|
||||
height: 16,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 32,
|
||||
},
|
||||
function (a) {
|
||||
var h = i(this),
|
||||
b = h.text().split(a.delimeter),
|
||||
d = Math.max.apply(Math, b.concat([a.max])),
|
||||
f = Math.min.apply(Math, b.concat([a.min])),
|
||||
e = o(a.width, a.height),
|
||||
c = e.getContext("2d"),
|
||||
g = e.height,
|
||||
d = g / (d - f),
|
||||
l = m / 2,
|
||||
k = (e.width + l) / b.length;
|
||||
c.fillStyle = a.colour;
|
||||
for (a = 0; a < b.length; a++)
|
||||
c.fillRect(a * k, g - d * (b[a] - f), k - l, d * b[a]);
|
||||
h.wrapInner(i("<span>").hide()).append(e);
|
||||
}
|
||||
);
|
||||
})(jQuery, document);
|
||||
+7307
File diff suppressed because it is too large
Load Diff
+130
@@ -0,0 +1,130 @@
|
||||
$(function () {
|
||||
// === Prepare the chart data ===/
|
||||
var sin = [],
|
||||
cos = [];
|
||||
for (var i = 0; i < 14; i += 0.5) {
|
||||
sin.push([i, Math.sin(i)]);
|
||||
cos.push([i, Math.cos(i)]);
|
||||
}
|
||||
// === Prepare the chart data ===/
|
||||
var sin = [],
|
||||
cos = [];
|
||||
for (var i = 0; i < 14; i += 0.5) {
|
||||
sin.push([i, Math.sin(i)]);
|
||||
cos.push([i, Math.cos(i)]);
|
||||
}
|
||||
|
||||
// === Make chart === //
|
||||
var plot = $.plot(
|
||||
$(".chart"),
|
||||
[
|
||||
{ data: sin, label: "sin(x)", color: "#ee7951" },
|
||||
{ data: cos, label: "cos(x)", color: "#4fb9f0" },
|
||||
],
|
||||
{
|
||||
series: {
|
||||
lines: { show: true },
|
||||
points: { show: true },
|
||||
},
|
||||
grid: { hoverable: true, clickable: true },
|
||||
yaxis: { min: -1.6, max: 1.6 },
|
||||
}
|
||||
);
|
||||
|
||||
// === Point hover in chart === //
|
||||
var previousPoint = null;
|
||||
$(".chart").bind("plothover", function (event, pos, item) {
|
||||
if (item) {
|
||||
if (previousPoint != item.dataIndex) {
|
||||
previousPoint = item.dataIndex;
|
||||
|
||||
$("#tooltip").fadeOut(200, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
var x = item.datapoint[0].toFixed(2),
|
||||
y = item.datapoint[1].toFixed(2);
|
||||
|
||||
maruti.flot_tooltip(
|
||||
item.pageX,
|
||||
item.pageY,
|
||||
item.series.label + " of " + x + " = " + y
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#tooltip").fadeOut(200, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
|
||||
var data = [];
|
||||
var series = Math.floor(Math.random() * 10) + 1;
|
||||
for (var i = 0; i < series; i++) {
|
||||
data[i] = {
|
||||
label: "Series" + (i + 1),
|
||||
data: Math.floor(Math.random() * 100) + 1,
|
||||
};
|
||||
}
|
||||
|
||||
var pie = $.plot($(".pie"), data, {
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 3 / 4,
|
||||
label: {
|
||||
show: true,
|
||||
radius: 3 / 4,
|
||||
formatter: function (label, series) {
|
||||
return (
|
||||
'<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' +
|
||||
label +
|
||||
"<br/>" +
|
||||
Math.round(series.percent) +
|
||||
"%</div>"
|
||||
);
|
||||
},
|
||||
background: {
|
||||
opacity: 0.5,
|
||||
color: "#000",
|
||||
},
|
||||
},
|
||||
innerRadius: 0.2,
|
||||
},
|
||||
legend: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
var d1 = [];
|
||||
for (var i = 0; i <= 10; i += 1) d1.push([i, parseInt(Math.random() * 30)]);
|
||||
|
||||
var data = new Array();
|
||||
data.push({
|
||||
data: d1,
|
||||
bars: {
|
||||
show: true,
|
||||
barWidth: 0.4,
|
||||
order: 1,
|
||||
},
|
||||
});
|
||||
|
||||
//Display graph
|
||||
var bar = $.plot($(".bars"), data, {
|
||||
legend: true,
|
||||
color: "#2b2b2b",
|
||||
});
|
||||
});
|
||||
|
||||
maruti = {
|
||||
// === Tooltip for flot charts === //
|
||||
flot_tooltip: function (x, y, contents) {
|
||||
$('<div id="tooltip">' + contents + "</div>")
|
||||
.css({
|
||||
top: y + 5,
|
||||
left: x + 5,
|
||||
})
|
||||
.appendTo("body")
|
||||
.fadeIn(200);
|
||||
},
|
||||
};
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
$(document).ready(function () {
|
||||
// === Prepare peity charts === //
|
||||
maruti.peity();
|
||||
|
||||
// === Prepare the chart data ===/
|
||||
var sin = [],
|
||||
cos = [];
|
||||
for (var i = 0; i < 14; i += 0.5) {
|
||||
sin.push([i, Math.sin(i)]);
|
||||
cos.push([i, Math.cos(i)]);
|
||||
}
|
||||
|
||||
// === Make chart === //
|
||||
var plot = $.plot(
|
||||
$(".chart"),
|
||||
[
|
||||
{ data: sin, label: "sin(x)", color: "#ee7951" },
|
||||
{ data: cos, label: "cos(x)", color: "#4fb9f0" },
|
||||
],
|
||||
{
|
||||
series: {
|
||||
lines: { show: true },
|
||||
points: { show: true },
|
||||
},
|
||||
grid: { hoverable: true, clickable: true },
|
||||
yaxis: { min: -1.6, max: 1.6 },
|
||||
}
|
||||
);
|
||||
|
||||
// === Point hover in chart === //
|
||||
var previousPoint = null;
|
||||
$(".chart").bind("plothover", function (event, pos, item) {
|
||||
if (item) {
|
||||
if (previousPoint != item.dataIndex) {
|
||||
previousPoint = item.dataIndex;
|
||||
|
||||
$("#tooltip").fadeOut(200, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
var x = item.datapoint[0].toFixed(2),
|
||||
y = item.datapoint[1].toFixed(2);
|
||||
|
||||
maruti.flot_tooltip(
|
||||
item.pageX,
|
||||
item.pageY,
|
||||
item.series.label + " of " + x + " = " + y
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#tooltip").fadeOut(200, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
|
||||
/*// === Calendar === //
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
|
||||
$('.calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next',
|
||||
center: 'title',
|
||||
right: 'month,basicWeek,basicDay'
|
||||
},
|
||||
editable: true,
|
||||
events: [
|
||||
{
|
||||
title: 'All day event',
|
||||
start: new Date(y, m, 1)
|
||||
},
|
||||
{
|
||||
title: 'Long event',
|
||||
start: new Date(y, m, 5),
|
||||
end: new Date(y, m, 8)
|
||||
},
|
||||
{
|
||||
id: 999,
|
||||
title: 'Repeating event',
|
||||
start: new Date(y, m, 2, 16, 0),
|
||||
end: new Date(y, m, 3, 18, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
id: 999,
|
||||
title: 'Repeating event',
|
||||
start: new Date(y, m, 9, 16, 0),
|
||||
end: new Date(y, m, 10, 18, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Lunch',
|
||||
start: new Date(y, m, 14, 12, 0),
|
||||
end: new Date(y, m, 15, 14, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Birthday PARTY',
|
||||
start: new Date(y, m, 18),
|
||||
end: new Date(y, m, 20),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Click for Google',
|
||||
start: new Date(y, m, 27),
|
||||
end: new Date(y, m, 29),
|
||||
url: 'http://www.google.com'
|
||||
}
|
||||
]
|
||||
});*/
|
||||
});
|
||||
|
||||
maruti = {
|
||||
// === Peity charts === //
|
||||
peity: function () {
|
||||
$.fn.peity.defaults.line = {
|
||||
strokeWidth: 1,
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50,
|
||||
};
|
||||
$.fn.peity.defaults.bar = {
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50,
|
||||
};
|
||||
$(".peity_line_good span").peity("line", {
|
||||
colour: "#57a532",
|
||||
strokeColour: "#459D1C",
|
||||
});
|
||||
$(".peity_line_bad span").peity("line", {
|
||||
colour: "#FFC4C7",
|
||||
strokeColour: "#BA1E20",
|
||||
});
|
||||
$(".peity_line_neutral span").peity("line", {
|
||||
colour: "#CCCCCC",
|
||||
strokeColour: "#757575",
|
||||
});
|
||||
$(".peity_bar_good span").peity("bar", {
|
||||
colour: "#459D1C",
|
||||
});
|
||||
$(".peity_bar_bad span").peity("bar", {
|
||||
colour: "#BA1E20",
|
||||
});
|
||||
$(".peity_bar_neutral span").peity("bar", {
|
||||
colour: "#4fb9f0",
|
||||
});
|
||||
},
|
||||
|
||||
// === Tooltip for flot charts === //
|
||||
flot_tooltip: function (x, y, contents) {
|
||||
$('<div id="tooltip">' + contents + "</div>")
|
||||
.css({
|
||||
top: y + 5,
|
||||
left: x + 5,
|
||||
})
|
||||
.appendTo("body")
|
||||
.fadeIn(200);
|
||||
},
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
$(document).ready(function () {
|
||||
// === jQuery Peity === //
|
||||
$.fn.peity.defaults.line = {
|
||||
strokeWidth: 1,
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50,
|
||||
};
|
||||
$.fn.peity.defaults.bar = {
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50,
|
||||
};
|
||||
$(".peity_line_good span").peity("line", {
|
||||
colour: "#488c13",
|
||||
strokeColour: "#459D1C",
|
||||
});
|
||||
$(".peity_line_bad span").peity("line", {
|
||||
colour: "#da4b0f",
|
||||
strokeColour: "#BA1E20",
|
||||
});
|
||||
$(".peity_line_neutral span").peity("line", {
|
||||
colour: "#CCCCCC",
|
||||
strokeColour: "#757575",
|
||||
});
|
||||
$(".peity_bar_good span").peity("bar", {
|
||||
colour: "#459D1C",
|
||||
});
|
||||
$(".peity_bar_bad span").peity("bar", {
|
||||
colour: "#BA1E20",
|
||||
});
|
||||
$(".peity_bar_neutral span").peity("bar", {
|
||||
colour: "#757575",
|
||||
});
|
||||
});
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
$(function () {
|
||||
var datasets = {
|
||||
usa: {
|
||||
label: "USA",
|
||||
data: [
|
||||
[1988, 483994],
|
||||
[1989, 479060],
|
||||
[1990, 457648],
|
||||
[1991, 401949],
|
||||
[1992, 424705],
|
||||
[1993, 402375],
|
||||
[1994, 377867],
|
||||
[1995, 357382],
|
||||
[1996, 337946],
|
||||
[1997, 336185],
|
||||
[1998, 328611],
|
||||
[1999, 329421],
|
||||
[2000, 342172],
|
||||
[2001, 344932],
|
||||
[2002, 387303],
|
||||
[2003, 440813],
|
||||
[2004, 480451],
|
||||
[2005, 504638],
|
||||
[2006, 528692],
|
||||
],
|
||||
},
|
||||
russia: {
|
||||
label: "Russia",
|
||||
data: [
|
||||
[1988, 218000],
|
||||
[1989, 203000],
|
||||
[1990, 171000],
|
||||
[1992, 42500],
|
||||
[1993, 37600],
|
||||
[1994, 36600],
|
||||
[1995, 21700],
|
||||
[1996, 19200],
|
||||
[1997, 21300],
|
||||
[1998, 13600],
|
||||
[1999, 14000],
|
||||
[2000, 19100],
|
||||
[2001, 21300],
|
||||
[2002, 23600],
|
||||
[2003, 25100],
|
||||
[2004, 26100],
|
||||
[2005, 31100],
|
||||
[2006, 34700],
|
||||
],
|
||||
},
|
||||
uk: {
|
||||
label: "UK",
|
||||
data: [
|
||||
[1988, 62982],
|
||||
[1989, 62027],
|
||||
[1990, 60696],
|
||||
[1991, 62348],
|
||||
[1992, 58560],
|
||||
[1993, 56393],
|
||||
[1994, 54579],
|
||||
[1995, 50818],
|
||||
[1996, 50554],
|
||||
[1997, 48276],
|
||||
[1998, 47691],
|
||||
[1999, 47529],
|
||||
[2000, 47778],
|
||||
[2001, 48760],
|
||||
[2002, 50949],
|
||||
[2003, 57452],
|
||||
[2004, 60234],
|
||||
[2005, 60076],
|
||||
[2006, 59213],
|
||||
],
|
||||
},
|
||||
germany: {
|
||||
label: "Germany",
|
||||
data: [
|
||||
[1988, 55627],
|
||||
[1989, 55475],
|
||||
[1990, 58464],
|
||||
[1991, 55134],
|
||||
[1992, 52436],
|
||||
[1993, 47139],
|
||||
[1994, 43962],
|
||||
[1995, 43238],
|
||||
[1996, 42395],
|
||||
[1997, 40854],
|
||||
[1998, 40993],
|
||||
[1999, 41822],
|
||||
[2000, 41147],
|
||||
[2001, 40474],
|
||||
[2002, 40604],
|
||||
[2003, 40044],
|
||||
[2004, 38816],
|
||||
[2005, 38060],
|
||||
[2006, 36984],
|
||||
],
|
||||
},
|
||||
denmark: {
|
||||
label: "Denmark",
|
||||
data: [
|
||||
[1988, 3813],
|
||||
[1989, 3719],
|
||||
[1990, 3722],
|
||||
[1991, 3789],
|
||||
[1992, 3720],
|
||||
[1993, 3730],
|
||||
[1994, 3636],
|
||||
[1995, 3598],
|
||||
[1996, 3610],
|
||||
[1997, 3655],
|
||||
[1998, 3695],
|
||||
[1999, 3673],
|
||||
[2000, 3553],
|
||||
[2001, 3774],
|
||||
[2002, 3728],
|
||||
[2003, 3618],
|
||||
[2004, 3638],
|
||||
[2005, 3467],
|
||||
[2006, 3770],
|
||||
],
|
||||
},
|
||||
sweden: {
|
||||
label: "Sweden",
|
||||
data: [
|
||||
[1988, 6402],
|
||||
[1989, 6474],
|
||||
[1990, 6605],
|
||||
[1991, 6209],
|
||||
[1992, 6035],
|
||||
[1993, 6020],
|
||||
[1994, 6000],
|
||||
[1995, 6018],
|
||||
[1996, 3958],
|
||||
[1997, 5780],
|
||||
[1998, 5954],
|
||||
[1999, 6178],
|
||||
[2000, 6411],
|
||||
[2001, 5993],
|
||||
[2002, 5833],
|
||||
[2003, 5791],
|
||||
[2004, 5450],
|
||||
[2005, 5521],
|
||||
[2006, 5271],
|
||||
],
|
||||
},
|
||||
norway: {
|
||||
label: "Norway",
|
||||
data: [
|
||||
[1988, 4382],
|
||||
[1989, 4498],
|
||||
[1990, 4535],
|
||||
[1991, 4398],
|
||||
[1992, 4766],
|
||||
[1993, 4441],
|
||||
[1994, 4670],
|
||||
[1995, 4217],
|
||||
[1996, 4275],
|
||||
[1997, 4203],
|
||||
[1998, 4482],
|
||||
[1999, 4506],
|
||||
[2000, 4358],
|
||||
[2001, 4385],
|
||||
[2002, 5269],
|
||||
[2003, 5066],
|
||||
[2004, 5194],
|
||||
[2005, 4887],
|
||||
[2006, 4891],
|
||||
],
|
||||
},
|
||||
};
|
||||
/* var dataSet = [
|
||||
{label: "USA", color: "#005CDE" },
|
||||
{label: "Russia", color: "#005CDE" },
|
||||
{ label: "UK", color: "#00A36A" },
|
||||
{ label: "Germany", color: "#7D0096" },
|
||||
{ label: "Denmark", color: "#992B00" },
|
||||
{ label: "Sweden", color: "#DE000F" },
|
||||
{ label: "Norway", color: "#ED7B00" }
|
||||
];*/
|
||||
// hard-code color indices to prevent them from shifting as
|
||||
// countries are turned on/off
|
||||
var i = 0;
|
||||
$.each(datasets, function (key, val) {
|
||||
val.color = i;
|
||||
++i;
|
||||
});
|
||||
|
||||
// insert checkboxes
|
||||
var choiceContainer = $("#choices");
|
||||
$.each(datasets, function (key, val) {
|
||||
choiceContainer.append(
|
||||
'<input type="checkbox" name="' +
|
||||
key +
|
||||
'" checked="checked" id="id' +
|
||||
key +
|
||||
'">' +
|
||||
'<label for="id' +
|
||||
key +
|
||||
'">' +
|
||||
val.label +
|
||||
"</label>"
|
||||
);
|
||||
});
|
||||
choiceContainer.find("input").click(plotAccordingToChoices);
|
||||
|
||||
function plotAccordingToChoices() {
|
||||
var data = [];
|
||||
|
||||
choiceContainer.find("input:checked").each(function () {
|
||||
var key = $(this).attr("name");
|
||||
if (key && datasets[key]) data.push(datasets[key]);
|
||||
});
|
||||
|
||||
if (data.length > 0)
|
||||
$.plot($("#placeholder"), data, {
|
||||
yaxis: { min: 0 },
|
||||
xaxis: { tickDecimals: 0 },
|
||||
});
|
||||
}
|
||||
|
||||
plotAccordingToChoices();
|
||||
});
|
||||
Reference in New Issue
Block a user