aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bower_components/morris.js/spec/viz
diff options
context:
space:
mode:
authorMarvin Borner2018-07-13 19:06:45 +0200
committerMarvin Borner2018-07-13 19:06:45 +0200
commit6fcfb7c04d32e1c8b26a312295bf7ac3ec2d2ad7 (patch)
treedbc87ef16fa01d5d99116de283592b8fe5e02944 /public/bower_components/morris.js/spec/viz
parentdfd839f27146df0ad0494e11734fc7d310c70ebf (diff)
Fixed many permissions and began admin interface
Diffstat (limited to 'public/bower_components/morris.js/spec/viz')
-rw-r--r--public/bower_components/morris.js/spec/viz/examples.js56
-rw-r--r--public/bower_components/morris.js/spec/viz/exemplary/area0.pngbin0 -> 18402 bytes
-rw-r--r--public/bower_components/morris.js/spec/viz/exemplary/bar0.pngbin0 -> 6936 bytes
-rw-r--r--public/bower_components/morris.js/spec/viz/exemplary/line0.pngbin0 -> 22812 bytes
-rw-r--r--public/bower_components/morris.js/spec/viz/exemplary/stacked_bar0.pngbin0 -> 5859 bytes
-rwxr-xr-xpublic/bower_components/morris.js/spec/viz/run.sh32
-rw-r--r--public/bower_components/morris.js/spec/viz/test.html34
-rw-r--r--public/bower_components/morris.js/spec/viz/visual_specs.js66
8 files changed, 188 insertions, 0 deletions
diff --git a/public/bower_components/morris.js/spec/viz/examples.js b/public/bower_components/morris.js/spec/viz/examples.js
new file mode 100644
index 0000000..0e97de3
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/examples.js
@@ -0,0 +1,56 @@
+var webpage = require("webpage"),
+ fs = require("fs");
+
+var html_path = fs.absolute("test.html");
+var examples = [];
+
+function run_example(example_index) {
+ if (example_index >= examples.length) {
+ phantom.exit(0);
+ return;
+ }
+
+ var example = examples[example_index];
+ var snapshot_index = 0;
+ var page = webpage.create();
+
+ page.viewportSize = { width: 500, height: 300 };
+ page.clipRect = { width: 500, height: 300 };
+ page.onAlert = function (msg) {
+ var e = JSON.parse(msg);
+ if (e.fn == "snapshot") {
+ page.render("output/" + example.name + snapshot_index + ".png");
+ snapshot_index += 1;
+ } else if (e.fn == "mousemove") {
+ page.sendEvent("mousemove", e.x, e.y);
+ }
+ };
+
+ page.open(html_path, function (status) {
+ if (status == "fail") {
+ console.log("Failed to load test page: " + example.name);
+ phantom.exit(1);
+ } else {
+ page.evaluate(example.runner);
+ }
+ page.close();
+ run_example(example_index + 1);
+ });
+}
+
+exports.def = function (name, runner) {
+ examples.push({ name: name, runner: runner });
+};
+
+exports.run = function () {
+ if (fs.isDirectory("output")) {
+ fs.list("output").forEach(function (path) {
+ if (path != "." && path != "..") {
+ fs.remove("output/" + path);
+ }
+ });
+ } else {
+ fs.makeDirectory("output");
+ }
+ run_example(0);
+};
diff --git a/public/bower_components/morris.js/spec/viz/exemplary/area0.png b/public/bower_components/morris.js/spec/viz/exemplary/area0.png
new file mode 100644
index 0000000..67e5f4a
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/exemplary/area0.png
Binary files differ
diff --git a/public/bower_components/morris.js/spec/viz/exemplary/bar0.png b/public/bower_components/morris.js/spec/viz/exemplary/bar0.png
new file mode 100644
index 0000000..03f12e0
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/exemplary/bar0.png
Binary files differ
diff --git a/public/bower_components/morris.js/spec/viz/exemplary/line0.png b/public/bower_components/morris.js/spec/viz/exemplary/line0.png
new file mode 100644
index 0000000..70f814c
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/exemplary/line0.png
Binary files differ
diff --git a/public/bower_components/morris.js/spec/viz/exemplary/stacked_bar0.png b/public/bower_components/morris.js/spec/viz/exemplary/stacked_bar0.png
new file mode 100644
index 0000000..238e05f
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/exemplary/stacked_bar0.png
Binary files differ
diff --git a/public/bower_components/morris.js/spec/viz/run.sh b/public/bower_components/morris.js/spec/viz/run.sh
new file mode 100755
index 0000000..ae671d4
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/run.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# visual_specs.js creates output in output/XXX.png
+phantomjs visual_specs.js
+
+# clear out old diffs
+mkdir -p diff
+rm -f diff/*
+
+# generate diffs
+PASS=1
+for i in exemplary/*.png
+do
+ FN=`basename $i`
+ perceptualdiff $i output/$FN -output diff/$FN
+ if [ $? -eq 0 ]
+ then
+ echo "OK: $FN"
+ else
+ echo "FAIL: $FN"
+ PASS=0
+ fi
+done
+
+# pass / fail
+if [ $PASS -eq 1 ]
+then
+ echo "Success."
+else
+ echo "Failed."
+ exit 1
+fi
diff --git a/public/bower_components/morris.js/spec/viz/test.html b/public/bower_components/morris.js/spec/viz/test.html
new file mode 100644
index 0000000..28db054
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/test.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<head>
+ <!-- jQuery packaging changed for 2.1.0, so try to load both paths, one will work. -->
+ <script src="../../bower_components/jquery/dist/jquery.js"></script>
+ <script src="../../bower_components/jquery/jquery.js"></script>
+ <script src="../../bower_components/raphael/raphael-min.js"></script>
+ <script src="../../morris.js"></script>
+ <link rel="stylesheet" href="../../morris.css">
+ <style>
+ body {
+ padding: 0;
+ margin: 0;
+ background-color: white;
+ }
+ #chart {
+ width: 500px;
+ height: 300px;
+ }
+ </style>
+ <script>
+ function bridge(e) {
+ window.alert(JSON.stringify(e));
+ }
+ window.snapshot = function () {
+ bridge({ fn: "snapshot" });
+ };
+ window.mousemove = function (x, y) {
+ bridge({ fn: "mousemove", x: x, y: y });
+ };
+ </script>
+</head>
+<body>
+<div id="chart"></div>
+</body>
diff --git a/public/bower_components/morris.js/spec/viz/visual_specs.js b/public/bower_components/morris.js/spec/viz/visual_specs.js
new file mode 100644
index 0000000..20dc666
--- /dev/null
+++ b/public/bower_components/morris.js/spec/viz/visual_specs.js
@@ -0,0 +1,66 @@
+var examples = require('./examples');
+
+examples.def('line', function () {
+ Morris.Line({
+ element: 'chart',
+ data: [
+ { x: 0, y: 10, z: 30 }, { x: 1, y: 20, z: 20 },
+ { x: 2, y: 30, z: 10 }, { x: 3, y: 30, z: 10 },
+ { x: 4, y: 20, z: 20 }, { x: 5, y: 10, z: 30 }
+ ],
+ xkey: 'x',
+ ykeys: ['y', 'z'],
+ labels: ['y', 'z'],
+ parseTime: false
+ });
+ window.snapshot();
+});
+
+examples.def('area', function () {
+ Morris.Area({
+ element: 'chart',
+ data: [
+ { x: 0, y: 1, z: 1 }, { x: 1, y: 2, z: 1 },
+ { x: 2, y: 3, z: 1 }, { x: 3, y: 3, z: 1 },
+ { x: 4, y: 2, z: 1 }, { x: 5, y: 1, z: 1 }
+ ],
+ xkey: 'x',
+ ykeys: ['y', 'z'],
+ labels: ['y', 'z'],
+ parseTime: false
+ });
+ window.snapshot();
+});
+
+examples.def('bar', function () {
+ Morris.Bar({
+ element: 'chart',
+ data: [
+ { x: 0, y: 1, z: 3 }, { x: 1, y: 2, z: 2 },
+ { x: 2, y: 3, z: 1 }, { x: 3, y: 3, z: 1 },
+ { x: 4, y: 2, z: 2 }, { x: 5, y: 1, z: 3 }
+ ],
+ xkey: 'x',
+ ykeys: ['y', 'z'],
+ labels: ['y', 'z']
+ });
+ window.snapshot();
+});
+
+examples.def('stacked_bar', function () {
+ Morris.Bar({
+ element: 'chart',
+ data: [
+ { x: 0, y: 1, z: 1 }, { x: 1, y: 2, z: 1 },
+ { x: 2, y: 3, z: 1 }, { x: 3, y: 3, z: 1 },
+ { x: 4, y: 2, z: 1 }, { x: 5, y: 1, z: 1 }
+ ],
+ xkey: 'x',
+ ykeys: ['y', 'z'],
+ labels: ['y', 'z'],
+ stacked: true
+ });
+ window.snapshot();
+});
+
+examples.run();