 /* 取得核心元件檔案：/DJJSLib/CanvasChartSVC/extend/ListView/ListView.min.js */ 
(function(f,m){if(!window.MbChart||!window.MbChart.ListView){window.MbChart.ListView=function(a){var b=d.get$s(a),c=b.attr("id"),e=d.ViewCache;if(b.length){if(c&&e[c]&&!e[c].isDestroy){if(e[c]._$s[0]==b[0])return e[c];e[c].destroy()}a=d.Cls.Act(a);c&&(e[c]=a);return a}};var d={Cls:{},ViewCache:{},factory:function(a,b){var c=function(){a.apply(this,b)};c.prototype=a.prototype;return new c},ns:function(a,b){var c=d.Cls[a]=function(){if(!(this instanceof c))return d.factory(c,arguments);f.isFunction(this._init)&&
this._init.apply(this,arguments)};c.prototype=b},isStr:function(a){return"string"==typeof a},isAry:function(a){return f.isArray(a)},get$s:function(a){return"object"==typeof a&&a.jquery?a:f(a)},createObj:function(a){if(Object.create)return Object.create(a);var b=function(){};b.prototype=a;return new b},applyIf:function(){var a=Array.prototype.slice.apply(arguments),b=d.createObj(a[0]),c=1,e;if(2>a.length)return b;for(;c<a.length;c++)for(e in a[c])b[e]===m&&(b[e]=a[c][e]);return b},resizeMgr:{_isInit:!1,
_fnObj:{},_timer:null,_delay:100,_resizeEvent:function(a){var b=d.resizeMgr;clearTimeout(b._timer);b._timer=setTimeout(function(){for(var c in b._fnObj){var e=b._fnObj[c];e.fn.apply(e.caller,[a])}},b._delay)},_init:function(){d.resizeMgr._isInit||(MbChartSetting&&MbChartSetting.s_autoResize&&f(window).resize(d.resizeMgr._resizeEvent),d.resizeMgr._isInit=!0)},reg:function(a,b,c){a&&c&&(d.resizeMgr._fnObj[a]={caller:b,fn:c});d.resizeMgr._init()},unreg:function(a){d.resizeMgr._fnObj[a]&&delete d.resizeMgr._fnObj[a]}},
sn:0};d.ns("UI",{_$s:null,_sn:0,_viewList:null,_paramList:null,_T:null,_data:null,_currentIndex:-1,_drawReady:null,_drawNum:0,_isDestroy:0,_isAutoGap:1,_isAutoH:0,_isDate:1,_init:function(a,b){var c=this;c._$s=d.get$s(a);d.sn++;c._sn=d.sn;c._isAutoH=MbChartSetting&&MbChartSetting.s_fulHeight;d.resizeMgr.reg(d.sn,c,function(a){c.resize()})},_fmtLabels:function(a){var b=1,c=1,e=1,k=f.map(a,function(a){return+a}),d,h,g=[];f.each(k,function(a,k){if(isNaN(k)||!b)return b=0,!1;h=k%100;d=Math.floor(k/100);
g.push([d,10>h?"0"+h:h]);if(24<d||59<h)c=0;if(12<d||31<h)e=0;c||e||(b=0)});return b&&e?f.map(g,function(a){return a.join("/")}):b&&c?f.map(g,function(a){return a.join(":")}):a},_evt_move:function(a,b,c){this._currentIndex=a;f.each(this._viewList,function(b,c){c.moveTip(a)})},_viewDestroy:function(){this._viewList&&f.each(this._viewList,function(a,b){b.destroy()})},_pnH:null,_viewResize:function(a){var b=parseInt,c=this._isAutoH,e=this._$s.height(),d=this._pnH[a];this._pnH&&c&&(d&&0<d.toString().indexOf("%"))&&
(d=e*b(d)/100,a=this._$s.find(".FundView:eq("+a+")"),b=a.height(),d!=b&&a.css("height",d+"px"))},_viewCreate:function(a){var b=0,c=[],e=this._isAutoH,d=this._$s.height(),f=this._paramList;this._viewDestroy();for(this._pnH={};b<a;b++){var h=f&&f[b]?f[b]:{},g=h.HEIGHT;(this._pnH[b]=g)&&0<g.toString().indexOf("%")&&(g=d*parseInt(g,10)/100);c.push("<div ");c.push('name="v'+b);c.push('" style="');h.WIDTH&&c.push("width:"+h.WIDTH+"px;");e?g&&c.push("height:"+g+"px;"):g&&c.push("min-height:"+g+"px;");h.HEIGHT=
"";c.push('" class="FundView">');c.push("</div>")}this._$s.html(c.join(""));this._viewList=[];for(b=0;b<a;b++)c=this._$s.find('[name="v'+b+'"]'),c=MbChart.FlashView(c),this._viewList.push(c)},isAutoGap:function(a){this._isAutoGap=a},setParams:function(a){var b={Type:"Trend",LegendPos:"bottom",CtrlPos:"none",YLabelPos:"none",StopAutoDraw:1};a=f.map(a,function(a){return d.applyIf(a,b)});for(var c=a.length,e=0;e<c-1;e++)a[e].XX=1,a[e].Bottom=3;e=a[c-1];e.CtrlPos="bottom";"string"==e.DATATYPE&&(this._isDate=
0);this._paramList=a;this._viewCreate(c)},setBCD:function(a,b){var c=this;c._T=c._isDate?c._fmtLabels(a.split(",")):a.split(",");f.each(c._T,function(a,b){c._T[a]=f.trim(b).replace(/\s/g,"%s")});c._data=b.slice()},poster:function(a,b,c){if(this._viewList&&this._viewList.length)if(b===m)this._viewDestroy(),this._viewCreate(1),this._viewList[0].poster(a,c);else{if(!b||0>b)b=0;this._viewList[b].poster(a,c)}else this._viewCreate(1),this._viewList[0].poster(a,c);this._drawReady&&this._drawReady()},draw:function(){var a=
this,b,c=0,e=0,d,l=!1;a._drawNum=0;a._data&&(f.each(a._viewList,function(h,g){g.setParams(a._paramList[h]);b=[];b.push(a._T.join(","));f.each(a._data[h],function(a,c){b.push(c)});g.setBCD(b.join(" "));d=g.getViewLnR();d[0]>c&&(c=d[0]);d[1]>e&&(e=d[1]);l||(l=g.hasGap())}),f.each(a._viewList,function(b,d){l&&a._isAutoGap&&d.autoGap();d.setViewLnR(c,e);d.draw();d.tipMoveCall(function(b,c,d){a._evt_move.apply(a,arguments)});d.setDrawCall(function(){a._drawNum++;a._drawNum>=a._viewList.length&&a._drawReady&&
a._drawReady()})}))},setLegendCall:function(a,b){!this._viewList||a>this._viewList.length-1||f.isFunction(b)&&this._viewList[a].setLegendCall(b)},setDrawCall:function(a){f.isFunction(a)&&(this._drawReady=a)},repaint:function(){f.each(this._viewList,function(a,b){b.repaint()})},resize:function(){var a=this;f.each(a._viewList,function(b,c){a._viewResize(b);c.resize()})},destroy:function(){this._isDestroy=1;d.resizeMgr.unreg(this._sn);this._viewList&&f.each(this._viewList,function(a,b){b.destroy()});
this._$s=this._drawReady=this._data=this._T=this._paramList=this._viewList=null}});d.ns("Act",{_$s:null,_ui:null,_params:null,_init:function(a){this._$s=d.get$s(a);this._ui=d.Cls.UI(a)},_fmtParams:function(a){var b={};f.each(a,function(a,e){b[a.toString().toUpperCase()]=d.isStr(e)?f.trim(e):e});return b},_safeAry:function(a,b){b||(b=" ");return d.isAry(a)?a:d.isStr(a)?f.trim(a).split(b):[a]},setParams:function(a){var b=this,c=b._fmtParams(a),e=[],k=c.TYPE,l;b._params=a;k&&(k=b._safeAry(k),f.each(k,
function(a,c){e.push({Type:b._safeAry(c)})}));f.each(c,function(a,c){switch(a){case "TYPE":break;case "POS_CTRL":case "CTRLPOS":"string"==typeof c&&(c=c.toLowerCase()),"top"==c?c=[c,"none","none"]:"bottom"==c&&(c=["none","none",c]);default:if(l=d.isAry(c))c=b._safeAry(c);f.each(e,function(b,d){d[a]=l?c[b]:c})}});c.NOTAUTOGAP?b._ui.isAutoGap(!1):b._ui.isAutoGap(!0);b._ui.setParams(e)},getParams:function(){return this._params},getElm:function(){return this._$s&&this._$s.length?this._$s[0]:null},modifyParams:function(){var a=
this,b=Array.prototype.slice.apply(arguments),c=0;a._params&&(2==b.length?(a._params[b[0]]=b[1],c=1):"object"!=typeof b[0]||b[0].length||f.each(b[0],function(b,d){c=1;a._params[b]=d}),c&&(a.setParams(a._params),a.draw()))},setBCD:function(a,b){b=this._safeAry(b);var c=[];f.each(b,function(a,b){c.push([]);f.each(b,function(b,d){c[a].push(d)})});this._ui.setBCD(a,c);this.draw()},setLegendCall:function(a,b){this._ui.setLegendCall(a,b)},setDrawCall:function(a){this._ui.setDrawCall(a)},resize:function(){this._ui.resize()},
repaint:function(){this._ui.repaint()},poster:function(a,b,c){this._ui.poster(a,b,c)},draw:function(){this._ui.draw()},isDestroy:!1,destroy:function(){this._ui.destroy();this._$s=this._ui=null;this.isDestroy=!0}})}})(jQuery);