www-thermferm/jqwidgets/jqxbulletchart.js

changeset 511
2d1d43c3a2c2
parent 373
f6850e0b5d35
child 617
b216f9d4b917
--- a/www-thermferm/jqwidgets/jqxbulletchart.js	Fri May 19 16:34:21 2017 +0200
+++ b/www-thermferm/jqwidgets/jqxbulletchart.js	Sun May 28 14:19:57 2017 +0200
@@ -1,7 +1,7 @@
 /*
-jQWidgets v3.8.0 (2015-Apr)
-Copyright (c) 2011-2015 jQWidgets.
+jQWidgets v4.5.2 (2017-May)
+Copyright (c) 2011-2017 jQWidgets.
 License: http://jqwidgets.com/license/
-*/
-
-(function(a){a.jqx.jqxWidget("jqxBulletChart","",{});a.extend(a.jqx._jqxBulletChart.prototype,{defineInstance:function(){var b={width:500,height:100,barSize:"50%",ranges:[{startValue:0,endValue:50,color:"#000000",opacity:0.7},{startValue:50,endValue:80,color:"#000000",opacity:0.5},{startValue:80,endValue:100,color:"#000000",opacity:0.3}],pointer:{value:65,label:"Value",size:"25%",color:""},target:{value:85,label:"Target",size:4,color:""},ticks:{position:"far",interval:20,size:10},title:"Title",description:"Description",orientation:"horizontal",labelsFormat:null,labelsFormatFunction:null,animationDuration:400,showTooltip:true,tooltipFormatFunction:null,disabled:false,rtl:false,events:["change"]};a.extend(true,this,b);return b},createInstance:function(b){if(!a.jqx.dataAdapter){throw new Error("jqxBulletChart: Missing reference to the following module: 'jqxdata.js'.")}this._setDefaultValues();this.render();var c=this;a.jqx.utilities.resize(this.host,function(){if(c._timer){clearTimeout(c._timer)}c._timer=setTimeout(function(){var d=c.animationDuration;c.animationDuration=0;c.render();setTimeout(function(){c.animationDuration=d},0)},10)},false,true)},render:function(){if(this.host.children().length>0){this._removeHandlers();if(this.showTooltip==true){this.host.jqxTooltip("destroy")}this.host.empty()}this.host.addClass(this.toThemeProperty("jqx-widget"));this.host.addClass(this.toThemeProperty("jqx-bulletchart"));this.host.width(this.width);this.host.height(this.height);var n=this.host.width();var d=this.host.height();var l;var j=this.rtl?"rtl":"ltr";if(this.orientation=="horizontal"){l=a("<div style='position: absolute; visibility: hidden; padding: 5px;'><div class='"+this.toThemeProperty("jqx-bulletchart-title")+"' style='direction: "+j+";'>"+this.title+"</div><div class='"+this.toThemeProperty("jqx-bulletchart-description")+"' style='direction: "+j+";'>"+this.description+"</div></div>")}else{if(this.orientation=="vertical"){l=a("<div style='position: absolute; visibility: hidden; padding-bottom: 15px;'><div class='"+this.toThemeProperty("jqx-bulletchart-title")+"' style='width: "+n+"px; direction: "+j+";'>"+this.title+"</div><div class='"+this.toThemeProperty("jqx-bulletchart-description")+"' style='direction: "+j+";'>"+this.description+"</div></div>")}}this.host.append(l);var k=l.outerWidth();var g=l.outerHeight();l.remove();var e,h,i,b,o,m,f,c;if(this.orientation=="horizontal"){e="jqx-bulletchart-title-container-horizontal";h="jqx-bulletchart-chart-container-horizontal";i=this._checkPercentage(this.barSize,this.host);b=k;o=this.barSize;m=0;f=n-b;c=o;if(this.width&&this.width.toString().indexOf("%")>=0){var f=parseFloat(parseFloat(f*100)/n).toString()+"%";var b=parseFloat(parseFloat(b*100)/n).toString()+"%";this._percentageWidth=true}}else{if(this.orientation=="vertical"){e="jqx-bulletchart-title-container-vertical";h="jqx-bulletchart-chart-container-vertical";i=0;b="100%";o=g;m=this._checkPercentage(this.barSize,this.host);f=this.barSize;c=d-o}}if(this.rtl==false||(this.rtl==true&&this.orientation=="vertical")){this.host.append("<div id='"+this.element.id+"titleContainer' class='"+e+"' style='top: "+i+";'></div>")}this.host.append("<div id='"+this.element.id+"ChartContainer' class='"+h+"' style='top: "+i+"; left: "+m+";'></div>");if(this.rtl==true&&this.orientation=="horizontal"){this.host.append("<div id='"+this.element.id+"titleContainer' class='"+e+"' style='top: "+i+";'></div>")}this._titleContainer=a("#"+this.element.id+"titleContainer");this._chartContainer=a("#"+this.element.id+"ChartContainer");this._titleContainer.css({width:b,height:o});this._chartContainer.css({width:f,height:c});this._min=this.ranges[0].startValue;this._max=this.ranges[this.ranges.length-1].endValue;this._interval=this._max-this._min;this._valueToPixelsHorizontal=this._chartContainer.width()/this._interval;this._valueToPixelsVertical=this._chartContainer.height()/this._interval;this._checkValues();this._appendRanges();this._appendPointerAndTarget();this._appendTitleAndDescription();if(this.ticks.position!="none"){this._appendTicksAndLabels()}if(this.disabled==true){this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"))}if(this.showTooltip==true){if(this.host.jqxTooltip!=undefined){this._initializeTooltip();this.host.data().jqxWidget=this}else{throw new Error("jqxBulletChart: Missing reference to the following module: 'jqxtooltip.js'.")}}this._updateValue(this.pointer.value,0,true)},refresh:function(b){if(!b){this.render()}},val:function(b){if(arguments.length==0||(b!=null&&typeof(b)=="object")){return this.pointer.value}else{if(b>this._max){b=this._max}else{if(b<this._min){b=this._min}}if(b!=this.pointer.value){this._updateValue(b,this.pointer.value);this.pointer.value=b;if(this.showTooltip==true){this._updateTooltip()}}}},destroy:function(){a.jqx.utilities.resize(this.host,null,true);this._removeHandlers();if(this.showTooltip==true){this.host.jqxTooltip("destroy")}this.host.remove()},propertyChangedHandler:function(c,d,g,e){if(g!=e||e instanceof Object){var b=true;var f=function(){a.each(g,function(i,h){if(e[i]==undefined){c[d][i]=h}})};switch(d){case"barSize":break;case"ranges":a.each(g,function(i,h){a.each(h,function(k,j){if(e[i][k]==undefined){c[d][i][k]=j}})});this._setDefaultValues();break;case"pointer":f();this._updatePointer(e,g);return;case"target":f();this._updateTarget(e,g);return;case"ticks":b=false;f();a.each(g,function(i,h){if(g[i]!=c[d][i]){b=!(b&&false)}});break;case"showTooltip":if(e==true){if(this.host.jqxTooltip!=undefined){this._initializeTooltip()}else{throw new Error("jqxBulletChart: Missing reference to the following module: 'jqxtooltip.js'.")}}else{this._removeHandlers();this.host.jqxTooltip("destroy")}break;case"animationDuration":return;case"tooltipFormatFunction":this._updateTooltip();return;case"disabled":if(e==true){this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"))}else{this.host.removeClass(this.toThemeProperty("jqx-fill-state-disabled"))}return}if(b==true){this.render()}}},_raiseEvent:function(g,e){var c=this.events[g];var f=new a.Event(c);f.owner=this;f.args=e;try{var b=this.host.trigger(f)}catch(d){}return b},_removeHandlers:function(){var b=a("#"+this.element.id+"Pointer, #"+this.element.id+"Target");this.removeHandler(b,"mouseenter.bulletchart"+this.element.id);this.removeHandler(b,"mouseleave.bulletchart"+this.element.id)},_setDefaultValues:function(){var b=this.ranges;var c=this.ranges.length;for(var d=0;d<c;d++){if(b[d].startValue==undefined||b[d].endValue==undefined){throw new Error("jqxBulletChart: Each range must have its startValue and endValue set.")}if(b[d].color==undefined){this.ranges[d].color="#000000"}if(b[d].opacity==undefined){this.ranges[d].opacity=1-(1/c)*d}}var g=this.pointer;if(g.value==undefined){this.pointer.value=65}if(g.label==undefined){this.pointer.label="Value"}if(g.size==undefined){this.pointer.size="25%"}if(g.color==undefined){this.pointer.color=""}var f=this.target;if(f.value==undefined){this.target.value=85}if(f.label==undefined){this.target.label="Target"}if(f.size==undefined){this.target.size=5}if(f.color==undefined){this.target.color=""}var e=this.ticks;if(e.position==undefined){this.ticks.position="near"}if(e.interval==undefined){this.ticks.interval=20}if(e.size==undefined){this.ticks.size=10}},_checkValues:function(){if(this.pointer.value>this._max){this.pointer.value=this._max}else{if(this.pointer.value<this._min){this.pointer.value=this._min}}if(this.target.value>this._max){this.target.value=this._max}else{if(this.target.value<this._min){this.target.value=this._min}}},_appendRanges:function(){var e="";var g=this.ranges.length;for(var d=0;d<g;d++){var f=this.ranges[d];var l;if(this.orientation=="horizontal"){var h=this.rtl?"right":"left";var c=(f.startValue-this._min)*this._valueToPixelsHorizontal;var j=(f.endValue-f.startValue)*this._valueToPixelsHorizontal;l="<div class='"+this.toThemeProperty("jqx-bulletchart-range")+" "+this.toThemeProperty("jqx-bulletchart-range-horizontal")+"' style='"+h+": "+c+"px; width: "+j+"px; background-color: "+f.color+"; opacity: "+f.opacity+"'></div>"}else{if(this.orientation=="vertical"){var b=(f.startValue-this._min)*this._valueToPixelsVertical;var k=(f.endValue-f.startValue)*this._valueToPixelsVertical;l="<div class='"+this.toThemeProperty("jqx-bulletchart-range")+" "+this.toThemeProperty("jqx-bulletchart-range-vertical")+"' style='bottom: "+b+"px; height: "+k+"px; background-color: "+f.color+"; opacity: "+f.opacity+"'></div>"}}e+=l}this._chartContainer.append(e)},_appendPointerAndTarget:function(){var o="";var m=this.element.id+"Pointer";var f=this.element.id+"Target";var l=this.pointer.size;var k=this.target.value;var e=this.target.size;var j=k>0?0:parseInt(e);var p=this.pointer.color.length>0?"":this.toThemeProperty("jqx-fill-state-pressed");var g=this.target.color.length>0?"":this.toThemeProperty("jqx-fill-state-pressed");if(this.orientation=="horizontal"){var c=this._normaliseValue(l);var n=this._checkPercentage(l,this._chartContainer);var d=this.rtl?"right":"left";var t=(k-this._min)*this._valueToPixelsHorizontal-j;var u=t+parseInt(e)-this._chartContainer.width();if(t<0){t=0}else{if(u>0){t-=u}}var i=this._normaliseValue(e);o+="<div class='"+g+" "+this.toThemeProperty("jqx-bulletchart-target")+" "+this.toThemeProperty("jqx-bulletchart-target-horizontal")+"' id='"+f+"' style='"+d+": "+t+"px; width: "+i+"; background-color: "+this.target.color+"'></div>";o+="<div class='"+p+" "+this.toThemeProperty("jqx-bulletchart-pointer")+"' id='"+m+"' style='top: "+n+"; height: "+c+"; background-color: "+this.pointer.color+"'></div>"}else{if(this.orientation=="vertical"){var r=this._chartContainer.width();var q=this._normaliseValue(l);var s=this._checkPercentage(l,this._chartContainer);var b=(k-this._min)*this._valueToPixelsVertical-j;var u=b+parseInt(e)-this._chartContainer.height();if(b<0){b=0}else{if(u>0){b-=u}}var h=this._normaliseValue(e);o+="<div class='"+g+" "+this.toThemeProperty("jqx-bulletchart-target")+" "+this.toThemeProperty("jqx-bulletchart-target-vertical")+"' id='"+f+"' style='bottom: "+b+"px; height: "+h+"; background-color: "+this.target.color+"'></div>";o+="<div class='"+p+" "+this.toThemeProperty("jqx-bulletchart-pointer")+"' id='"+m+"' style='left: "+s+"; width: "+q+"; background-color: "+this.pointer.color+"'></div>"}}this._chartContainer.append(o)},_updatePointer:function(c,i){var h=a("#"+this.element.id+"Pointer");if(c.value>this._max){this.pointer.value=this._max}else{if(c.value<this._min){this.pointer.value=this._min}}if(c.value!=i.value){this._updateValue(c.value,i.value);if(this.showTooltip==true){this._updateTooltip()}}if(c.label!=i.label){if(this.showTooltip==true){this._updateTooltip()}}if(c.size!=i.size){var d=c.size;if(this.orientation=="horizontal"){var g=this._checkPercentage(d,this._chartContainer);var b=this._normaliseValue(d);h.css({top:g,height:b})}else{if(this.orientation=="vertical"){var f=this._checkPercentage(d,this._chartContainer);var e=this._normaliseValue(d);h.css({left:f,width:e})}}}if(c.color!=i.color){if(c.color==""){h.css("background-color","");h.addClass(this.toThemeProperty("jqx-fill-state-pressed"))}else{h.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));h.css("background-color",c.color)}}},_updateTarget:function(b,d){var e=a("#"+this.element.id+"Target");if(b.value>this._max){this.target.value=this._max}else{if(b.value<this._min){this.target.value=this._min}}if(b.value!=d.value||b.size!=d.size){var h=b.value;var k=parseInt(b.size);var c=h>0?0:k;if(this.orientation=="horizontal"){var i=this.rtl?"right":"left";var j=(h-this._min)*this._valueToPixelsHorizontal-c;var g=j+k-this._chartContainer.width();if(j<0){j=0}else{if(g>0){j-=g}}if(this.rtl==false){e.css("left",j)}else{e.css("right",j)}e.width(k)}else{if(this.orientation=="vertical"){var f=(h-this._min)*this._valueToPixelsVertical-c;var g=f+k-this._chartContainer.height();if(f<0){f=0}else{if(g>0){f-=g}}e.css({bottom:f,height:k})}}if(this.showTooltip==true){this._updateTooltip()}}if(b.label!=d.label){if(this.showTooltip==true){this._updateTooltip()}}if(b.color!=d.color){if(b.color==""){e.css("background-color","");e.addClass(this.toThemeProperty("jqx-fill-state-pressed"))}else{e.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));e.css("background-color",b.color)}}},_appendTitleAndDescription:function(){var d;if(this.orientation=="horizontal"){if(this.rtl==true){d=this.toThemeProperty("jqx-bulletchart-title-description-rtl")}else{d=this.toThemeProperty("jqx-bulletchart-title-description-ltr")}}else{d=this.toThemeProperty("jqx-bulletchart-title-description-vertical")}var g=this.rtl?"rtl":"ltr";var b="<div id='"+this.element.id+"Title' class='"+this.toThemeProperty("jqx-bulletchart-title")+" "+d+"' style='direction: "+g+";'>"+this.title+"</div><div id='"+this.element.id+"Description' class='"+this.toThemeProperty("jqx-bulletchart-description")+" "+d+"' style='direction: "+g+";'>"+this.description+"</div>";var e=a("<div style='position: absolute; visibility: hidden;'>"+b+"</div>");this._titleContainer.append(e);var h=e.children();var c=a(h[0]).height()+a(h[1]).height();e.remove();var f;if(this.orientation=="horizontal"){if(this.rtl==false){f=this.toThemeProperty("jqx-bulletchart-title-inner-container")+" "+this.toThemeProperty("jqx-bulletchart-title-inner-container-ltr")}else{f=this.toThemeProperty("jqx-bulletchart-title-inner-container")+" "+this.toThemeProperty("jqx-bulletchart-title-inner-container-rtl")}}else{f=""}this._titleContainer.append("<div class='"+f+"' style='height: "+c+"px;'>"+b+"</div>")},_appendTicksAndLabels:function(){var o=a("<div style='position: absolute; visibility: hidden;'></div>");this._chartContainer.append(o);var j="";var e=this._min<0?true:false;var b=this.ticks.size;if(this.orientation=="horizontal"){var k=this._titleContainer.width();var r=this._chartContainer.offset().top-this.host.offset().top;if(this.ticks.position=="both"||this.ticks.position=="far"){var l=this._chartContainer.height()+r}for(var h=0;h<=this._interval;h+=this.ticks.interval){var c=h*this._valueToPixelsHorizontal+k;if(h+this.ticks.interval>this._interval){c-=1}if(e){var d=(h+this._min)==0?true:false;if(d){j+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-horizontal")+" "+this.toThemeProperty("jqx-bulletchart-zero-tick")+"' style='top: "+r+"px; "+m+": "+c+"px; height: "+this._chartContainer.height()+"px;'></div>";e=false}}var n=this._labelValue(h);o.html(n);var p=c-o.width()/2;var m=this.rtl?"right":"left";if(this.ticks.position=="both"||this.ticks.position=="far"){j+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-horizontal")+"' style='top: "+l+"px; "+m+": "+c+"px; height: "+b+"px;'></div>";j+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='top: "+(l+b+2)+"px; "+m+": "+p+"px;'>"+n+"</div>"}if(this.ticks.position=="both"||this.ticks.position=="near"){j+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-horizontal")+"' style='top: "+(r-b)+"px; "+m+": "+c+"px; height: "+b+"px;'></div>";j+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='top: "+(r-(b+o.height()+2))+"px; "+m+": "+p+"px;'>"+n+"</div>"}}}else{if(this.orientation=="vertical"){var g=this._chartContainer.offset().left-this.host.offset().left;if(this.ticks.position=="both"||this.ticks.position=="far"){var q=this._chartContainer.width()}for(var h=0;h<=this._interval;h+=this.ticks.interval){var f=h*this._valueToPixelsVertical;if(h+this.ticks.interval>this._interval){f-=1}if(e){var d=(h+this._min)==0?true:false;if(d){j+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-vertical")+" "+this.toThemeProperty("jqx-bulletchart-zero-tick")+"' style='left: "+g+"px; bottom: "+f+"px; width: "+q+"px;'></div>";e=false}}if(this.ticks.position=="both"||this.ticks.position=="near"){j+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-vertical")+"' style='left: "+(g-b)+"px; bottom: "+f+"px; width: "+b+"px;'></div>";var n=this._labelValue(h,"near");o.html(n);var p=o.height()/2-1;j+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='left: "+(g-(b+o.width()+2))+"px; bottom: "+(f-p)+"px;'>"+n+"</div>"}if(this.ticks.position=="both"||this.ticks.position=="far"){j+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-vertical")+"' style='left: "+(q+g)+"px; bottom: "+f+"px; width: "+b+"px;'></div>";var n=this._labelValue(h,"far");o.html(n);var p=o.height()/2-1;j+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='left: "+(q+g+b+2)+"px; bottom: "+(f-p)+"px;'>"+n+"</div>"}}}}this.host.append(j);o.remove()},_labelValue:function(d,b){var e=d+this._min;var c;if(this.labelsFormatFunction){c=this.labelsFormatFunction(e,b)}else{c=a.jqx.dataFormat.formatnumber(e,this.labelsFormat)}return c},_initializeTooltip:function(){var c=this;var d=this._tooltipContent();this.host.jqxTooltip({theme:this.theme,position:"mouse",content:d,trigger:"none",autoHide:false,rtl:this.rtl});this.host.jqxTooltip("getInstance").val=a.proxy(this.val,this);var b=a("#"+this.element.id+"Pointer, #"+this.element.id+"Target");this.addHandler(b,"mouseenter.bulletchart"+this.element.id,function(e){if(c.disabled==false){c.host.jqxTooltip("open",e.pageX,e.pageY);if(e.target.id==c.element.id+"Pointer"&&c.pointer.color==""||e.target.id==c.element.id+"Target"&&c.target.color==""){a(e.target).removeClass(c.toThemeProperty("jqx-fill-state-pressed"));a(e.target).addClass(c.toThemeProperty("jqx-fill-state-hover"))}}});this.addHandler(b,"mouseleave.bulletchart"+this.element.id,function(e){if(c.disabled==false){c.host.jqxTooltip("close");if(e.target.id==c.element.id+"Pointer"&&c.pointer.color==""||e.target.id==c.element.id+"Target"&&c.target.color==""){a(e.target).removeClass(c.toThemeProperty("jqx-fill-state-hover"));a(e.target).addClass(c.toThemeProperty("jqx-fill-state-pressed"))}}})},_updateTooltip:function(){this.host.jqxTooltip({content:this._tooltipContent()})},_tooltipContent:function(){var c;if(this.tooltipFormatFunction){c=this.tooltipFormatFunction(this.pointer.value,this.target.value)}else{var b=a.jqx.dataFormat.formatnumber(this.pointer.value,this.labelsFormat);var d=a.jqx.dataFormat.formatnumber(this.target.value,this.labelsFormat);c="<div>"+this.pointer.label+": "+b+"</div><div>"+this.target.label+": "+d+"</div>"}return c},_updateValue:function(m,d,k){var j=this;var c=a("#"+this.element.id+"Pointer");var g,h,l,n;var f=function(p,r,q){if(j._min>=0){if(p=="vertical"){c.css("bottom",0)}else{if(j.rtl==true&&p=="horizontal"){c.css("right",0)}}g=(m-j._min)*r}else{if(m>=0){if(p=="horizontal"){if(j.rtl==true){h="right";l="left"}else{h="left"}}else{if(p=="vertical"){h="bottom";l="top"}}var o=-j._min*r}else{if(p=="horizontal"){if(j.rtl==true){h="left"}else{h="right";l="left"}}else{if(p=="vertical"){h="top"}}var o=q+j._min*r}c.css(h,o);if(l){c.css(l,"")}if(m*d<0){if(p=="horizontal"){c.width(0)}else{if(p=="vertical"){c.height(0)}}}g=Math.abs(m*r)}return g};var i=function(){if(!k){j._raiseEvent("0")}};if(this.orientation=="horizontal"){var e=f("horizontal",this._valueToPixelsHorizontal,this._chartContainer.width());setTimeout(function(){c.animate({width:e},j.animationDuration,i)},0)}else{if(this.orientation=="vertical"){var b=f("vertical",this._valueToPixelsVertical,this._chartContainer.height());setTimeout(function(){c.animate({height:b},j.animationDuration,i)},0)}}},_checkPercentage:function(f,d){var c=-1;if(f.indexOf){c=f.indexOf("%")}var g=function(h){if(!f.indexOf||f.indexOf("px")==-1){return h}else{return parseFloat(h.slice(0,f.indexOf("px")))}};var e=function(h){return parseFloat(h.slice(0,c))};if(c==-1){var b;if(this.orientation=="horizontal"){b=d.height()}else{if(this.orientation=="vertical"){b=d.width()}}return((b-g(f))/2)+"px"}else{return((100-e(f))/2)+"%"}},_normaliseValue:function(b){if(!b.indexOf||(b.indexOf("px")==-1&&b.indexOf("%")==-1)){return b+"px"}else{return b}}})})(jqxBaseFramework);
\ No newline at end of file
+*/
+!function(a){a.jqx.jqxWidget("jqxBulletChart","",{}),a.extend(a.jqx._jqxBulletChart.prototype,{defineInstance:function(){var b={width:500,height:100,barSize:"50%",ranges:[{startValue:0,endValue:50,color:"#000000",opacity:.7},{startValue:50,endValue:80,color:"#000000",opacity:.5},{startValue:80,endValue:100,color:"#000000",opacity:.3}],pointer:{value:65,label:"Value",size:"25%",color:""},target:{value:85,label:"Target",size:4,color:""},ticks:{position:"far",interval:20,size:10},title:"Title",description:"Description",orientation:"horizontal",labelsFormat:null,labelsFormatFunction:null,animationDuration:400,showTooltip:!0,tooltipFormatFunction:null,disabled:!1,rtl:!1,events:["change"]};return this===a.jqx._jqxBulletChart.prototype?b:(a.extend(!0,this,b),b)},createInstance:function(b){if(!a.jqx.dataAdapter)throw new Error("jqxBulletChart: Missing reference to the following module: 'jqxdata.js'.");this._setDefaultValues(),this.render();var c=this;a.jqx.utilities.resize(this.host,function(){c._timer&&clearTimeout(c._timer),c._timer=setTimeout(function(){var a=c.animationDuration;c.animationDuration=0,c.render(),setTimeout(function(){c.animationDuration=a},0)},10)},!1,!0)},render:function(){this.host.children().length>0&&(this._removeHandlers(),1==this.showTooltip&&this.host.jqxTooltip("destroy"),this.host.empty()),this.host.addClass(this.toThemeProperty("jqx-widget")),this.host.addClass(this.toThemeProperty("jqx-bulletchart")),this.host.width(this.width),this.host.height(this.height);var b,c=this.host.width(),d=this.host.height(),e=this.rtl?"rtl":"ltr";"horizontal"==this.orientation?b=a("<div style='position: absolute; visibility: hidden; padding: 5px;'><div class='"+this.toThemeProperty("jqx-bulletchart-title")+"' style='direction: "+e+";'>"+this.title+"</div><div class='"+this.toThemeProperty("jqx-bulletchart-description")+"' style='direction: "+e+";'>"+this.description+"</div></div>"):"vertical"==this.orientation&&(b=a("<div style='position: absolute; visibility: hidden; padding-bottom: 15px;'><div class='"+this.toThemeProperty("jqx-bulletchart-title")+"' style='width: "+c+"px; direction: "+e+";'>"+this.title+"</div><div class='"+this.toThemeProperty("jqx-bulletchart-description")+"' style='direction: "+e+";'>"+this.description+"</div></div>")),this.host.append(b);var f=b.outerWidth(),g=b.outerHeight();b.remove();var h,i,j,k,l,m,n,o;if("horizontal"==this.orientation){if(h="jqx-bulletchart-title-container-horizontal",i="jqx-bulletchart-chart-container-horizontal",j=this._checkPercentage(this.barSize,this.host),k=f,l=this.barSize,m=0,n=c-k,o=l,this.width&&this.width.toString().indexOf("%")>=0){var n=parseFloat(parseFloat(100*n)/c).toString()+"%",k=parseFloat(parseFloat(100*k)/c).toString()+"%";this._percentageWidth=!0}}else"vertical"==this.orientation&&(h="jqx-bulletchart-title-container-vertical",i="jqx-bulletchart-chart-container-vertical",j=0,k="100%",l=g,m=this._checkPercentage(this.barSize,this.host),n=this.barSize,o=d-l);if((0==this.rtl||1==this.rtl&&"vertical"==this.orientation)&&this.host.append("<div id='"+this.element.id+"titleContainer' class='"+h+"' style='top: "+j+";'></div>"),this.host.append("<div id='"+this.element.id+"ChartContainer' class='"+i+"' style='top: "+j+"; left: "+m+";'></div>"),1==this.rtl&&"horizontal"==this.orientation&&this.host.append("<div id='"+this.element.id+"titleContainer' class='"+h+"' style='top: "+j+";'></div>"),this._titleContainer=a("#"+this.element.id+"titleContainer"),this._chartContainer=a("#"+this.element.id+"ChartContainer"),this._titleContainer.css({width:k,height:l}),this._chartContainer.css({width:n,height:o}),this._min=this.ranges[0].startValue,this._max=this.ranges[this.ranges.length-1].endValue,this._interval=this._max-this._min,this._valueToPixelsHorizontal=this._chartContainer.width()/this._interval,this._valueToPixelsVertical=this._chartContainer.height()/this._interval,this._checkValues(),this._appendRanges(),this._appendPointerAndTarget(),this._appendTitleAndDescription(),"none"!=this.ticks.position&&this._appendTicksAndLabels(),1==this.disabled&&this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled")),1==this.showTooltip){if(void 0==this.host.jqxTooltip)throw new Error("jqxBulletChart: Missing reference to the following module: 'jqxtooltip.js'.");this._initializeTooltip(),this.host.data().jqxWidget=this}this._updateValue(this.pointer.value,0,!0)},refresh:function(a){a||this.render()},val:function(a){return 0==arguments.length||null!=a&&"object"==typeof a?this.pointer.value:(a>this._max?a=this._max:a<this._min&&(a=this._min),void(a!=this.pointer.value&&(this._updateValue(a,this.pointer.value),this.pointer.value=a,1==this.showTooltip&&this._updateTooltip())))},destroy:function(){a.jqx.utilities.resize(this.host,null,!0),this._removeHandlers(),1==this.showTooltip&&this.host.jqxTooltip("destroy"),this.host.remove()},propertyChangedHandler:function(b,c,d,e){if(d!=e||e instanceof Object){var f=!0,g=function(){a.each(d,function(a,d){void 0==e[a]&&(b[c][a]=d)})};switch(c){case"barSize":break;case"ranges":a.each(d,function(d,f){a.each(f,function(a,f){void 0!==e[d]&&void 0==e[d][a]&&(b[c][d][a]=f)})}),this._setDefaultValues();break;case"pointer":return g(),void this._updatePointer(e,d);case"target":return g(),void this._updateTarget(e,d);case"ticks":f=!1,g(),a.each(d,function(a,e){d[a]!=b[c][a]&&(f=!0)});break;case"showTooltip":if(1==e){if(void 0==this.host.jqxTooltip)throw new Error("jqxBulletChart: Missing reference to the following module: 'jqxtooltip.js'.");this._initializeTooltip()}else this._removeHandlers(),this.host.jqxTooltip("destroy");break;case"animationDuration":return;case"tooltipFormatFunction":return void this._updateTooltip();case"disabled":return void(1==e?this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled")):this.host.removeClass(this.toThemeProperty("jqx-fill-state-disabled")))}1==f&&this.render()}},_raiseEvent:function(b,c){var d=this.events[b],e=new a.Event(d);e.owner=this,e.args=c;try{var f=this.host.trigger(e)}catch(a){}return f},_removeHandlers:function(){var b=a("#"+this.element.id+"Pointer, #"+this.element.id+"Target");this.removeHandler(b,"mouseenter.bulletchart"+this.element.id),this.removeHandler(b,"mouseleave.bulletchart"+this.element.id)},_setDefaultValues:function(){for(var a=this.ranges,b=this.ranges.length,c=0;c<b;c++){if(void 0==a[c].startValue||void 0==a[c].endValue)throw new Error("jqxBulletChart: Each range must have its startValue and endValue set.");void 0==a[c].color&&(this.ranges[c].color="#000000"),void 0==a[c].opacity&&(this.ranges[c].opacity=1-1/b*c)}var d=this.pointer;void 0==d.value&&(this.pointer.value=65),void 0==d.label&&(this.pointer.label="Value"),void 0==d.size&&(this.pointer.size="25%"),void 0==d.color&&(this.pointer.color="");var e=this.target;void 0==e.value&&(this.target.value=85),void 0==e.label&&(this.target.label="Target"),void 0==e.size&&(this.target.size=5),void 0==e.color&&(this.target.color="");var f=this.ticks;void 0==f.position&&(this.ticks.position="near"),void 0==f.interval&&(this.ticks.interval=20),void 0==f.size&&(this.ticks.size=10)},_checkValues:function(){this.pointer.value>this._max?this.pointer.value=this._max:this.pointer.value<this._min&&(this.pointer.value=this._min),this.target.value>this._max?this.target.value=this._max:this.target.value<this._min&&(this.target.value=this._min)},_appendRanges:function(){for(var a="",b=this.ranges.length,c=0;c<b;c++){var d,e=this.ranges[c];if("horizontal"==this.orientation){var f=this.rtl?"right":"left",g=(e.startValue-this._min)*this._valueToPixelsHorizontal,h=(e.endValue-e.startValue)*this._valueToPixelsHorizontal;d="<div class='"+this.toThemeProperty("jqx-bulletchart-range")+" "+this.toThemeProperty("jqx-bulletchart-range-horizontal")+"' style='"+f+": "+g+"px; width: "+h+"px; background-color: "+e.color+"; opacity: "+e.opacity+"'></div>"}else if("vertical"==this.orientation){var i=(e.startValue-this._min)*this._valueToPixelsVertical,j=(e.endValue-e.startValue)*this._valueToPixelsVertical;d="<div class='"+this.toThemeProperty("jqx-bulletchart-range")+" "+this.toThemeProperty("jqx-bulletchart-range-vertical")+"' style='bottom: "+i+"px; height: "+j+"px; background-color: "+e.color+"; opacity: "+e.opacity+"'></div>"}a+=d}this._chartContainer.append(a)},_appendPointerAndTarget:function(){var a="",b=this.element.id+"Pointer",c=this.element.id+"Target",d=this.pointer.size,e=this.target.value,f=this.target.size,g=e>0?0:parseInt(f),h=this.pointer.color.length>0?"":this.toThemeProperty("jqx-fill-state-pressed"),i=this.target.color.length>0?"":this.toThemeProperty("jqx-fill-state-pressed");if("horizontal"==this.orientation){var j=this._normaliseValue(d),k=this._checkPercentage(d,this._chartContainer),l=this.rtl?"right":"left",m=(e-this._min)*this._valueToPixelsHorizontal-g,n=m+parseInt(f)-this._chartContainer.width();m<0?m=0:n>0&&(m-=n);var o=this._normaliseValue(f);a+="<div class='"+i+" "+this.toThemeProperty("jqx-bulletchart-target")+" "+this.toThemeProperty("jqx-bulletchart-target-horizontal")+"' id='"+c+"' style='"+l+": "+m+"px; width: "+o+"; background-color: "+this.target.color+"'></div>",a+="<div class='"+h+" "+this.toThemeProperty("jqx-bulletchart-pointer")+"' id='"+b+"' style='top: "+k+"; height: "+j+"; background-color: "+this.pointer.color+"'></div>"}else if("vertical"==this.orientation){var p=(this._chartContainer.width(),this._normaliseValue(d)),q=this._checkPercentage(d,this._chartContainer),r=(e-this._min)*this._valueToPixelsVertical-g,n=r+parseInt(f)-this._chartContainer.height();r<0?r=0:n>0&&(r-=n);var s=this._normaliseValue(f);a+="<div class='"+i+" "+this.toThemeProperty("jqx-bulletchart-target")+" "+this.toThemeProperty("jqx-bulletchart-target-vertical")+"' id='"+c+"' style='bottom: "+r+"px; height: "+s+"; background-color: "+this.target.color+"'></div>",a+="<div class='"+h+" "+this.toThemeProperty("jqx-bulletchart-pointer")+"' id='"+b+"' style='left: "+q+"; width: "+p+"; background-color: "+this.pointer.color+"'></div>"}this._chartContainer.append(a)},_updatePointer:function(b,c){var d=a("#"+this.element.id+"Pointer");if(b.value>this._max?this.pointer.value=this._max:b.value<this._min&&(this.pointer.value=this._min),b.value!=c.value&&(this._updateValue(b.value,c.value),1==this.showTooltip&&this._updateTooltip()),b.label!=c.label&&1==this.showTooltip&&this._updateTooltip(),b.size!=c.size){var e=b.size;if("horizontal"==this.orientation){var f=this._checkPercentage(e,this._chartContainer),g=this._normaliseValue(e);d.css({top:f,height:g})}else if("vertical"==this.orientation){var h=this._checkPercentage(e,this._chartContainer),i=this._normaliseValue(e);d.css({left:h,width:i})}}b.color!=c.color&&(""==b.color?(d.css("background-color",""),d.addClass(this.toThemeProperty("jqx-fill-state-pressed"))):(d.removeClass(this.toThemeProperty("jqx-fill-state-pressed")),d.css("background-color",b.color)))},_updateTarget:function(b,c){var d=a("#"+this.element.id+"Target");if(b.value>this._max?this.target.value=this._max:b.value<this._min&&(this.target.value=this._min),b.value!=c.value||b.size!=c.size){var e=b.value,f=parseInt(b.size),g=e>0?0:f;if("horizontal"==this.orientation){var h=(this.rtl?"right":"left",(e-this._min)*this._valueToPixelsHorizontal-g),i=h+f-this._chartContainer.width();h<0?h=0:i>0&&(h-=i),0==this.rtl?d.css("left",h):d.css("right",h),d.width(f)}else if("vertical"==this.orientation){var j=(e-this._min)*this._valueToPixelsVertical-g,i=j+f-this._chartContainer.height();j<0?j=0:i>0&&(j-=i),d.css({bottom:j,height:f})}1==this.showTooltip&&this._updateTooltip()}b.label!=c.label&&1==this.showTooltip&&this._updateTooltip(),b.color!=c.color&&(""==b.color?(d.css("background-color",""),d.addClass(this.toThemeProperty("jqx-fill-state-pressed"))):(d.removeClass(this.toThemeProperty("jqx-fill-state-pressed")),d.css("background-color",b.color)))},_appendTitleAndDescription:function(){var b;b="horizontal"==this.orientation?1==this.rtl?this.toThemeProperty("jqx-bulletchart-title-description-rtl"):this.toThemeProperty("jqx-bulletchart-title-description-ltr"):this.toThemeProperty("jqx-bulletchart-title-description-vertical");var c=this.rtl?"rtl":"ltr",d="<div id='"+this.element.id+"Title' class='"+this.toThemeProperty("jqx-bulletchart-title")+" "+b+"' style='direction: "+c+";'>"+this.title+"</div><div id='"+this.element.id+"Description' class='"+this.toThemeProperty("jqx-bulletchart-description")+" "+b+"' style='direction: "+c+";'>"+this.description+"</div>",e=a("<div style='position: absolute; visibility: hidden;'>"+d+"</div>");this._titleContainer.append(e);var f=e.children(),g=a(f[0]).height()+a(f[1]).height();e.remove();var h;h="horizontal"==this.orientation?0==this.rtl?this.toThemeProperty("jqx-bulletchart-title-inner-container")+" "+this.toThemeProperty("jqx-bulletchart-title-inner-container-ltr"):this.toThemeProperty("jqx-bulletchart-title-inner-container")+" "+this.toThemeProperty("jqx-bulletchart-title-inner-container-rtl"):"",this._titleContainer.append("<div class='"+h+"' style='height: "+g+"px;'>"+d+"</div>")},_appendTicksAndLabels:function(){var b=a("<div style='position: absolute; visibility: hidden;'></div>");this._chartContainer.append(b);var c="",d=this._min<0,e=this.ticks.size;if("horizontal"==this.orientation){var f=this._titleContainer.width(),g=this._chartContainer.offset().top-this.host.offset().top;if("both"==this.ticks.position||"far"==this.ticks.position)var h=this._chartContainer.height()+g;for(var i=0;i<=this._interval;i+=this.ticks.interval){var j=i*this._valueToPixelsHorizontal+f;if(i+this.ticks.interval>this._interval&&(j-=1),d){var k=i+this._min==0;k&&(c+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-horizontal")+" "+this.toThemeProperty("jqx-bulletchart-zero-tick")+"' style='top: "+g+"px; "+n+": "+j+"px; height: "+this._chartContainer.height()+"px;'></div>",d=!1)}var l=this._labelValue(i);b.html(l);var m=j-b.width()/2,n=this.rtl?"right":"left";"both"!=this.ticks.position&&"far"!=this.ticks.position||(c+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-horizontal")+"' style='top: "+h+"px; "+n+": "+j+"px; height: "+e+"px;'></div>",c+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='top: "+(h+e+2)+"px; "+n+": "+m+"px;'>"+l+"</div>"),"both"!=this.ticks.position&&"near"!=this.ticks.position||(c+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-horizontal")+"' style='top: "+(g-e)+"px; "+n+": "+j+"px; height: "+e+"px;'></div>",c+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='top: "+(g-(e+b.height()+2))+"px; "+n+": "+m+"px;'>"+l+"</div>")}}else if("vertical"==this.orientation){var o=this._chartContainer.offset().left-this.host.offset().left;if("both"==this.ticks.position||"far"==this.ticks.position)var p=this._chartContainer.width();for(var i=0;i<=this._interval;i+=this.ticks.interval){var q=i*this._valueToPixelsVertical;if(i+this.ticks.interval>this._interval&&(q-=1),d){var k=i+this._min==0;k&&(c+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-vertical")+" "+this.toThemeProperty("jqx-bulletchart-zero-tick")+"' style='left: "+o+"px; bottom: "+q+"px; width: "+p+"px;'></div>",d=!1)}if("both"==this.ticks.position||"near"==this.ticks.position){c+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-vertical")+"' style='left: "+(o-e)+"px; bottom: "+q+"px; width: "+e+"px;'></div>";var l=this._labelValue(i,"near");b.html(l);var m=b.height()/2-1;c+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='left: "+(o-(e+b.width()+2))+"px; bottom: "+(q-m)+"px;'>"+l+"</div>"}if("both"==this.ticks.position||"far"==this.ticks.position){c+="<div class='"+this.toThemeProperty("jqx-bulletchart-ticks")+" "+this.toThemeProperty("jqx-bulletchart-ticks-vertical")+"' style='left: "+(p+o)+"px; bottom: "+q+"px; width: "+e+"px;'></div>";var l=this._labelValue(i,"far");b.html(l);var m=b.height()/2-1;c+="<div class='"+this.toThemeProperty("jqx-bulletchart-labels")+"' style='left: "+(p+o+e+2)+"px; bottom: "+(q-m)+"px;'>"+l+"</div>"}}}this.host.append(c),b.remove()},_labelValue:function(b,c){var d,e=b+this._min;return d=this.labelsFormatFunction?this.labelsFormatFunction(e,c):a.jqx.dataFormat.formatnumber(e,this.labelsFormat)},_initializeTooltip:function(){var b=this,c=this._tooltipContent();this.host.jqxTooltip({theme:this.theme,position:"mouse",content:c,trigger:"none",autoHide:!1,rtl:this.rtl}),this.host.jqxTooltip("getInstance").val=a.proxy(this.val,this);var d=a("#"+this.element.id+"Pointer, #"+this.element.id+"Target");this.addHandler(d,"mouseenter.bulletchart"+this.element.id,function(c){0==b.disabled&&(b.host.jqxTooltip("open",c.pageX,c.pageY),(c.target.id==b.element.id+"Pointer"&&""==b.pointer.color||c.target.id==b.element.id+"Target"&&""==b.target.color)&&(a(c.target).removeClass(b.toThemeProperty("jqx-fill-state-pressed")),a(c.target).addClass(b.toThemeProperty("jqx-fill-state-hover"))))}),this.addHandler(d,"mouseleave.bulletchart"+this.element.id,function(c){0==b.disabled&&(b.host.jqxTooltip("close"),(c.target.id==b.element.id+"Pointer"&&""==b.pointer.color||c.target.id==b.element.id+"Target"&&""==b.target.color)&&(a(c.target).removeClass(b.toThemeProperty("jqx-fill-state-hover")),a(c.target).addClass(b.toThemeProperty("jqx-fill-state-pressed"))))})},_updateTooltip:function(){this.host.jqxTooltip({content:this._tooltipContent()})},_tooltipContent:function(){var b;if(this.tooltipFormatFunction)b=this.tooltipFormatFunction(this.pointer.value,this.target.value);else{var c=a.jqx.dataFormat.formatnumber(this.pointer.value,this.labelsFormat),d=a.jqx.dataFormat.formatnumber(this.target.value,this.labelsFormat);b="<div>"+this.pointer.label+": "+c+"</div><div>"+this.target.label+": "+d+"</div>"}return b},_updateValue:function(b,c,d){var e,f,g,h=this,i=a("#"+this.element.id+"Pointer"),j=function(a,d,j){if(h._min>=0)"vertical"==a?i.css("bottom",0):1==h.rtl&&"horizontal"==a&&i.css("right",0),e=(b-h._min)*d;else{if(b>=0){"horizontal"==a?1==h.rtl?(f="right",g="left"):f="left":"vertical"==a&&(f="bottom",g="top");var k=-h._min*d}else{"horizontal"==a?1==h.rtl?f="left":(f="right",g="left"):"vertical"==a&&(f="top");var k=j+h._min*d}i.css(f,k),g&&i.css(g,""),b*c<0&&("horizontal"==a?i.width(0):"vertical"==a&&i.height(0)),e=Math.abs(b*d)}return e},k=function(){d||h._raiseEvent("0")};if("horizontal"==this.orientation){var l=j("horizontal",this._valueToPixelsHorizontal,this._chartContainer.width());setTimeout(function(){i.animate({width:l},h.animationDuration,k)},0)}else if("vertical"==this.orientation){var m=j("vertical",this._valueToPixelsVertical,this._chartContainer.height());setTimeout(function(){i.animate({height:m},h.animationDuration,k)},0)}},_checkPercentage:function(a,b){var c=-1;a.indexOf&&(c=a.indexOf("%"));var d=function(b){return a.indexOf&&a.indexOf("px")!=-1?parseFloat(b.slice(0,a.indexOf("px"))):b},e=function(a){return parseFloat(a.slice(0,c))};if(c==-1){var f;return"horizontal"==this.orientation?f=b.height():"vertical"==this.orientation&&(f=b.width()),(f-d(a))/2+"px"}return(100-e(a))/2+"%"},_normaliseValue:function(a){return!a.indexOf||a.indexOf("px")==-1&&a.indexOf("%")==-1?a+"px":a}})}(jqxBaseFramework);
+

mercurial