diff options
author | Sebastian Reichel <sre@ring0.de> | 2012-10-02 01:05:51 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2012-10-02 01:05:51 +0200 |
commit | 186049b3ed33f025eeb87eb34c19a28e1d5ba70a (patch) | |
tree | 5d892564001404fe979e18eac0e65dfcad65ed5e /templates/stats/profit_per_product.html | |
parent | 9713c98dbceb54d8d00c186ba8f41f3a5befcfd1 (diff) | |
download | serial-barcode-scanner-186049b3ed33f025eeb87eb34c19a28e1d5ba70a.tar.bz2 |
restructure code, switch from GTK to Web based UI
- move barcode generation scripts into generation/
- move code to src/
- remove database analysis from invoice/graph
- put database creation sql files into sql/
- remove glade builder file
- add new templates/ directory, which contains files
used by the Web-UI
Diffstat (limited to 'templates/stats/profit_per_product.html')
-rw-r--r-- | templates/stats/profit_per_product.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/templates/stats/profit_per_product.html b/templates/stats/profit_per_product.html new file mode 100644 index 0000000..7d8b50f --- /dev/null +++ b/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> |