/*
 * Copyright (c) 2020 aureliancnx
 *
 * MIT LICENSE
 *
 * This project is part of aureliancnx.
 * See https://github.com/aureliancnx/Bubulle-Norminette for further info.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE. */
$(function(){"use strict";$.plot("#flotBar1",[{data:[[0,3],[2,8],[4,5],[6,13],[8,5],[10,7],[12,4],[14,6]]}],{series:{bars:{show:!0,lineWidth:0,fillColor:"#4E6577"}},grid:{borderWidth:1,borderColor:"#D9D9D9"},yaxis:{tickColor:"#d9d9d9",font:{color:"#666",size:10}},xaxis:{tickColor:"#d9d9d9",font:{color:"#666",size:10}}}),$.plot("#flotBar2",[{data:[[0,3],[2,8],[4,5],[6,13],[8,5],[10,7],[12,8],[14,10]],bars:{show:!0,lineWidth:0,fillColor:"#4E6577"}},{data:[[1,5],[3,7],[5,10],[7,7],[9,9],[11,5],[13,4],[15,6]],bars:{show:!0,lineWidth:0,fillColor:"#BD9DC7"}}],{grid:{borderWidth:1,borderColor:"#D9D9D9"},yaxis:{tickColor:"#d9d9d9",font:{color:"#666",size:10}},xaxis:{tickColor:"#d9d9d9",font:{color:"#666",size:10}}});var o=[[0,2],[1,3],[2,6],[3,5],[4,7],[5,8],[6,10]],e=[[0,1],[1,2],[2,5],[3,3],[4,5],[5,6],[6,9]],i=$.plot($("#flotLine1"),[{data:o,label:"New Customer",color:"#BD9DC7"},{data:e,label:"Returning Customer",color:"#4E6577"}],{series:{lines:{show:!0,lineWidth:1},shadowSize:0},points:{show:!1},legend:{noColumns:1,position:"nw"},grid:{hoverable:!0,clickable:!0,borderColor:"#ddd",borderWidth:0,labelMargin:5,backgroundColor:"#fff"},yaxis:{min:0,max:15,color:"#eee",font:{size:10,color:"#999"}},xaxis:{color:"#eee",font:{size:10,color:"#999"}}}),i=$.plot($("#flotLine2"),[{data:o,label:"New Customer",color:"#BD9DC7"},{data:e,label:"Returning Customer",color:"#4E6577"}],{series:{lines:{show:!1},splines:{show:!0,tension:.4,lineWidth:1},shadowSize:0},points:{show:!1},legend:{noColumns:1,position:"nw"},grid:{hoverable:!0,clickable:!0,borderColor:"#ddd",borderWidth:0,labelMargin:5,backgroundColor:"#fff"},yaxis:{min:0,max:15,color:"#eee",font:{size:10,color:"#999"}},xaxis:{color:"#eee",font:{size:10,color:"#999"}}}),l=[[0,10],[1,7],[2,8],[3,9],[4,6],[5,5],[6,7]],r=[[0,8],[1,5],[2,6],[3,8],[4,4],[5,3],[6,6]],i=$.plot($("#flotLine3"),[{data:l,label:"New Customer",color:"#F37AAD"},{data:r,label:"Returning Customer",color:"#6AC3C9"}],{series:{lines:{show:!0,lineWidth:1},shadowSize:0},points:{show:!0},legend:{noColumns:1,position:"nw"},grid:{hoverable:!0,clickable:!0,borderColor:"#ddd",borderWidth:0,labelMargin:5,backgroundColor:"#fff"},yaxis:{min:0,max:15,color:"#eee",font:{size:10,color:"#999"}},xaxis:{color:"#eee",font:{size:10,color:"#999"}}}),i=$.plot($("#flotLine4"),[{data:l,label:"New Customer",color:"#F37AAD"},{data:r,label:"Returning Customer",color:"#6AC3C9"}],{series:{lines:{show:!1},splines:{show:!0,tension:.4,lineWidth:1},shadowSize:0},points:{show:!0},legend:{noColumns:1,position:"nw"},grid:{hoverable:!0,clickable:!0,borderColor:"#ddd",borderWidth:0,labelMargin:5,backgroundColor:"#fff"},yaxis:{min:0,max:15,color:"#eee",font:{size:10,color:"#999"}},xaxis:{color:"#eee",font:{size:10,color:"#999"}}}),i=$.plot($("#flotArea1"),[{data:o,label:"New Customer",color:"#BD9DC7"},{data:e,label:"Returning Customer",color:"#4E6577"}],{series:{lines:{show:!0,lineWidth:0,fill:.8},shadowSize:0},points:{show:!1},legend:{noColumns:1,position:"nw"},grid:{hoverable:!0,clickable:!0,borderColor:"#ddd",borderWidth:0,labelMargin:5,backgroundColor:"#fff"},yaxis:{min:0,max:15,color:"#eee",font:{size:10,color:"#999"}},xaxis:{color:"#eee",font:{size:10,color:"#999"}}}),i=$.plot($("#flotArea2"),[{data:o,label:"New Customer",color:"#BD9DC7"},{data:e,label:"Returning Customer",color:"#4E6577"}],{series:{lines:{show:!1},splines:{show:!0,tension:.4,lineWidth:0,fill:.8},shadowSize:0},points:{show:!1},legend:{noColumns:1,position:"nw"},grid:{hoverable:!0,clickable:!0,borderColor:"#ddd",borderWidth:0,labelMargin:5,backgroundColor:"#fff"},yaxis:{min:0,max:15,color:"#eee",font:{size:10,color:"#999"}},xaxis:{color:"#eee",font:{size:10,color:"#999"}}}),n=null;$("#flotLine3, #flotLine4").bind("plothover",function(o,e,l){var i,r,t,a,s;$("#x").text(e.x.toFixed(2)),$("#y").text(e.y.toFixed(2)),l?n!=l.dataIndex&&(n=l.dataIndex,$("#tooltip").remove(),i=l.datapoint[0].toFixed(2),r=l.datapoint[1].toFixed(2),t=l.pageX,a=l.pageY,s=l.series.label+" of "+i+" = "+r,$('<div id="tooltip" class="tooltipflot">'+s+"</div>").css({position:"absolute",display:"none",top:a+5,left:t+5}).appendTo("body").fadeIn(200)):($("#tooltip").remove(),n=null)}),$("#flotLine3, #flotLine4").bind("plotclick",function(o,e,l){l&&i.highlight(l.series,l.datapoint)});var t=[],a=50;function s(){for(0<t.length&&(t=t.slice(1));t.length<a;){var o=(0<t.length?t[t.length-1]:50)+10*Math.random()-5;o<0?o=0:100<o&&(o=100),t.push(o)}for(var e=[],l=0;l<t.length;++l)e.push([l,t[l]]);return e}var d=1e3,c=$.plot("#flotRealtime1",[s()],{colors:["#BD9DC7"],series:{lines:{show:!0,lineWidth:1},shadowSize:0},grid:{borderColor:"#ddd",borderWidth:1,labelMargin:5},xaxis:{color:"#eee",font:{size:10,color:"#999"}},yaxis:{min:0,max:100,color:"#eee",font:{size:10,color:"#999"}}}),h=$.plot("#flotRealtime2",[s()],{colors:["#BD9DC7"],series:{lines:{show:!0,lineWidth:0,fill:.9},shadowSize:0},grid:{borderColor:"#ddd",borderWidth:1,labelMargin:5},xaxis:{color:"#eee",font:{size:10,color:"#999"}},yaxis:{min:0,max:100,color:"#eee",font:{size:10,color:"#999"}}});!function o(){c.setData([s()]),c.draw(),setTimeout(o,d)}(),function o(){h.setData([s()]),h.draw(),setTimeout(o,d)}();var b=[{label:"Series 1",data:[[1,10]],color:"#9A3267"},{label:"Series 2",data:[[1,30]],color:"#ED4151"},{label:"Series 3",data:[[1,90]],color:"#F89D44"},{label:"Series 4",data:[[1,70]],color:"#85C441"},{label:"Series 5",data:[[1,80]],color:"#36B3E3"}];function f(o,e){return"<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>"+o+"<br/>"+Math.round(e.percent)+"%</div>"}$.plot("#flotPie1",b,{series:{pie:{show:!0,radius:1,label:{show:!0,radius:2/3,formatter:f,threshold:.1}}},grid:{hoverable:!0,clickable:!0}}),$.plot("#flotPie2",b,{series:{pie:{show:!0,radius:1,innerRadius:.5,label:{show:!0,radius:2/3,formatter:f,threshold:.1}}},grid:{hoverable:!0,clickable:!0}})});