summaryrefslogtreecommitdiffstats
path: root/data/templates/stats/profit_per_product.html
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-06-29 00:58:19 +0200
committerSebastian Reichel <sre@ring0.de>2018-07-15 22:59:57 +0200
commit22df08c29f6e4566d418e2a80a8279303406a733 (patch)
treedecb3029284b966635855e1684bc07ef9d3c1a6f /data/templates/stats/profit_per_product.html
parent17560f8bf49a0be2e0b490159e29f4894fe12cba (diff)
downloadserial-barcode-scanner-22df08c29f6e4566d418e2a80a8279303406a733.tar.bz2
build: switch to meson buildsystem
We build the project with 'meson' now instead of using custom configure script + GNU Makefiles. To build the project, go to the project root directory and use the following commands: Building: meson build cd build ninja Update Language Files: ninja shopsystem-pot ninja shopsystem-update-po Install: DESTDIR=./tmp ninja install
Diffstat (limited to 'data/templates/stats/profit_per_product.html')
-rw-r--r--data/templates/stats/profit_per_product.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/data/templates/stats/profit_per_product.html b/data/templates/stats/profit_per_product.html
new file mode 100644
index 0000000..7d8b50f
--- /dev/null
+++ b/data/templates/stats/profit_per_product.html
@@ -0,0 +1,42 @@
+<h1>Profit per Product (members only)</h1>
+<div id="profit_per_product" style="width:800px;height:400px;float: left;"></div>
+<div id="profit_per_product_info" style="clear: left;"></div>
+
+<script type="text/javascript">
+function pieHover(event, pos, obj) {
+ if(!obj) return;
+
+ percent = parseFloat(obj.series.percent).toFixed(2);
+ $("#profit_per_product_info").html('<span style="font-weight:bold; color: "'+obj.series.color+'">'+obj.series.label+' ('+obj.series.data[0][1]+'€ / '+percent+'%)</span>');
+}
+
+$(function () {
+ var data = {{{DATA}}};
+
+ var options = {
+ legend: {
+ show: true
+ },
+ series: {
+ pie: {
+ show: true,
+ combine: {
+ color: '#999',
+ threshold: 0.01
+ }
+ }
+ },
+ grid: {
+ hoverable: true,
+ clickable: true
+ }
+ }
+
+ if (data.length > 0)
+ $.plot($("#profit_per_product"), data, options);
+ else
+ $.plot($("#profit_per_product"), [], options);
+
+ $("#profit_per_product").bind("plothover", pieHover);
+});
+</script>