@@ -7638,7 +7638,7 @@ DvtDataCursor.prototype.getBehavior = function() {
76387638DvtDataCursor.prototype.setBehavior = function(behavior) {
76397639 this._behavior = behavior;
76407640};
7641- // Copyright (c) 2013, 2015 , Oracle and/or its affiliates. All rights reserved.
7641+ // Copyright (c) 2013, 2016 , Oracle and/or its affiliates. All rights reserved.
76427642/**
76437643 * Creates a funnel shape.
76447644 * @extends {DvtPath}
@@ -7710,19 +7710,37 @@ DvtFunnelSlice.prototype.Init = function(chart, seriesIndex, numDrawnSeries, fun
77107710
77117711/** The ratio of rx/ry in the 3D funnel opening
77127712 * @private */
7713- DvtFunnelSlice._FUNNEL_3D_WIDTH_RATIO = .12 ;
7713+ DvtFunnelSlice._FUNNEL_3D_WIDTH_RATIO = .08 ;
77147714/** Angle for creating the funnel sides
77157715 * @private */
7716- DvtFunnelSlice._FUNNEL_ANGLE_2D = 31 ;
7716+ DvtFunnelSlice._FUNNEL_ANGLE_2D = 36 ;
77177717/** Ratio between the smallest and largest slices
77187718 * @private */
7719- DvtFunnelSlice._FUNNEL_RATIO = 6 / 22 ;
7719+ DvtFunnelSlice._FUNNEL_RATIO = 1 / 3 ;
77207720/** Color for funnel slice border. Could be overridden in styleDefaults.
77217721 * @private */
77227722DvtFunnelSlice._BORDER_COLOR = '#FFFFFF';
77237723/** Minimum number of characters to use when truncating.
77247724 * @private */
77257725DvtFunnelSlice._MIN_CHARS_DATA_LABEL = 3;
7726+ /** Length of the first line.
7727+ * @private */
7728+ DvtFunnelSlice._LINE_FRACTION = 2 / 3;
7729+ /** Fraction into which the funnel area is divided by the first line.
7730+ * @private */
7731+ DvtFunnelSlice._AREA_FRACTION = 0.41;
7732+ /** Fraction into which the funnel height is divided by the first line.
7733+ * @private */
7734+ DvtFunnelSlice._HEIGHT_FRACTION = 0.28;
7735+ /** Length of the second line.
7736+ * @private */
7737+ DvtFunnelSlice._LINE_FRACTION_2 = 0.4;
7738+ /** Fraction into which the funnel area is divided by the second line.
7739+ * @private */
7740+ DvtFunnelSlice._AREA_FRACTION_2 = 0.8;
7741+ /** Fraction into which the funnel height is divided by the second line.
7742+ * @private */
7743+ DvtFunnelSlice._HEIGHT_FRACTION_2 = 0.7;
77267744
77277745
77287746/**
@@ -7736,23 +7754,91 @@ DvtFunnelSlice.prototype._getPath = function() {
77367754 var offset = (this._numDrawnSeries + 1) * this._gap;
77377755 var angle = DvtMath.degreesToRads(DvtFunnelSlice._FUNNEL_ANGLE_2D - 2 * this._3dRatio);
77387756
7739- var rx = (this._funnelWidth - (gapCount * this._gap)) / Math.sin(DvtMath.degreesToRads(DvtFunnelSlice._FUNNEL_ANGLE_2D));
7757+ var totalWidth = this._funnelWidth - gapCount * this._gap;
7758+ var rx = totalWidth / Math.sin(DvtMath.degreesToRads(DvtFunnelSlice._FUNNEL_ANGLE_2D));
77407759 var ry = this._funnelHeight / Math.sin(angle);
77417760 var ratio = this._3dRatio * this._funnelWidth / this._funnelHeight * DvtFunnelSlice._FUNNEL_3D_WIDTH_RATIO;
77427761 if (ratio < 0.00001)
77437762 ratio = 0;
7744- var delta = angle * (1 - this._startPercent);
7745- var gamma = angle * (1 - this._startPercent - this._valuePercent);
7763+
7764+ // Dividing the funnel into three trapezoids to come up with a better approximation for the dimensions. We draw two lines,
7765+ // at .28 and .7 of the height, and they split the area to the ratio .41: .39: .2.
7766+ var b1 = this._funnelHeight;
7767+ var b2 = this._funnelHeight * DvtFunnelSlice._FUNNEL_RATIO;
7768+ var p1, p2; // The percent at which we are calculating the width
7769+ var b11, b12, b21, b22; // The first and second base of the trapezoid into which the percent we are looking at falls.
7770+ var f1, f2; // The fraction of the area included in the trapezoid we are considering.
7771+ var t1, t2; // Total width of the trapezoid we are considering.
7772+ var h1, h2; // Horizontal distance from the slice to the center of the ellipse for drawing the funnel arcs.
7773+
7774+ // calculating first edge
7775+ if (this._startPercent < DvtFunnelSlice._AREA_FRACTION) {
7776+ p1 = this._startPercent;
7777+ b11 = b1;
7778+ b21 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION;
7779+ f1 = DvtFunnelSlice._AREA_FRACTION;
7780+ t1 = totalWidth * DvtFunnelSlice._HEIGHT_FRACTION;
7781+ h1 = totalWidth * (1 - DvtFunnelSlice._HEIGHT_FRACTION);
7782+ }
7783+ else if (this._startPercent < DvtFunnelSlice._AREA_FRACTION_2) {
7784+ p1 = this._startPercent - DvtFunnelSlice._AREA_FRACTION;
7785+ b11 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION;
7786+ b21 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION_2;
7787+ f1 = DvtFunnelSlice._AREA_FRACTION_2 - DvtFunnelSlice._AREA_FRACTION;
7788+ t1 = totalWidth * (DvtFunnelSlice._HEIGHT_FRACTION_2 - DvtFunnelSlice._HEIGHT_FRACTION);
7789+ h1 = totalWidth * (1 - DvtFunnelSlice._HEIGHT_FRACTION_2);
7790+ }
7791+ else {
7792+ p1 = this._startPercent - DvtFunnelSlice._AREA_FRACTION_2;
7793+ b11 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION_2;
7794+ b21 = b2;
7795+ f1 = 1 - DvtFunnelSlice._AREA_FRACTION_2;
7796+ t1 = totalWidth * (1 - DvtFunnelSlice._HEIGHT_FRACTION_2);
7797+ h1 = 0;
7798+ }
7799+
7800+ // Calculating second edge
7801+ if (this._startPercent + this._valuePercent < DvtFunnelSlice._AREA_FRACTION) {
7802+ b12 = b1;
7803+ b22 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION;
7804+ p2 = this._startPercent + this._valuePercent;
7805+ f2 = DvtFunnelSlice._AREA_FRACTION;
7806+ t2 = totalWidth * DvtFunnelSlice._HEIGHT_FRACTION;
7807+ h2 = totalWidth * (1 - DvtFunnelSlice._HEIGHT_FRACTION);
7808+ }
7809+ else if (this._startPercent + this._valuePercent < DvtFunnelSlice._AREA_FRACTION_2) {
7810+ b12 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION;
7811+ b22 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION_2;
7812+ p2 = this._startPercent + this._valuePercent - DvtFunnelSlice._AREA_FRACTION;
7813+ f2 = DvtFunnelSlice._AREA_FRACTION_2 - DvtFunnelSlice._AREA_FRACTION;
7814+ t2 = totalWidth * (DvtFunnelSlice._HEIGHT_FRACTION_2 - DvtFunnelSlice._HEIGHT_FRACTION);
7815+ h2 = totalWidth * (1 - DvtFunnelSlice._HEIGHT_FRACTION_2);
7816+ }
7817+ else {
7818+ b12 = this._funnelHeight * DvtFunnelSlice._LINE_FRACTION_2;
7819+ b22 = b2;
7820+ p2 = this._startPercent + this._valuePercent - DvtFunnelSlice._AREA_FRACTION_2;
7821+ f2 = 1 - DvtFunnelSlice._AREA_FRACTION_2;
7822+ t2 = totalWidth * (1 - DvtFunnelSlice._HEIGHT_FRACTION_2);
7823+ h2 = 0;
7824+ }
7825+
7826+ var w1 = Math.sqrt((f1 - p1) / f1 * b11 * b11 + p1 / f1 * b21 * b21);
7827+ var w2 = Math.sqrt((f2 - p2) / f2 * b12 * b12 + p2 / f2 * b22 * b22);
7828+
7829+ var startAngle = 0.98 * Math.asin((((w1 - b21) * (t1) / (b11 - b21)) + h1) / rx);
7830+ var endAngle = 0.98 * Math.asin((((w2 - b22) * (t2) / (b12 - b22)) + h2) / rx);
7831+
77467832 var c1 = (1 + DvtFunnelSlice._FUNNEL_RATIO) / 2 * this._funnelHeight + ry;
77477833 var c2 = (1 - DvtFunnelSlice._FUNNEL_RATIO) / 2 * this._funnelHeight - ry;
77487834 var ar, arcDir1, arcDir2;
77497835
77507836 if (isBiDi) {
7751- ar = [rx * Math.sin(delta ) + offset, c1 - ry * Math.cos(delta ), rx * Math.sin(gamma ) + offset, c1 - ry * Math.cos(gamma ), rx * Math.sin(gamma ) + offset, c2 + ry * Math.cos(gamma ), rx * Math.sin(delta ) + offset, c2 + ry * Math.cos(delta )];
7837+ ar = [rx * Math.sin(startAngle ) + offset, c1 - ry * Math.cos(startAngle ), rx * Math.sin(endAngle ) + offset, c1 - ry * Math.cos(endAngle ), rx * Math.sin(endAngle ) + offset, c2 + ry * Math.cos(endAngle ), rx * Math.sin(startAngle ) + offset, c2 + ry * Math.cos(startAngle )];
77527838 arcDir1 = 0;
77537839 arcDir2 = 1;
77547840 } else {
7755- ar = [this._funnelWidth - offset - rx * Math.sin(delta ), c1 - ry * Math.cos(delta ), this._funnelWidth - offset - rx * Math.sin(gamma ), c1 - ry * Math.cos(gamma ), this._funnelWidth - offset - rx * Math.sin(gamma ), c2 + ry * Math.cos(gamma ), this._funnelWidth - offset - rx * Math.sin(delta ), c2 + ry * Math.cos(delta )];
7841+ ar = [this._funnelWidth - offset - rx * Math.sin(startAngle ), c1 - ry * Math.cos(startAngle ), this._funnelWidth - offset - rx * Math.sin(endAngle ), c1 - ry * Math.cos(endAngle ), this._funnelWidth - offset - rx * Math.sin(endAngle ), c2 + ry * Math.cos(endAngle ), this._funnelWidth - offset - rx * Math.sin(startAngle ), c2 + ry * Math.cos(startAngle )];
77567842 arcDir1 = 1;
77577843 arcDir2 = 0;
77587844 }
@@ -7815,7 +7901,7 @@ DvtFunnelSlice.prototype._getSliceLabel = function(sliceBounds, barBounds) {
78157901 label.setCSSStyle(style);
78167902
78177903 // Truncating text and dropping if doesn't fit.
7818- if (! DvtTextUtils.fitText(label, sliceBounds.h - 10 , sliceBounds.w, this, DvtFunnelSlice._MIN_CHARS_DATA_LABEL))
7904+ if (! DvtTextUtils.fitText(label, sliceBounds.h - this._3dRatio * (0.8 - this._valuePercent) * 50 , sliceBounds.w, this, DvtFunnelSlice._MIN_CHARS_DATA_LABEL))
78197905 return;
78207906
78217907 var textDim = label.measureDimensions();
0 commit comments