diff options
author | Holger Cremer <HolgerCremer@gmail.com> | 2018-08-27 19:38:11 +0200 |
---|---|---|
committer | Holger Cremer <HolgerCremer@gmail.com> | 2018-08-27 19:38:11 +0200 |
commit | 8f2ba2050ee78d0e4a47f1277c6bc4422d06170c (patch) | |
tree | c008d2878905e03df7a8bf8bd3330762cc2d8f43 /data/templates/stats/profit_per_product.html | |
parent | bb55e121576a5b5d225bfc68c5062f386cc32db9 (diff) | |
parent | 3fc3ea6c6df237dbdf48d14703118b747bf5d647 (diff) | |
download | serial-barcode-scanner-8f2ba2050ee78d0e4a47f1277c6bc4422d06170c.tar.bz2 |
Merge branch 'master' into better_inventory
Conflicts:
README
data/templates/products/entry.html
docker/Dockerfile
docker/init.sh
src/database/database.vala
src/database/db-interface.vala
src/pdf-stock/Makefile
src/pdf-stock/pdf-stock-interface.vala
src/pdf-stock/pdf-stock.vala
src/web/Makefile
src/web/main.vala
templates/menu.html
templates/products/index.html
Diffstat (limited to 'data/templates/stats/profit_per_product.html')
-rw-r--r-- | data/templates/stats/profit_per_product.html | 42 |
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> |