Highcharts is back

This commit is contained in:
Nikolai R Kristiansen committed 2017-09-27 22:01:15 +02:00
1 parent 16bc430369
commit a84c94e23b
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -1 +1 @@
function enable_all_customers(){$("li.customer").each(function(t){$(this).removeClass("marked"),$(this).show()})}function filter_customers(t){setTimeout(function(){$("li.customer").each(function(e){var n=new RegExp(t,"i"),i=$(this).children("span.name").text();if(n.test(i)){$(this).show();var r=i.toLowerCase()==t.toLowerCase(),o=1==$("li.customer:visible").length;console.log(r,o),r?$(this).addClass("marked"):$(this).removeClass("marked")}else $(this).hide(),$(this).removeClass("marked")})},50)}function enable_all_products(){$("li.product").each(function(t){$(this).removeClass("marked"),$(this).show()})}function reset_qtys(){$(".qty").each(function(t){$(this).html("0")}),$("input[name$=amount]").each(function(t){$(this).val("0")})}function update_total(){var t=0;$("li.product").each(function(){var e=Number($(this).find("[name$=amount]").val()),n=".sale_price_int";"Ekstern"===$("#id_customer_typeahead").val()&&(n=".sale_price_ext");var i=Number($(this).find(n).text());t+=e*i}),0===t&&(t=""),$("span.total_text").html(t)}function productFormatter(){return"<b>"+this.point.name+"</b>: "+Highcharts.numberFormat(this.percentage,1)+" %"}function parse_products_realtime_data(t,e){for(var n in t.products){null===e.get(n)&&e.addSeries({data:[],id:n,name:n});var i=e.get(n);_.each(t.products[n],function(t){null===e.get(t[0])&&i.addPoint({id:t[0],x:t[0],y:t[1]})})}}function get_products_realtime_data(){$.ajax({url:products_realtime_url,dataType:"json",success:function(t){parse_products_realtime_data(t,products_realtime_chart),setTimeout(function(){get_products_realtime_data()},15e3)},cache:!1})}function renderProductCharts(t){for(var e in t){var n="product_chart"+t[e].id,i=t[e].counts;i=_.map(i,function(t){return[t.full_name,t.amount_total]}),new Highcharts.Chart({chart:{renderTo:n,plotBackgroundColor:null,plotBorderWidth:null,plotShadow:!1},title:{text:t[e].name},tooltip:{formatter:productFormatter},plotOptions:{pie:{allowPointSelect:!0,cursor:"pointer",dataLabels:{enabled:!0,color:"#000000",connectorColor:"#000000",formatter:function(){return"<b>"+this.point.name+"</b>: "+this.y}}}},series:[{type:"pie",name:"Orders",data:i}]})}}function renderOrdersGroupedChart(t){var e=t.grouping,n="order_chart_"+e;new Highcharts.Chart({chart:{renderTo:n,type:"column"},title:{text:"Ordre - "+e},tooltip:{formatter:function(){return this.y+" stk"}},yAxis:{title:{text:"Ordre"}},xAxis:{title:{text:"Tid"},labels:{formatter:orderFormatters[e]}},plotOptions:{column:{minPointLength:3,colorByPoint:!0},series:{groupPadding:0,pointPadding:.05}},series:[{name:"Ordre",data:t.orders}]})}!function(t,e){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(t,e){"use strict";function n(t,e){var n=(e=e||et).createElement("script");n.text=t,e.head.appendChild(n).parentNode.removeChild(n)}function i(t){var e=!!t&&"length"in t&&t.length,n=pt.type(t);return"function"!==n&&!pt.isWindow(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function r(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}function o(t,e,n){return pt.isFunction(e)?pt.grep(t,function(t,i){return!!e.call(t,i,t)!==n}):e.nodeType?pt.grep(t,function(t){return t===e!==n}):"string"!=typeof e?pt.grep(t,function(t){return at.call(e,t)>-1!==n}):Ct.test(e)?pt.filter(e,t,n):(e=pt.filter(e,t),pt.grep(t,function(t){return at.call(e,t)>-1!==n&&1===t.nodeType}))}function a(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function s(t){var e={};return pt.each(t.match(Et)||[],function(t,n){e[n]=!0}),e}function l(t){return t}function u(t){throw t}function c(t,e,n,i){var r;try{t&&pt.isFunction(r=t.promise)?r.call(t).done(e).fail(n):t&&pt.isFunction(r=t.then)?r.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.apply(void 0,[t])}}function h(){et.removeEventListener("DOMContentLoaded",h),t.removeEventListener("load",h),pt.ready()}function d(){this.expando=pt.expando+d.uid++}function f(t){return"true"===t||"false"!==t&&("null"===t?null:t===+t+""?+t:Ut.test(t)?JSON.parse(t):t)}function p(t,e,n){var i;if(void 0===n&&1===t.nodeType)if(i="data-"+e.replace(qt,"-$&").toLowerCase(),"string"==typeof(n=t.getAttribute(i))){try{n=f(n)}catch(t){}Ft.set(t,e,n)}else n=void 0;return n}function g(t,e,n,i){var r,o=1,a=20,s=i?function(){return i.cur()}:function(){return pt.css(t,e,"")},l=s(),u=n&&n[3]||(pt.cssNumber[e]?"":"px"),c=(pt.cssNumber[e]||"px"!==u&&+l)&&It.exec(pt.css(t,e));if(c&&c[3]!==u){u=u||c[3],n=n||[],c=+l||1;do{o=o||".5",c/=o,pt.style(t,e,c+u)}while(o!==(o=s()/l)&&1!==o&&--a)}return n&&(c=+c||+l||0,r=n[1]?c+(n[1]+1)*n[2]:+n[2],i&&(i.unit=u,i.start=c,i.end=r)),r}function v(t){var e,n=t.ownerDocument,i=t.nodeName,r=Wt[i];return r||(e=n.body.appendChild(n.createElement(i)),r=pt.css(e,"display"),e.parentNode.removeChild(e),"none"===r&&(r="block"),Wt[i]=r,r)}function m(t,e){for(var n,i,r=[]Line truncated
function enable_all_customers(){$("li.customer").each(function(t){$(this).removeClass("marked"),$(this).show()})}function filter_customers(t){setTimeout(function(){$("li.customer").each(function(e){var i=new RegExp(t,"i"),n=$(this).children("span.name").text();if(i.test(n)){$(this).show();var r=n.toLowerCase()==t.toLowerCase(),s=1==$("li.customer:visible").length;console.log(r,s),r?$(this).addClass("marked"):$(this).removeClass("marked")}else $(this).hide(),$(this).removeClass("marked")})},50)}function enable_all_products(){$("li.product").each(function(t){$(this).removeClass("marked"),$(this).show()})}function reset_qtys(){$(".qty").each(function(t){$(this).html("0")}),$("input[name$=amount]").each(function(t){$(this).val("0")})}function update_total(){var t=0;$("li.product").each(function(){var e=Number($(this).find("[name$=amount]").val()),i=".sale_price_int";"Ekstern"===$("#id_customer_typeahead").val()&&(i=".sale_price_ext");var n=Number($(this).find(i).text());t+=e*n}),0===t&&(t=""),$("span.total_text").html(t)}function productFormatter(){return"<b>"+this.point.name+"</b>: "+Highcharts.numberFormat(this.percentage,1)+" %"}function parse_products_realtime_data(t,e){for(var i in t.products){null===e.get(i)&&e.addSeries({data:[],id:i,name:i});var n=e.get(i);_.each(t.products[i],function(t){null===e.get(t[0])&&n.addPoint({id:t[0],x:t[0],y:t[1]})})}}function get_products_realtime_data(){$.ajax({url:products_realtime_url,dataType:"json",success:function(t){parse_products_realtime_data(t,products_realtime_chart),setTimeout(function(){get_products_realtime_data()},15e3)},cache:!1})}function renderProductCharts(t){for(var e in t){var i="product_chart"+t[e].id,n=t[e].counts;n=_.map(n,function(t){return[t.full_name,t.amount_total]}),new Highcharts.Chart({chart:{renderTo:i,plotBackgroundColor:null,plotBorderWidth:null,plotShadow:!1},title:{text:t[e].name},tooltip:{formatter:productFormatter},plotOptions:{pie:{allowPointSelect:!0,cursor:"pointer",dataLabels:{enabled:!0,color:"#000000",connectorColor:"#000000",formatter:function(){return"<b>"+this.point.name+"</b>: "+this.y}}}},series:[{type:"pie",name:"Orders",data:n}]})}}function renderOrdersGroupedChart(t){var e=t.grouping,i="order_chart_"+e;new Highcharts.Chart({chart:{renderTo:i,type:"column"},title:{text:"Ordre - "+e},tooltip:{formatter:function(){return this.y+" stk"}},yAxis:{title:{text:"Ordre"}},xAxis:{title:{text:"Tid"},labels:{formatter:orderFormatters[e]}},plotOptions:{column:{minPointLength:3,colorByPoint:!0},series:{groupPadding:0,pointPadding:.05}},series:[{name:"Ordre",data:t.orders}]})}!function(t,e){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(t,e){"use strict";function i(t,e){var i=(e=e||et).createElement("script");i.text=t,e.head.appendChild(i).parentNode.removeChild(i)}function n(t){var e=!!t&&"length"in t&&t.length,i=ft.type(t);return"function"!==i&&!ft.isWindow(t)&&("array"===i||0===e||"number"==typeof e&&e>0&&e-1 in t)}function r(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}function s(t,e,i){return ft.isFunction(e)?ft.grep(t,function(t,n){return!!e.call(t,n,t)!==i}):e.nodeType?ft.grep(t,function(t){return t===e!==i}):"string"!=typeof e?ft.grep(t,function(t){return ot.call(e,t)>-1!==i}):Mt.test(e)?ft.filter(e,t,i):(e=ft.filter(e,t),ft.grep(t,function(t){return ot.call(e,t)>-1!==i&&1===t.nodeType}))}function o(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function a(t){var e={};return ft.each(t.match(Ot)||[],function(t,i){e[i]=!0}),e}function l(t){return t}function h(t){throw t}function c(t,e,i,n){var r;try{t&&ft.isFunction(r=t.promise)?r.call(t).done(e).fail(i):t&&ft.isFunction(r=t.then)?r.call(t,e,i):e.apply(void 0,[t].slice(n))}catch(t){i.apply(void 0,[t])}}function u(){et.removeEventListener("DOMContentLoaded",u),t.removeEventListener("load",u),ft.ready()}function d(){this.expando=ft.expando+d.uid++}function p(t){return"true"===t||"false"!==t&&("null"===t?null:t===+t+""?+t:Ft.test(t)?JSON.parse(t):t)}function f(t,e,i){var n;if(void 0===i&&1===t.nodeType)if(n="data-"+e.replace(Rt,"-$&").toLowerCase(),"string"==typeof(i=t.getAttribute(n))){try{i=p(i)}catch(t){}_t.set(t,e,i)}else i=void 0;return i}function g(t,e,i,n){var r,s=1,o=20,a=n?function(){return n.cur()}:function(){return ft.css(t,e,"")},l=a(),h=i&&i[3]||(ft.cssNumber[e]?"":"px"),c=(ft.cssNumber[e]||"px"!==h&&+l)&&Ht.exec(ft.css(t,e));if(c&&c[3]!==h){h=h||c[3],i=i||[],c=+l||1;do{s=s||".5",c/=s,ft.style(t,e,c+h)}while(s!==(s=a()/l)&&1!==s&&--o)}return i&&(c=+c||+l||0,r=i[1]?c+(i[1]+1)*i[2]:+i[2],n&&(n.unit=h,n.start=c,n.end=r)),r}function m(t){var e,i=t.ownerDocument,n=t.nodeName,r=Yt[n];return r||(e=i.body.appendChild(i.createElement(n)),r=ft.css(e,"display"),e.parentNode.removeChild(e),"none"===r&&(r="block"),Yt[n]=r,r)}function v(t,e){for(var i,n,r=[]Line truncated