10 lines
5.8 KiB
JavaScript
10 lines
5.8 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(e){var t=window.kendo,n=t.deepExtend,i=e.extend,o=t.isFunction,a=t.template,r=t.dataviz,l=r.Color,s=r.ChartElement,c=r.PlotAreaBase,d=r.PlotAreaFactory,p=r.Point2D,h=r.Box2D,u=r.SeriesBinder,g=r.TextBox,f=r.append,m=r.autoFormat,v=r.evalOptions,y=r.limitValue,x=r.uniqueId,b="category",w="color",I="funnel",k="value",S="black",P="white",C=c.extend({render:function(){var e=this,t=e.series;e.createFunnelChart(t)},createFunnelChart:function(e){var t=this,n=e[0],i=new F(t,{series:e,legend:t.options.legend,neckRatio:n.neckRatio,dynamicHeight:n.dynamicHeight,dynamicSlope:n.dynamicSlope,segmentSpacing:n.segmentSpacing,highlight:n.highlight});t.appendChart(i)},appendChart:function(e,t){c.fn.appendChart.call(this,e,t),f(this.options.legend.items,e.legendItems)}}),F=s.extend({init:function(e,t){var n=this;s.fn.init.call(n,t),n.plotArea=e,n.points=[],n.labels=[],n.legendItems=[],n.render()},options:{neckRatio:.3,width:300,dynamicSlope:!1,dynamicHeight:!0,segmentSpacing:0,labels:{visible:!1,align:"center",position:"center"}},formatPointValue:function(e,t){return m(t,e.value)},render:function(){var e,t,i,a,r,l,s,c=this,d=c.options,p=c.plotArea.options.seriesColors||[],h=p.length,g=d.series[0],f=g.data;if(f)for(r=c.pointsTotal(g),a=0;a<f.length;a++)e=u.current.bindPoint(g,a),i=e.valueFields.value,t=e.fields,o(g.color)||(g.color=t.color||p[a%h]),t=n({index:a,owner:c,series:g,category:t.category,dataItem:f[a],percentage:i/r,visibleInLegend:t.visibleInLegend,visible:t.visible},t),l=c.createSegment(i,t),s=c.createLabel(i,t),l&&s&&l.append(s)},evalSegmentOptions:function(e,t,n){var i=n.series;v(e,{value:t,series:i,dataItem:n.dataItem,index:n.index},{defaults:i._defaults,excluded:["data"]})},createSegment:function(e,t){var o,a,r=this;return r.createLegendItem(e,t),t.visible!==!1?(a=n({},t.series),r.evalSegmentOptions(a,e,t),o=new O(e,a,t),i(o,t),r.append(o),r.points.push(o),o):undefined},createLabel:function(e,t){var i,o,r,s=this,c=t.series,d=t.dataItem,p=n({},s.options.labels,c.labels),h=e;return p.visible&&e?(p.template?(o=a(p.template),h=o({dataItem:d,value:e,percentage:t.percentage,category:t.category,series:c})):p.format&&(h=m(p.format,h)),p.color||"center"!==p.align||(r=new l(c.color).percBrightness(),p.color=r>180?S:P),s.evalSegmentOptions(p,e,t),i=new g(h,n({vAlign:p.position,id:x()},p)),s.labels.push(i),i):undefined},createLegendItem:function(e,t){var n,i,o,r,l=this,s=(l.options.legend||{}).labels||{},c=(l.options.legend||{}).inactiveItems||{};t&&t.visibleInLegend!==!1&&(n=t.category||"",(s||{}).template&&(i=a(s.template),n=i({text:n,series:t.series,dataItem:t.dataItem,percentage:t.percentage,value:e})),t.visible===!1?(o=(c.markers||{}).color,r=(c.labels||{}).color):(o=(t.series||{}).color,r=s.color),n&&l.legendItems.push({pointIndex:t.index,text:n,series:t.series,markerColor:o,labelColor:r}))},pointsTotal:function(e){var t,n,i,o=e.data,a=o.length,r=0;for(n=0;a>n;n++)i=u.current.bindPoint(e,n),t=i.valueFields.value,"string"==typeof t&&(t=parseFloat(t)),t&&i.fields.visible!==!1&&(r+=t);return r},labelPadding:function(){var e,t,n,i,o=this.labels,a={left:0,right:0};for(i=0;i<o.length;i++)e=o[i],t=e.options.align,"center"!==t&&(n=o[i].box.width(),"left"===t?a.left=Math.max(a.left,n):a.right=Math.max(a.right,n));return a},reflow:function(t){var n,i,o,a,r,l,s,c,d,h,u,g,f=this,m=f.options,v=f.points,x=v.length,b=m.neckRatio<=1,w=t.clone().unpad(f.labelPadding()),I=w.width(),k=0,S=b?0:(I-I/m.neckRatio)/2,P=m.segmentSpacing,C=m.dynamicSlope,F=w.height()-P*(x-1),O=b?m.neckRatio*I:I;if(x){if(C)for(s=v[0],c=s,e.each(v,function(e,t){t.percentage>c.percentage&&(c=t)}),o=s.percentage/c.percentage*I,S=(I-o)/2,n=0;x>n;n++)r=v[n].percentage,d=v[n+1],h=d?d.percentage:r,a=v[n].points=[],i=m.dynamicHeight?F*r:F/x,l=(I-o*(h/r))/2,l=y(l,0,I),a.push(p(w.x1+S,w.y1+k)),a.push(p(w.x1+I-S,w.y1+k)),a.push(p(w.x1+I-l,w.y1+i+k)),a.push(p(w.x1+l,w.y1+i+k)),S=l,k+=i+P,o*=h/r,o=y(o,0,I);else for(u=b?I:I-2*S,g=(u-O)/2,n=0;x>n;n++)a=v[n].points=[],r=v[n].percentage,l=m.dynamicHeight?g*r:g/x,i=m.dynamicHeight?F*r:F/x,a.push(p(w.x1+S,w.y1+k)),a.push(p(w.x1+I-S,w.y1+k)),a.push(p(w.x1+I-S-l,w.y1+i+k)),a.push(p(w.x1+S+l,w.y1+i+k)),S+=l,k+=i+P;for(n=0;x>n;n++)v[n].reflow(t)}}}),O=s.extend({init:function(e,t,n){var i=this;s.fn.init.call(i,t),i.value=e,i.options.id=x(),i.options.index=n.index,i.enableDiscovery()},options:{color:P,border:{width:1}},reflow:function(e){var t=this,n=t.points,i=t.children[0];t.box=new h(n[0].x,n[0].y,n[1].x,n[2].y),i&&i.reflow(new h(e.x1,n[0].y,e.x2,n[2].y))},getViewElements:function(e){var t=this,n=t.options,i=n.border,o=[];return o.push(e.createPolyline(t.points,!0,{id:n.id,fill:n.color,fillOpacity:n.opacity,stroke:i.color,strokeOpacity:i.opacity,strokeWidth:i.width,data:{modelId:n.modelId}})),f(o,s.fn.getViewElements.call(t,e)),o},highlightOverlay:function(e,t){var n,o,a,r=this.options,l=r.highlight||{};if(l.visible!==!1)return n=l.border||{},o=i({},t,{fill:l.color,stroke:n.color,strokeOpacity:n.opacity,strokeWidth:n.width,fillOpacity:l.opacity,data:{modelId:r.modelId}}),a=e.createPolyline(this.points,!0,o)},tooltipAnchor:function(e){var t=this.box;return new p(t.center().x-e/2,t.y1)},formatValue:function(e){var t=this;return t.owner.formatPointValue(t,e)}});n(O.fn,r.PointEventsMixin),d.current.register(C,[I]),u.current.register([I],[k],[b,w,"visibleInLegend","visible"]),n(r,{FunnelChart:F})}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(e,t){return t()});
|
|
//@ sourceMappingURL=kendo.dataviz.chart.funnel.min.js.map
|