UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 17.9 kB
module.exports=function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return t[n].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}({0:function(t,e,i){t.exports=i(855)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},855:function(t,e,i){var n,s,o;!function(r,define){s=[i(856),i(857),i(858),i(859),i(860),i(861)],n=r,o="function"==typeof n?n.apply(e,s):n,!(void 0!==o&&(t.exports=o))}(function(){return function(t,e){function i(t){a.fn[t]=function(){var e=this._instance;if(e)return e[t].apply(e,arguments)}}function n(t,i){var n,s,o,r=[],a=t.groupNameTemplate,l=i.length;if(0===l)return o=A({},t),o.visibleInLegend=!1,[o];for(O(a)?(g.logToConsole("'groupNameTemplate' is obsolete and will be removed in future versions. Specify the group name template as 'series.name'"),a&&(n=N(a))):(n=N(t.name||""),0===n._slotCount&&(n=N(O(t.name)?"#= group.value #: #= series.name #":"#= group.value #"))),s=0;s<l;s++)o=A({},t),g.isFunction(o.color)||(o.color=e),o._groupIx=s,o._groupValue=i[s].value,r.push(o),n&&(o.name=n({series:o,group:i[s]}));return r}function s(t){for(var i in t)t[i]===e&&(t[i]="");return t}function o(t){for(var e=0;e<t.length;e++)t[e].notifyRender()}var r,a,l,h,c,u,p,d,_,f,m=".kendoChart",g=window.kendo,v=g.Class,y=g._outerWidth,x=g._outerHeight,b=g.dataviz,S=b.constants,T=b.Chart,w=b.SeriesBinder,E=g.ui.Widget,C=g.data.DataSource,A=g.deepExtend,O=b.defined,I=b.getField,D=b.InstanceObserver,L=b.inArray,R=b.services,V=t.proxy,k=t.isArray,B=t.extend,N=g.template,H="mouseleave"+m,M=S.AXIS_LABEL_CLICK,F=S.LEGEND_ITEM_CLICK,P=S.LEGEND_ITEM_HOVER,z=S.LEGEND_ITEM_LEAVE,G=S.SERIES_CLICK,q=S.SERIES_HOVER,K=S.SERIES_OVER,Z=S.SERIES_LEAVE,U=S.PANE_RENDER,W=S.PLOT_AREA_CLICK,X=S.PLOT_AREA_HOVER,j=S.PLOT_AREA_LEAVE,Q=S.DRAG,Y=S.DRAG_END,J=S.DRAG_START,$=S.ZOOM_START,tt=S.ZOOM,et=S.ZOOM_END,it=S.SELECT_START,nt=S.SELECT,st=S.SELECT_END,ot=S.RENDER,rt=S.NOTE_CLICK,at=S.NOTE_HOVER,lt=S.NOTE_LEAVE,ht="change",ct="dataBound",ut="leave",pt=S.VALUE,dt=S.PIE,_t=S.DONUT,ft=S.FUNNEL,mt=g.Observable,gt=150,vt=100,yt="k-chart-tooltip-inverse",xt="k-chart-shared-tooltip",bt="rtl";for(R.DomEventsBuilder.register({create:function(t,e){return new g.UserEvents(t,A({global:!0,multiTouch:!0,fastTap:!0},e))}}),r=D.extend({handlerMap:{showTooltip:"_showTooltip",hideTooltip:"_hideTooltip",legendItemClick:"_onLegendItemClick",render:"_onRender",init:"_onInit"}}),a=E.extend({init:function(t,e){var i;g.destroy(t),E.fn.init.call(this,t),e&&(i=e.dataSource,delete e.dataSource),this.options=A({},this.options,e),this.wrapper=this.element,this._attachEvents(),e&&(e.dataSource=i),this._seriesVisibility=new c,this.bind(this.events,this.options),this._initDataSource(e),g.notify(this,b.ui)},events:[ct,G,q,K,Z,M,F,P,z,U,W,X,j,J,Q,Y,$,tt,et,it,nt,st,rt,at,lt,ot],options:{name:"Chart",renderAs:"",theme:"default",axisDefaults:{},chartArea:{},legend:{},categoryAxis:{},autoBind:!0,seriesDefaults:{},series:[],seriesColors:null,tooltip:{},transitions:!0,valueAxis:{},plotArea:{},title:{},xAxis:{},yAxis:{},panes:[{}],pannable:!1,zoomable:!1},items:function(){return t()},refresh:function(){var t=this,e=t._instance;e.applyDefaults(t.options),e.applySeriesColors(),t._bindSeries(),t._bindCategories(),t.trigger(ct),t._redraw()},getSize:function(){return g.dimensions(this.element)},redraw:function(t){this._size=null,this._instance.redraw(t)},setOptions:function(t){var e=this,i=t.dataSource;delete t.dataSource,E.fn._setEvents.call(e,t),this._instance.applyOptions(t,this._getThemeOptions(t)),this.options=this._instance.options,this._tooltip.setOptions(this.options.tooltip),this._seriesVisibility.setOptions(this.options),this._sourceSeries=null,i&&e.setDataSource(i),e._hasDataSource?e._onDataChanged():(e._bindCategories(),e.redraw()),e._instance.updateMouseMoveHandler()},setDataSource:function(t){var e=this;e.dataSource.unbind(ht,e._dataChangeHandler),e.dataSource=t=C.create(t),e._hasDataSource=!0,e._hasData=!1,t.bind(ht,e._dataChangeHandler),e.options.autoBind&&t.fetch()},destroy:function(){var t=this,e=t.dataSource;t.element.off(m),e&&e.unbind(ht,t._dataChangeHandler),t._instance&&(t._instance.destroy(),delete this._instance),this._tooltip&&(this._tooltip.destroy(),delete this._tooltip),this._destroyCrosshairTooltips(),E.fn.destroy.call(t)},findPaneByName:function(t){var e,i=this._plotArea.panes;for(e=0;e<i.length;e++)if(i[e].options.name===t)return new _(this,i[e])},findPaneByIndex:function(t){var e=this._plotArea.panes;if(e[t])return new _(this,e[t])},findSeries:function(t){var e,i=this._plotArea,n=i.srcSeries||i.series;for(e=0;e<n.length;e++)if(t(n[e]))return new f(this,n[e])},findSeriesByName:function(t){return this._createSeries({name:t})},findSeriesByIndex:function(t){return this._createSeries({index:t})},exportVisual:function(t){var e,i,n,s,r=this._instance;if(r)return t&&(t.width||t.height)?(i=r.options.chartArea,n=r._originalOptions.chartArea,A(i,t),s=r._getModel(),i.width=n.width,i.height=n.height,s.renderVisual(),o(s._plotArea.panes),e=s.visual):e=r.exportVisual(),e},_createSeries:function(t){var e=this._seriesOptions(t);if(e)return new f(this,e)},_seriesOptions:function(t){var e,i,n=this._plotArea,s=n.srcSeries||n.series;if(O(t.index))e=s[t.index];else if(O(t.name))for(i=0;i<s.length;i++)if(s[i].name===t.name){e=s[i];break}return e},_attachEvents:function(){this.element.on(H,V(this._mouseleave,this))},_mouseleave:function(e){var i=this._instance,n=this._tooltip,s=e.relatedTarget;s&&t(s).closest(n.element).length||!i||i.handlingTap||i.hideElements()},_getThemeOptions:function(t){var i,n,s=(t||{}).theme;return s&&b.SASS_THEMES.indexOf(s.toLowerCase())!==-1?b.autoTheme().chart:O(s)?(i=b.ui.themes||{},n=i[s]||i[s.toLowerCase()]||{},n.chart||{}):e},_initChart:function(){this._createChart(this.options,this._getThemeOptions(this.options)),this.options=this._instance.options,this._seriesVisibility.setOptions(this.options)},_createChart:function(t,e){this._instance=new T(this.element[0],t,e,{observer:new r(this),sender:this,rtl:this._isRtl()})},_onInit:function(t){this._instance=t.sender},_initDataSource:function(t){var e=this,i=(t||{}).dataSource;e._dataChangeHandler=V(e._onDataChanged,e),e.dataSource=C.create(i).bind("change",e._dataChangeHandler),e._bindCategories(),i&&(e._hasDataSource=!0),this._initChart(),this._initTooltip(),i&&e.options.autoBind&&e.dataSource.fetch()},_destroyCrosshairTooltips:function(){var t,e=this._crosshairTooltips;if(e)for(t in e)e[t].destroy();this._crosshairTooltips={}},_getCrosshairTooltip:function(t,e){var i=this._crosshairTooltips=this._crosshairTooltips||{},n=t+e,s=i[n];return s||(s=i[n]=new d(this.element)),s},_showTooltip:function(t){if(t.crosshair){var e=this._getCrosshairTooltip(t.axisName,t.axisIndex);e.show(t)}else this._tooltip&&this._tooltip.show(t)},_hideTooltip:function(t){if(t.crosshair){var e=this._getCrosshairTooltip(t.axisName,t.axisIndex);e.hide()}else this._tooltip&&this._tooltip.hide(t)},_onRender:function(t){this._destroyCrosshairTooltips(),this._copyMembers(t.sender),this._hasDataSource&&!this._hasData&&this.options.autoBind||this.trigger(ot)},_copyMembers:function(t){this.options=t.options,this._originalOptions=t._originalOptions,this.surface=t.surface,this._plotArea=t._plotArea,this._model=t._model,this._highlight=t._highlight,this._selections=t._selections,this._pannable=t._pannable,this._zoomSelection=t._zoomSelection,this._mousewheelZoom=t._mousewheelZoom},requiresHandlers:function(t){var e,i=this._events;for(e=0;e<t.length;e++)if(O(i[t[e]]))return!0},_initTooltip:function(){this._tooltip=this._createTooltip(),this._tooltip.bind(ut,V(this._tooltipleave,this))},_onLegendItemClick:function(t){this.trigger(F,t)||this._legendItemClick(t.seriesIndex,t.pointIndex)},_legendItemClick:function(e,i){var n,s,o,r=this._instance,a=r._plotArea,l=(a.srcSeries||a.series)[e];t.inArray(l.type,[dt,_t,ft])>=0?(n=l.data[i],n&&O(n.visible)?n.visible=!n.visible:(s=l.pointVisibility=l.pointVisibility||{},o=s[i],s[i]=!!O(o)&&!o)):(l.visible=!l.visible,this._seriesVisibility.save(l)),r._noTransitionsRedraw()},_createTooltip:function(){return new p(this.element,B({},this.options.tooltip,{rtl:this._isRtl()}))},_tooltipleave:function(){this._instance&&this._instance.hideElements()},_bindData:function(t){var e,i,s,o=this,r=o.options,a=o._sourceSeries||r.series,l=a.length,h=o.dataSource.view(),c=(o.dataSource.group()||[]).length>0,u=[],p=this._seriesVisibility;for(p.read(),e=0;e<l;e++)i=a[e],o._isBindable(i)&&c?(s=n(i,h),u=u.concat(s),p.applyByGroup(s,t)):(i=B({},i),u.push(i),p.applyByIndex(i,t));o._sourceSeries=a,r.series=u,this._instance.applySeriesColors(),o._bindSeries(),o._bindCategories(),this._hasData=!0},_onDataChanged:function(t){this._bindData(t),this.trigger(ct),this._instance&&this._instance.fontLoaded&&this._redraw()},_bindSeries:function(){var t,e,i,n,s=this,o=s.dataSource.view(),r=s.options.series,a=r.length;for(t=0;t<a;t++)e=r[t],s._isBindable(e)&&(i=e._groupIx,n=O(i)?(o[i]||{}).items:o,e.autoBind!==!1&&(e.data=n))},_bindCategories:function(){var t,e,i=this,n=i.dataSource.view()||[],s=(i.dataSource.group()||[]).length>0,o=n,r=i.options,a=[].concat(r.categoryAxis);for(s&&n.length&&(o=n[0].items),t=0;t<a.length;t++)e=a[t],e.autoBind!==!1&&i._bindCategoryAxis(e,o,t)},_bindCategoryAxis:function(t,e,i){var n,s,o,r=(e||[]).length;if(t.field)for(t.categories=[],n=0;n<r;n++)o=e[n],s=I(t.field,o),0===n?(t.categories=[s],t.dataItems=[o]):(t.categories.push(s),t.dataItems.push(o));else this._instance&&this._instance.bindCategoryAxisFromSeries(t,i)},_isBindable:function(t){var e,i,n=w.current.valueFields(t),s=!0;for(i=0;i<n.length;i++)if(e=n[i],e===pt?e="field":e+="Field",!O(t[e])){s=!1;break}return s},_isRtl:function(){return g.support.isRtl(this.element)&&this.element.css("direction")===bt}}),l=["getAxis","findAxisByName","plotArea","toggleHighlight","showTooltip","hideTooltip","_resize","_redraw","_noTransitionsRedraw","_legendItemHover","_eventCoordinates"],h=0;h<l.length;h++)i(l[h]);b.ExportMixin.extend(a.fn),g.PDFMixin&&g.PDFMixin.extend(a.fn),b.ui.plugin(a),c=v.extend({init:function(){this.groups={},this.index={},this.options={}},applyByGroup:function(t,e){if(e&&e.action||this.options.persistSeriesVisibility)for(var i=0;i<t.length;i++)this.groups[t[i]._groupValue]===!1&&(t[i].visible=!1);else this.groups={}},applyByIndex:function(t,e){e&&e.action||this.options.persistSeriesVisibility?this.index[t.index]===!1&&(t.visible=!1):this.index={}},save:function(t){t&&(this.options.persistSeriesVisibility?this.options.series[t.index].visible=t.visible:this.saveState(t))},setOptions:function(t){this.options=t,this.groups={},this.index={}},read:function(){var t,e,i=this.options;if(i.persistSeriesVisibility)for(t=i.series,e=0;e<t.length;e++)this.saveState(t[e])},saveState:function(t){O(t._groupValue)?this.groups[t._groupValue]=t.visible:this.index[t.index]=t.visible}}),u=g.geometry,p=mt.extend({init:function(e,i){var n,s=this;mt.fn.init.call(s),this.setOptions(i),s.chartElement=e,s.template=p.template,s.template||(s.template=p.template=g.template("<div class='k-tooltip k-chart-tooltip#= d.rtl ? \" k-rtl\" : \"\"#' style='display:none; position: absolute; font: #= d.font #;#if (d.border) {# border: #= d.border.width #px solid; #}#opacity: #= d.opacity #; filter: alpha(opacity=#= d.opacity * 100 #);'></div>",{useWithBlock:!1,paramName:"d"})),s.element=t(s.template(s.options)),s.move=V(s.move,s),s._mouseleave=V(s._mouseleave,s),n=g.format("[{0}='content'],[{0}='scroller']",g.attr("role")),s._mobileScroller=e.closest(n).data("kendoMobileScroller")},destroy:function(){this._clearShowTimeout(),this.element&&(this.element.off(H).remove(),this.element=null)},setOptions:function(t){this.options=A({},this.options,t)},options:{opacity:1,animation:{duration:gt},sharedTemplate:"<table><th colspan='#= colspan #'>#= categoryText #</th># for(var i = 0; i < points.length; i++) { ## var point = points[i]; #<tr># if(colorMarker) { # <td><span class='k-chart-shared-tooltip-marker' style='background-color:#:point.series.color#'></span></td># } ## if(nameColumn) { # <td> #if (point.series.name) {# #: point.series.name #: #} else {# &nbsp; #}#</td># } #<td>#= content(point) #</td></tr># } #</table>",categoryFormat:"{0:d}"},move:function(){var t,e=this,i=e.options,n=e.element;e.anchor&&e.element&&(t=e._offset(),e.visible||n.css({top:t.top,left:t.left}),e.visible=!0,e._ensureElement(document.body),n.stop(!0,!0).show().animate({left:t.left,top:t.top},i.animation.duration))},_clearShowTimeout:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null)},getAnchor:function(t){var e=this.anchor,i=e.point,n=e.align,s=i.left,o=i.top;return"center"===n.horizontal?s-=t.width/2:"right"===n.horizontal&&(s-=t.width),"center"===n.vertical?o-=t.height/2:"bottom"===n.vertical&&(o-=t.height),{x:s,y:o}},_offset:function(){var e,i,n=this,s=n._measure(),o=n.getAnchor(s),r=o.y,a=o.x,l=g.support.zoomLevel(),h=t(window),c=window.pageYOffset||document.documentElement.scrollTop||0,p=window.pageXOffset||document.documentElement.scrollLeft||0,d=(this._mobileScroller||{}).movable;return d&&1!==d.scale?(e=u.transform().scale(d.scale,d.scale,[d.x,d.y]),i=new u.Point(a,r).transform(e),a=i.x,r=i.y):(r+=n._fit(r-c,s.height,x(h)/l),a+=n._fit(a-p,s.width,y(h)/l)),{top:r,left:a}},show:function(t){this.anchor=t.anchor,this.element.css(s(t.style)),this.element.toggleClass(yt,!!t.className),this.element.toggleClass(xt,!!t.shared);var e=t.shared?this._sharedContent(t):this._pointContent(t.point);this.element.html(e),this._clearShowTimeout(),this.showTimeout=setTimeout(this.move,vt)},hide:function(){var t=this;clearTimeout(t.showTimeout),t._hideElement(),t.visible&&(t.point=null,t.visible=!1,t.index=null)},_sharedContent:function(t){var e,i,n=t.points,s=b.grep(n,function(t){return O(t.series.name)}).length,o=t.series.length>1,r=1;return s&&r++,o&&r++,e=g.template(this.options.sharedTemplate),i=e({points:n,category:t.category,categoryText:t.categoryText,content:this._pointContent,colorMarker:o,nameColumn:s,colspan:r})},_measure:function(){this._ensureElement();var t={width:y(this.element),height:x(this.element)};return t},_ensureElement:function(){this.element&&this.element.appendTo(document.body).on(H,this._mouseleave)},_mouseleave:function(e){var i=e.relatedTarget,n=this.chartElement[0];i&&i!==n&&!t.contains(n,i)&&this.trigger(ut)},_hideElement:function(){var t=this,e=this.element;e&&e.fadeOut({always:function(){t.visible||e.off(H).remove()}})},_pointContent:function(t){var e,i,n=this,s=A({},n.options,t.options.tooltip);return O(t.value)&&(e=""+t.value),s.template?(i=N(s.template),e=i({value:t.value,category:t.category,series:t.series,dataItem:t.dataItem,percentage:t.percentage,runningTotal:t.runningTotal,total:t.total,low:t.low,high:t.high,xLow:t.xLow,xHigh:t.xHigh,yLow:t.yLow,yHigh:t.yHigh})):s.format&&(e=t.formatValue(s.format)),e},_fit:function(t,e,i){var n=0;return t+e>i&&(n=i-(t+e)),t<0&&(n=-t),n}}),d=p.extend({init:function(t,e){p.fn.init.call(this,t,e),this.element.addClass("k-chart-crosshair-tooltip")},show:function(t){var e=this.element;e&&(this.anchor=t.anchor,this.element.css(t.style),this.element.html(this.content(t)),this.move())},move:function(){var t=this,e=t.element,i=t._offset();t._ensureElement(),e.css({top:i.top,left:i.left}).show()},content:function(t){var e=t.value,i=t.crosshair.options.tooltip;return i.template&&(e=N(i.template)({value:e})),e},hide:function(){this.element.hide()}}),_=v.extend({init:function(t,e){this._chart=t,this._pane=e,this.visual=e.visual,this.chartsVisual=e.chartContainer.visual,this.name=e.options.name},series:function(){var t,e=this._chart,i=e._plotArea.groupSeriesByPane(),n=i[this.name||"default"],s=[];if(n)for(t=0;t<n.length;t++)s.push(new f(e,n[t]));return s}}),f=v.extend({init:function(t,e){this._chart=t,this._options=e},points:function(t){var e,i,n=this._points;return n||(e=this._seriesOptions(),i=this._chart._plotArea,this._points=n=i.pointsBySeriesIndex(e.index)),g.isFunction(t)&&(n=this._filterPoints(n,t)),n},data:function(t){var e,i,n,s,o=this._seriesOptions();return t&&(e=this._chart,i=e._plotArea,o.data=t,o.categoryField&&(n=i.seriesCategoryAxis(o),s=[].concat(e.options.categoryAxis),e._instance.bindCategoryAxisFromSeries(s[n.axisIndex],n.axisIndex)),e._noTransitionsRedraw(),this._clearFields()),o.data},findPoint:function(t){var e,i=this.points();for(e=0;e<i.length;e++)if(t(i[e]))return i[e]},toggleHighlight:function(t,e){e=e?g.isFunction(e)?this.points(e):k(e)?e:[e]:this.points(),this._chart._instance.togglePointsHighlight(t,e)},toggleVisibility:function(t,e){var i,n,s=this._chart,o=this._seriesOptions(),r=g.isFunction(e);if(r)if(L(o.type,[dt,_t,ft]))for(i=this._filterData(e),n=0;n<i.length;n++)i[n].visible=t;else o.visible=function(i){return!e(i.dataItem)||t};else o.visible=t,s._seriesVisibility.save(o);s._noTransitionsRedraw(),this._clearFields()},_filterData:function(t){var e,i=this._seriesOptions().data,n=i.length,s=[];for(e=0;e<n;e++)t(i[e])&&s.push(i[e]);return s},_filterPoints:function(t,e){var i,n=[],s=t.length;for(i=0;i<s;i++)e(t[i])&&n.push(t[i]);return n},_seriesOptions:function(){var t=this._series;return t||(t=this._series=this._chart._seriesOptions(this._options)),t},_clearFields:function(){delete this._points,delete this._series}}),b.Tooltip=p,b.CrosshairTooltip=d,b.ChartInstanceObserver=r,b.ChartPane=_,b.ChartSeries=f}(window.kendo.jQuery),window.kendo},i(3))},856:function(t,e){t.exports=require("./kendo-chart")},857:function(t,e){t.exports=require("../../kendo.data")},858:function(t,e){t.exports=require("../../kendo.dataviz.core")},859:function(t,e){t.exports=require("../../kendo.dataviz.themes")},860:function(t,e){t.exports=require("../../kendo.drawing")},861:function(t,e){t.exports=require("../../kendo.userevents")}});