10 lines
9.6 KiB
JavaScript
10 lines
9.6 KiB
JavaScript
/*
|
|
* Kendo UI Complete v2013.3.1119 (http://kendoui.com)
|
|
* Copyright 2013 Telerik AD. All rights reserved.
|
|
*
|
|
* Kendo UI Complete commercial licenses may be obtained at
|
|
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
|
|
* If you do not own a commercial license, this file shall be governed by the trial license terms.
|
|
*/
|
|
!function(define){return define(["./kendo.dataviz.chart.min"],function(){!function(t){function e(){}function i(t){return e.prototype=t,new e}var a,o=window.kendo,n=o.Class,s=o.Observable,r=o.deepExtend,l=Math,c=t.proxy,d=o.dataviz,p=d.defined,u=d.filterSeriesByType,f=o.template,h=d.ui.Chart,m=d.Selection,v=d.addDuration,g=d.last,_=d.limitValue,x=d.lteDateIndex,b=d.renderTemplate,S=d.toDate,y=d.toTime,w=28,A="change",D="k-",T="drag",C="dragEnd",E="_navigator",k=E,U=d.EQUALLY_SPACED_SERIES,B=3,F="zoom",z="zoomEnd",j=h.extend({init:function(e,i){t(e).addClass(D+"chart"),h.fn.init.call(this,e,i)},_applyDefaults:function(t,e){var i=this,a=i.element.width()||d.DEFAULT_WIDTH,o={seriesDefaults:{categoryField:t.dateField},axisDefaults:{categoryAxis:{name:"default",majorGridLines:{visible:!1},labels:{step:2},majorTicks:{visible:!1},maxDateGroups:l.floor(a/w)}}};e&&(e=r({},e,o)),i._navigator||H.setup(t,e),h.fn._applyDefaults.call(i,t,e)},_initDataSource:function(t){var e,i,a=t||{},o=a.dataSource,n=o&&o.serverFiltering,s=[].concat(a.categoryAxis)[0],l=a.navigator||{},c=l.select,p=c&&c.from&&c.to;n&&p&&(e=[].concat(o.filter||[]),i=new d.DateCategoryAxis(r({baseUnit:"fit"},s,{categories:[c.from,c.to]})),o.filter=H.buildFilter(i.range().min,c.to).concat(e)),h.fn._initDataSource.call(this,t)},options:{name:"StockChart",dateField:"date",axisDefaults:{categoryAxis:{type:"date",baseUnit:"fit",justified:!0},valueAxis:{narrowRange:!0,labels:{format:"C"}}},navigator:{select:{},seriesDefaults:{markers:{visible:!1},tooltip:{visible:!0,template:"#= kendo.toString(category, 'd') #"},line:{width:2}},hint:{},visible:!0},tooltip:{visible:!0},legend:{visible:!1}},_redraw:function(){var t=this,e=t._navigator;e&&e.dataSource?e.redrawSlaves():(e||(e=t._navigator=new H(t)),e.filterAxes(),h.fn._redraw.call(t),e.redraw())},_onDataChanged:function(){var t=this;h.fn._onDataChanged.call(t),t._dataBound=!0},_bindCategoryAxis:function(t,e,i){var a,o=this,n=o.options.categoryAxis,s=n.length;if(h.fn._bindCategoryAxis.apply(this,arguments),t.name===k)for(;s>i;)a=n[i++],a.pane==E&&(a.categories=t.categories)},_trackSharedTooltip:function(t){var e=this,i=e._plotArea,a=i.paneByPoint(t);a&&a.options.name===E?e._unsetActivePoint():h.fn._trackSharedTooltip.call(e,t)},destroy:function(){var t=this;t._navigator.destroy(),h.fn.destroy.call(t)}}),H=s.extend({init:function(t){var e=this;e.chart=t,e.options=r({},e.options,t.options.navigator),e._initDataSource(),p(e.options.hint.visible)||(e.options.hint.visible=e.options.visible),t.bind(T,c(e._drag,e)),t.bind(C,c(e._dragEnd,e)),t.bind(F,c(e._zoom,e)),t.bind(z,c(e._zoomEnd,e))},options:{},_initDataSource:function(){var t=this,e=t.options,i=e.autoBind,a=e.dataSource;p(i)||(i=t.chart.options.autoBind),t._dataChangedHandler=c(t._onDataChanged,t),a&&(t.dataSource=o.data.DataSource.create(a).bind(A,t._dataChangedHandler),i&&t.dataSource.fetch())},_onDataChanged:function(){var t,e,i,a,o,n=this,s=n.chart,r=s.options.series,l=r.length,c=s.options.categoryAxis,d=c.length,p=n.dataSource.view();for(t=0;l>t;t++)i=r[t],i.axis==k&&s._isBindable(i)&&(i.data=p);for(e=0;d>e;e++)a=c[e],a.pane==E&&(a.name==k?(s._bindCategoryAxis(a,p,e),o=a.categories):a.categories=o);s._model&&(n.redraw(),n.filterAxes(),(!s.options.dataSource||s.options.dataSource&&s._dataBound)&&n.redrawSlaves())},destroy:function(){var t=this,e=t.dataSource;e&&e.unbind(A,t._dataChangeHandler),t.selection&&t.selection.destroy()},redraw:function(){this._redrawSelf();var e=this,o=e.chart,n=e.options,s=e.mainAxis(),r=i(s),l=s.options.categories,c=e.options.select||{},d=e.selection,p=s.range(),u=p.min,f=p.max,h=c.from||u,v=c.to||f;l.length>0&&(d&&(d.destroy(),d.wrapper.remove()),r.box=s.box,d=e.selection=new m(o,r,{min:u,max:f,from:h,to:v,selectStart:t.proxy(e._selectStart,e),select:t.proxy(e._select,e),selectEnd:t.proxy(e._selectEnd,e),mousewheel:{zoom:"left"}}),n.hint.visible&&(e.hint=new a(o.element,{min:u,max:f,template:n.hint.template,format:n.hint.format})))},_redrawSelf:function(t){var e=this.chart._plotArea;e&&e.redraw(g(e.panes),t)},redrawSlaves:function(){var t=this,e=t.chart,i=e._plotArea,a=i.panes.slice(0,-1);i.srcSeries=e.options.series,i.redraw(a)},_drag:function(t){var e,i,a,o=this,n=o.chart,s=n._eventCoordinates(t.originalEvent),r=o.mainAxis(),l=r.range(),c=r.pane.box.containsPoint(s),d=n._plotArea.categoryAxis,p=t.axisRanges[d.options.name],u=o.options.select,f=o.selection;p&&!c&&f&&(e=u.from&&u.to?y(u.to)-y(u.from):y(f.options.to)-y(f.options.from),i=S(_(y(p.min),l.min,y(l.max)-e)),a=S(_(y(i)+e,y(l.min)+e,l.max)),o.options.select={from:i,to:a},o._liveDrag()&&(o.filterAxes(),o.redrawSlaves()),f.set(i,a),o.showHint(i,a))},_dragEnd:function(){var t=this;t.filterAxes(),t.filterDataSource(),t.redrawSlaves(),t.hint&&t.hint.hide()},_liveDrag:function(){var t=o.support,e=t.touch,i=t.browser,a=i.mozilla,n=i.msie&&i.version<9;return!e&&!a&&!n},readSelection:function(){var t=this,e=t.selection,i=e.options,a=t.options.select;a.from=i.from,a.to=i.to},filterAxes:function(){var t,e,i=this,a=i.options.select||{},o=i.chart,n=o.options.categoryAxis,s=a.from,r=a.to;for(t=0;t<n.length;t++)e=n[t],e.pane!==E&&(e.min=S(s),e.max=S(r))},filterDataSource:function(){var t,e=this,i=e.options.select||{},a=e.chart,o=a.dataSource,n=o&&o.options.serverFiltering;e.dataSource&&n&&(t=new d.DateCategoryAxis(r({baseUnit:"fit"},a.options.categoryAxis[0],{categories:[i.from,i.to]})).options,o.filter(H.buildFilter(v(t.min,-t.baseUnitStep,t.baseUnit),v(t.max,t.baseUnitStep,t.baseUnit))))},_zoom:function(t){var e,i,a=this,n=a.chart,s=t.delta,r=n._plotArea.categoryAxis,c=a.options.select,d=a.selection,p=a.mainAxis().options.categories;d&&(e=x(d.options.from,p),i=x(d.options.to,p),t.originalEvent.preventDefault(),l.abs(s)>1&&(s*=B),i-e>1?(d.expand(s),a.readSelection()):(r.options.min=c.from,c.from=r.scaleRange(-t.delta).min),o.support.touch||(a.filterAxes(),a.redrawSlaves()),d.set(c.from,c.to),a.showHint(a.options.select.from,a.options.select.to))},_zoomEnd:function(t){this._dragEnd(t)},showHint:function(t,e){var i=this,a=i.chart,o=a._plotArea;i.hint&&i.hint.show(t,e,o.backgroundBox())},_selectStart:function(t){var e=this.chart;e._selectStart.call(e,t)},_select:function(t){var e=this,i=e.chart;e.showHint(t.from,t.to),i._select.call(i,t)},_selectEnd:function(t){var e=this,i=e.chart;e.hint&&e.hint.hide(),e.readSelection(),e.filterAxes(),e.filterDataSource(),e.redrawSlaves(),i._selectEnd.call(i,t)},mainAxis:function(){var t=this.chart._plotArea;return t?t.namedCategoryAxes[k]:undefined}});H.setup=function(t,e){t=t||{},e=e||{};var i=r({},e.navigator,t.navigator),a=t.panes=[].concat(t.panes),o=r({},i.pane,{name:E});i.visible||(o.visible=!1,o.height=.1),a.push(o),H.attachAxes(t,i),H.attachSeries(t,i,e)},H.attachAxes=function(t,e){var i=e.series||[],a=t.categoryAxis=[].concat(t.categoryAxis),o=t.valueAxis=[].concat(t.valueAxis),n=u(i,U),s=0===n.length,l=r({type:"date",pane:E,roundToBaseUnit:!s,justified:s,tooltip:{visible:!1},labels:{step:1},autoBind:!e.dataSource,autoBaseUnitSteps:{minutes:[1],hours:[1],days:[1],weeks:[],months:[1],years:[1]},_overlap:!1},e.categoryAxis);a.push(r({},l,{name:k,baseUnit:"fit",maxDateGroups:200,baseUnitStep:"auto",labels:{visible:!1},majorTicks:{visible:!1}}),r({},l,{name:k+"_labels",maxDateGroups:20,baseUnitStep:"auto",autoBaseUnitSteps:{minutes:[]},majorTicks:{visible:!0}}),r({},l,{name:k+"_ticks",maxDateGroups:200,majorTicks:{visible:!0,width:.5},labels:{visible:!1,mirror:!0}})),o.push({name:k,pane:E,majorGridLines:{visible:!1},visible:!1})},H.attachSeries=function(t,e,i){var a,o=t.series=t.series||[],n=[].concat(e.series||[]),s=i.seriesColors,l=e.seriesDefaults;for(a=0;a<n.length;a++)o.push(r({color:s[a%s.length],categoryField:e.dateField,visibleInLegend:!1,tooltip:{visible:!1}},l,n[a],{axis:k,categoryAxis:k,autoBind:!e.dataSource}))},H.buildFilter=function(t,e){return[{field:"Date",operator:"gte",value:S(t)},{field:"Date",operator:"lt",value:S(e)}]},a=n.extend({init:function(e,i){var a=this;a.options=r({},a.options,i),a.container=e,a.chartPadding={top:parseInt(e.css("paddingTop"),10),left:parseInt(e.css("paddingLeft"),10)},a.template=a.template,a.template||(a.template=a.template=b("<div class='"+D+"navigator-hint' "+"style='display: none; position: absolute; top: 1px; left: 1px;'>"+"<div class='"+D+"tooltip'> </div>"+"<div class='"+D+"scroll' />"+"</div>")),a.element=t(a.template()).appendTo(e)},options:{format:"{0:d} - {1:d}",hideDelay:500},show:function(t,e,i){var a,n=this,s=S(y(t)+y(e-t)/2),r=n.options,l=o.format(n.options.format,t,e),c=n.element.find("."+D+"tooltip"),d=n.element.find("."+D+"scroll"),p=.4*i.width(),u=i.center().x-p,h=i.center().x,m=h-u,v=r.max-r.min,g=m/v,_=s-r.min;n._hideTimeout&&clearTimeout(n._hideTimeout),n._visible||(n.element.stop(!1,!0).css("visibility","hidden").show(),n._visible=!0),r.template&&(a=f(r.template),l=a({from:t,to:e})),c.html(l).css({left:i.center().x-c.outerWidth()/2,top:i.y1}),d.css({width:p,left:u+_*g,top:i.y1+parseInt(c.css("margin-top"),10)+parseInt(c.css("border-top-width"),10)+c.height()/2}),n.element.css("visibility","visible")},hide:function(){var t=this;t._hideTimeout&&clearTimeout(t._hideTimeout),t._hideTimeout=setTimeout(function(){t._visible=!1,t.element.fadeOut("slow")},t.options.hideDelay)}}),d.ui.plugin(j),r(d,{Navigator:H})}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(t,e){return e()});
|
|
//@ sourceMappingURL=kendo.dataviz.stock.min.js.map
|