Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
5d829dce
Commit
5d829dce
authored
Oct 27, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for 3d pie chart(changes, delete unused)
parent
cfca1f34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
160 additions
and
451 deletions
+160
-451
common/Charts/ChartsDrawer.js
common/Charts/ChartsDrawer.js
+160
-451
No files found.
common/Charts/ChartsDrawer.js
View file @
5d829dce
...
...
@@ -7142,9 +7142,13 @@ drawPieChart.prototype =
this
.
cChartSpace
=
chartsDrawer
.
cChartSpace
;
if
(
this
.
cChartDrawer
.
nDimensionCount
===
3
)
{
this
.
_drawPie3D
();
}
else
{
this
.
_drawPie
();
}
},
recalculate
:
function
(
chartsDrawer
)
...
...
@@ -7159,11 +7163,11 @@ drawPieChart.prototype =
if
(
this
.
cChartDrawer
.
nDimensionCount
===
3
)
{
this
.
properties3d
=
this
.
cChartDrawer
.
processor3D
.
calculatePropertiesForPieCharts
();
this
.
_re
C
alculatePie3D
();
this
.
_re
с
alculatePie3D
();
}
else
{
this
.
_re
C
alculatePie
();
this
.
_re
с
alculatePie
();
}
},
...
...
@@ -7172,7 +7176,8 @@ drawPieChart.prototype =
var
numCache
=
this
.
_getFirstRealNumCache
();
var
brush
,
pen
,
val
;
var
path
;
for
(
var
i
=
0
,
len
=
numCache
.
length
;
i
<
len
;
i
++
)
{
for
(
var
i
=
0
,
len
=
numCache
.
length
;
i
<
len
;
i
++
)
{
val
=
numCache
[
i
];
brush
=
val
.
brush
;
pen
=
val
.
pen
;
...
...
@@ -7224,7 +7229,7 @@ drawPieChart.prototype =
},
_re
C
alculatePie3D_Slow
:
function
()
_re
с
alculatePie3D_Slow
:
function
()
{
var
trueWidth
=
this
.
chartProp
.
trueWidth
;
var
trueHeight
=
this
.
chartProp
.
trueHeight
;
...
...
@@ -7267,7 +7272,7 @@ drawPieChart.prototype =
},
_re
C
alculatePie
:
function
()
_re
с
alculatePie
:
function
()
{
var
trueWidth
=
this
.
chartProp
.
trueWidth
;
var
trueHeight
=
this
.
chartProp
.
trueHeight
;
...
...
@@ -7458,20 +7463,6 @@ drawPieChart.prototype =
return
path
;
},
_isVisibleVerge3D
:
function
(
k
,
n
,
m
,
val
)
{
//roberts method - calculate normal
var
aX
=
n
.
x
*
m
.
y
-
m
.
x
*
n
.
y
;
var
bY
=
-
(
k
.
x
*
m
.
y
-
m
.
x
*
k
.
y
);
var
cZ
=
k
.
x
*
n
.
y
-
n
.
x
*
k
.
y
;
var
visible
=
aX
+
bY
+
cZ
;
var
result
=
(
val
>
0
&&
visible
<
0
||
val
<
0
&&
visible
>
0
)
?
true
:
false
;
return
result
;
},
_changeAngle
:
function
(
radius
,
stAng
,
swAng
,
xCenter
,
yCenter
,
properties
)
{
var
depth
=
properties
.
depth
;
...
...
@@ -7486,7 +7477,6 @@ drawPieChart.prototype =
var
kFX
=
radius
/
radius1
;
var
kFY
=
radius
/
radius2
;
var
cX
;
if
(
this
.
cX
!==
null
)
cX
=
this
.
cX
;
...
...
@@ -7509,9 +7499,6 @@ drawPieChart.prototype =
var
x01
=
xCenter
+
radius
*
Math
.
cos
(
stAng
+
swAng
);
//if(stAng + swAng > (3/2) * Math.PI)
//x01 = xCenter - radius*Math.cos(stAng + swAng);
var
y01
=
yCenter
-
radius
*
Math
.
sin
(
stAng
+
swAng
);
var
aX
;
...
...
@@ -7538,9 +7525,7 @@ drawPieChart.prototype =
var
b
=
Math
.
sqrt
(
Math
.
pow
(
aX
-
cX
,
2
)
+
Math
.
pow
(
aY
-
cY
,
2
));
var
c
=
Math
.
sqrt
(
Math
.
pow
(
aX
-
xCenter
,
2
)
+
Math
.
pow
(
aY
-
yCenter
,
2
));
var
cosNewAngle
=
(
Math
.
pow
(
c
,
2
)
+
Math
.
pow
(
a
,
2
)
-
Math
.
pow
(
b
,
2
))
/
(
2
*
c
*
a
);
if
(
cosNewAngle
>
1
)
cosNewAngle
=
1
;
...
...
@@ -7556,129 +7541,6 @@ drawPieChart.prototype =
return
res
;
},
_calculateArc3D2
:
function
(
radius
,
stAng
,
swAng
,
xCenter
,
yCenter
)
{
var
path
=
new
Path
();
var
properties
=
this
.
cChartDrawer
.
processor3D
.
calculatePropertiesForPieCharts
();
var
depth
=
properties
.
depth
;
var
radius1
=
properties
.
radius1
;
var
radius2
=
properties
.
radius2
;
var
pathH
=
this
.
chartProp
.
pathH
;
var
pathW
=
this
.
chartProp
.
pathW
;
var
gdLst
=
[];
path
.
pathH
=
pathH
;
path
.
pathW
=
pathW
;
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
var
pxToMm
=
this
.
chartProp
.
pxToMM
;
//корректируем центр
yCenter
=
yCenter
-
depth
/
2
;
var
x0
=
xCenter
+
radius
*
Math
.
cos
(
stAng
);
var
y0
=
yCenter
-
radius
*
Math
.
sin
(
stAng
);
var
kFX
=
radius
/
radius1
;
var
kFY
=
radius
/
radius2
;
var
x
;
if
(
x0
<
xCenter
)
x
=
xCenter
-
(
xCenter
-
x0
)
/
kFX
;
else
if
(
x0
>
xCenter
)
x
=
xCenter
+
(
x0
-
xCenter
)
/
kFX
;
else
x
=
xCenter
;
var
y
;
if
(
y0
<
yCenter
)
y
=
yCenter
-
(
yCenter
-
y0
)
/
kFY
;
else
if
(
y0
>
yCenter
)
y
=
yCenter
+
(
y0
-
yCenter
)
/
kFY
;
else
y
=
yCenter
;
var
x01
=
xCenter
+
radius
*
Math
.
cos
(
stAng
+
swAng
);
var
y01
=
yCenter
-
radius
*
Math
.
sin
(
stAng
+
swAng
);
var
x1
;
if
(
x01
<
xCenter
)
x1
=
xCenter
-
(
xCenter
-
x01
)
/
kFX
;
else
if
(
x0
>
xCenter
)
x1
=
xCenter
+
(
x01
-
xCenter
)
/
kFX
;
else
x1
=
xCenter
;
var
y1
;
if
(
y01
<
yCenter
)
y1
=
yCenter
-
(
yCenter
-
y01
)
/
kFY
;
else
if
(
y01
>
yCenter
)
y1
=
yCenter
+
(
y01
-
yCenter
)
/
kFY
;
else
y1
=
yCenter
;
/*path.moveTo(x /pxToMm * pathW, y / pxToMm * pathH);
path.arcTo(radius1 / pxToMm * pathW, radius2 / pxToMm * pathH, -1 * stAng*cToDeg, -1 * swAng*cToDeg);
path.lnTo(x1 /pxToMm * pathW, y1 / pxToMm * pathH);
path.arcTo(radius1 / pxToMm * pathW, radius2 / pxToMm * pathH, -1 * stAng*cToDeg - 1 * swAng*cToDeg, 1 * swAng*cToDeg);
path.lnTo(x / pxToMm * pathW, y / pxToMm * pathH);*/
path
.
moveTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
lnTo
(
x0
/
pxToMm
*
pathW
,
y0
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius1
/
pxToMm
*
pathW
,
radius2
/
pxToMm
*
pathH
,
-
1
*
stAng
*
cToDeg
,
-
1
*
swAng
*
cToDeg
);
path
.
lnTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
recalculate
(
gdLst
);
var
frontPath
=
path
;
return
{
frontPath
:
frontPath
,
upPath
:
null
};
},
_calculateArc3DWithoutZ
:
function
(
radius
,
stAng
,
swAng
,
xCenter
,
yCenter
)
{
var
properties
=
this
.
cChartDrawer
.
processor3D
.
calculatePropertiesForPieCharts
();
var
depth
=
properties
.
depth
;
var
radius1
=
properties
.
radius1
;
var
radius2
=
properties
.
radius2
;
var
pxToMm
=
this
.
chartProp
.
pxToMM
;
var
view3DProp
=
this
.
cChartSpace
.
chart
.
view3D
;
var
angleOx
=
view3DProp
&&
view3DProp
.
rotX
?
(
-
view3DProp
.
rotX
/
360
)
*
(
Math
.
PI
*
2
)
:
0
;
var
angleOy
=
view3DProp
&&
view3DProp
.
rotY
?
(
-
view3DProp
.
rotY
/
360
)
*
(
Math
.
PI
*
2
)
:
0
;
var
angleOz
=
0
;
var
path
=
new
Path
();
var
pathH
=
this
.
chartProp
.
pathH
;
var
pathW
=
this
.
chartProp
.
pathW
;
var
gdLst
=
[];
path
.
pathH
=
pathH
;
path
.
pathW
=
pathW
;
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
var
convertResult
=
this
.
cChartDrawer
.
processor3D
.
convertAndTurnPointForPie
(
xCenter
+
radius
*
Math
.
cos
(
stAng
),
yCenter
-
radius
*
Math
.
sin
(
stAng
),
0
,
angleOx
,
angleOy
,
angleOz
);
var
x0
=
convertResult
.
x
;
var
y0
=
convertResult
.
y
;
path
.
moveTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
lnTo
(
x0
/
pxToMm
*
pathW
,
y0
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius
/
pxToMm
*
pathW
,
radius
/
pxToMm
*
pathH
,
-
1
*
stAng
*
cToDeg
,
-
1
*
swAng
*
cToDeg
);
path
.
lnTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
recalculate
(
gdLst
);
var
upPath
=
path
;
return
{
frontPath
:
null
,
upPath
:
upPath
};
},
_calculateBestFitPosition
:
function
(
fStartAngle
,
fSweepAngle
,
fRadius
,
fWidth
,
fHeight
,
fCenterX
,
fCenterY
,
bLayout
){
var
fStartAngle_
=
fStartAngle
;
var
fEndAngle
=
fStartAngle
+
fSweepAngle
;
...
...
@@ -8187,11 +8049,8 @@ drawPieChart.prototype =
return
{
x
:
centerX
,
y
:
centerY
};
},
//****fast calulate and drawing(for switch on slow drawing: change name function _Slow)
_re
C
alculatePie3D
:
function
()
_re
с
alculatePie3D
:
function
()
{
var
trueWidth
=
this
.
chartProp
.
trueWidth
;
var
trueHeight
=
this
.
chartProp
.
trueHeight
;
...
...
@@ -8214,14 +8073,13 @@ drawPieChart.prototype =
this
.
angleFor3D
=
Math
.
PI
/
2
-
startAngle3D
;
startAngle
=
startAngle
+
Math
.
PI
/
2
;
//this.angleFor3D = this.angleFor3D + Math.PI / 2;
for
(
var
i
=
numCache
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
val
=
numCache
[
i
].
val
;
var
partOfSum
=
numCache
[
i
].
val
/
sumData
;
var
swapAngle
=
Math
.
abs
((
parseFloat
(
partOfSum
))
*
(
Math
.
PI
*
2
));
if
(
!
this
.
paths
.
series
)
this
.
paths
.
series
=
[];
if
(
sumData
===
0
)
//TODO стоит пересмотреть
...
...
@@ -8247,28 +8105,26 @@ drawPieChart.prototype =
var
pathW
=
this
.
chartProp
.
pathW
;
var
t
=
this
;
//FRONT FACES
var
gdLst
=
[];
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
swAng
=
this
.
_changeAngle
(
radius
,
stAng
,
swAng
,
xCenter
,
yCenter
,
properties
);
stAng
=
this
.
angleFor3D
;
//корректируем центр
yCenter
=
yCenter
-
depth
/
2
;
var
calculateInsideFaces
=
function
(
startAng
,
swapAng
)
var
getNewPath
=
function
()
{
var
endAng
=
startAng
+
swapAng
;
var
path
=
new
Path
();
var
gdLst
=
[];
path
.
pathH
=
pathH
;
path
.
pathW
=
pathW
;
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
return
path
;
};
var
getSegmentPoints
=
function
(
startAng
,
endAng
)
{
var
radiusSpec
=
(
radius1
*
radius2
)
/
Math
.
sqrt
(
Math
.
pow
(
radius2
,
2
)
*
Math
.
pow
((
Math
.
cos
(
startAng
)),
2
)
+
Math
.
pow
(
radius1
,
2
)
*
Math
.
pow
(
Math
.
sin
(
startAng
),
2
));
var
radiusSpec2
=
(
radius1
*
radius2
)
/
Math
.
sqrt
(
Math
.
pow
(
radius2
,
2
)
*
Math
.
pow
((
Math
.
cos
(
endAng
)),
2
)
+
Math
.
pow
(
radius1
,
2
)
*
Math
.
pow
(
Math
.
sin
(
endAng
),
2
));
...
...
@@ -8284,14 +8140,71 @@ drawPieChart.prototype =
var
x3
=
(
xCenter
+
radiusSpec2
*
Math
.
cos
(
endAng
));
var
y3
=
((
yCenter
+
depth
)
-
radiusSpec2
*
Math
.
sin
(
endAng
));
return
{
x0
:
x0
,
y0
:
y0
,
x1
:
x1
,
y1
:
y1
,
x2
:
x2
,
y2
:
y2
,
x3
:
x3
,
y3
:
y3
};
};
var
breakAng
=
function
(
startAng
,
swapAng
)
{
var
res
=
[];
var
endAng
=
startAng
+
swapAng
;
res
.
push
({
angle
:
startAng
});
if
(
startAng
<
-
2
*
Math
.
PI
&&
endAng
>
-
2
*
Math
.
PI
)
{
res
.
push
({
angle
:
-
2
*
Math
.
PI
});
}
/*if(startAng < -3/2*Math.PI && endAng > -3/2*Math.PI)
{
res.push({angle: -3/2*Math.PI});
}*/
if
(
startAng
<
-
Math
.
PI
&&
endAng
>
-
Math
.
PI
)
{
res
.
push
({
angle
:
-
Math
.
PI
});
}
/*if(startAng < -Math.PI/2 && endAng > -Math.PI/2)
{
res.push({angle: -Math.PI/2});
}*/
if
(
startAng
<
0
&&
endAng
>
0
)
{
res
.
push
({
angle
:
0
});
}
/*if(startAng < Math.PI/2 && endAng > Math.PI/2)
{
res.push({angle: Math.PI/2});
}*/
if
(
startAng
<
Math
.
PI
&&
endAng
>
Math
.
PI
)
{
res
.
push
({
angle
:
Math
.
PI
});
}
/*if(startAng < 3/2*Math.PI && endAng > 3/2*Math.PI)
{
res.push({angle: 3/2*Math.PI});
}*/
if
(
startAng
<
2
*
Math
.
PI
&&
endAng
>
2
*
Math
.
PI
)
{
res
.
push
({
angle
:
2
*
Math
.
PI
});
}
res
.
push
({
angle
:
endAng
});
return
res
;
};
var
calculateInsideFaces
=
function
(
startAng
,
swapAng
)
{
var
path
=
getNewPath
();
var
endAng
=
startAng
+
swapAng
;
var
p
=
getSegmentPoints
(
startAng
,
endAng
);
path
.
moveTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
lnTo
(
x0
/
pxToMm
*
pathW
,
y0
/
pxToMm
*
pathH
);
path
.
lnTo
(
x1
/
pxToMm
*
pathW
,
y1
/
pxToMm
*
pathH
);
path
.
lnTo
(
p
.
x0
/
pxToMm
*
pathW
,
p
.
y0
/
pxToMm
*
pathH
);
path
.
lnTo
(
p
.
x1
/
pxToMm
*
pathW
,
p
.
y1
/
pxToMm
*
pathH
);
path
.
lnTo
(
xCenter
/
pxToMm
*
pathW
,
(
yCenter
+
depth
)
/
pxToMm
*
pathH
);
path
.
moveTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
lnTo
(
x2
/
pxToMm
*
pathW
,
y2
/
pxToMm
*
pathH
);
path
.
lnTo
(
x3
/
pxToMm
*
pathW
,
y3
/
pxToMm
*
pathH
);
path
.
lnTo
(
p
.
x2
/
pxToMm
*
pathW
,
p
.
y2
/
pxToMm
*
pathH
);
path
.
lnTo
(
p
.
x3
/
pxToMm
*
pathW
,
p
.
y3
/
pxToMm
*
pathH
);
path
.
lnTo
(
xCenter
/
pxToMm
*
pathW
,
(
yCenter
+
depth
)
/
pxToMm
*
pathH
);
path
.
recalculate
(
gdLst
);
...
...
@@ -8301,83 +8214,41 @@ drawPieChart.prototype =
var
calculateFrontFace
=
function
(
startAng
,
swapAng
)
{
var
endAng
=
startAng
+
swapAng
;
var
path
=
new
Path
();
var
gdLst
=
[];
var
path
=
getNewPath
();
path
.
pathH
=
pathH
;
path
.
pathW
=
pathW
;
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
var
radiusSpec
=
(
radius1
*
radius2
)
/
Math
.
sqrt
(
Math
.
pow
(
radius2
,
2
)
*
Math
.
pow
((
Math
.
cos
(
startAng
)),
2
)
+
Math
.
pow
(
radius1
,
2
)
*
Math
.
pow
(
Math
.
sin
(
startAng
),
2
));
var
radiusSpec2
=
(
radius1
*
radius2
)
/
Math
.
sqrt
(
Math
.
pow
(
radius2
,
2
)
*
Math
.
pow
((
Math
.
cos
(
endAng
)),
2
)
+
Math
.
pow
(
radius1
,
2
)
*
Math
.
pow
(
Math
.
sin
(
endAng
),
2
));
var
endAng
=
startAng
+
swapAng
;
var
p
=
getSegmentPoints
(
startAng
,
endAng
);
var
x0
=
(
xCenter
+
radiusSpec
*
Math
.
cos
(
startAng
));
var
y0
=
(
yCenter
-
radiusSpec
*
Math
.
sin
(
startAng
));
path
.
moveTo
(
p
.
x0
/
pxToMm
*
pathW
,
p
.
y0
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius1
/
pxToMm
*
pathW
,
radius2
/
pxToMm
*
pathH
,
-
1
*
startAng
*
cToDeg
,
-
1
*
swapAng
*
cToDeg
);
path
.
lnTo
(
p
.
x3
/
pxToMm
*
pathW
,
p
.
y3
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius1
/
pxToMm
*
pathW
,
radius2
/
pxToMm
*
pathH
,
-
1
*
startAng
*
cToDeg
-
1
*
swapAng
*
cToDeg
,
1
*
swapAng
*
cToDeg
);
path
.
lnTo
(
p
.
x0
/
pxToMm
*
pathW
,
p
.
y0
/
pxToMm
*
pathH
);
path
.
recalculate
(
gdLst
);
var
x1
=
(
xCenter
+
radiusSpec
*
Math
.
cos
(
startAng
));
var
y1
=
((
yCenter
+
depth
)
-
radiusSpec
*
Math
.
sin
(
startAng
));
return
path
;
};
var
calculateUpFace
=
function
(
startAng
,
swapAng
)
{
var
path
=
getNewPath
();
var
x2
=
(
xCenter
+
radiusSpec2
*
Math
.
cos
(
endAng
))
;
var
y2
=
(
yCenter
-
radiusSpec2
*
Math
.
sin
(
endAng
)
);
var
endAng
=
startAng
+
swapAng
;
var
p
=
getSegmentPoints
(
startAng
,
endAng
);
var
x3
=
(
xCenter
+
radiusSpec2
*
Math
.
cos
(
endAng
));
var
y3
=
((
yCenter
+
depth
)
-
radiusSpec2
*
Math
.
sin
(
endAng
));
path
.
moveTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
lnTo
(
p
.
x0
/
pxToMm
*
pathW
,
p
.
y0
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius1
/
pxToMm
*
pathW
,
radius2
/
pxToMm
*
pathH
,
-
1
*
stAng
*
cToDeg
,
-
1
*
swapAng
*
cToDeg
);
path
.
lnTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
moveTo
(
x0
/
pxToMm
*
pathW
,
y0
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius1
/
pxToMm
*
pathW
,
radius2
/
pxToMm
*
pathH
,
-
1
*
startAng
*
cToDeg
,
-
1
*
swapAng
*
cToDeg
);
path
.
lnTo
(
x3
/
pxToMm
*
pathW
,
y3
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius1
/
pxToMm
*
pathW
,
radius2
/
pxToMm
*
pathH
,
-
1
*
startAng
*
cToDeg
-
1
*
swapAng
*
cToDeg
,
1
*
swapAng
*
cToDeg
);
path
.
lnTo
(
x0
/
pxToMm
*
pathW
,
y0
/
pxToMm
*
pathH
);
path
.
recalculate
(
gdLst
);
return
path
;
}
//FRONT FACES
//break front faces
var
arrAngles
=
[];
var
endAng
=
stAng
+
swAng
;
arrAngles
.
push
({
angle
:
stAng
});
if
(
stAng
<
-
2
*
Math
.
PI
&&
endAng
>
-
2
*
Math
.
PI
)
{
arrAngles
.
push
({
angle
:
-
2
*
Math
.
PI
});
}
/*if(stAng < -3/2*Math.PI && endAng > -3/2*Math.PI)
{
arrAngles.push({angle: -3/2*Math.PI});
}*/
if
(
stAng
<
-
Math
.
PI
&&
endAng
>
-
Math
.
PI
)
{
arrAngles
.
push
({
angle
:
-
Math
.
PI
});
}
/*if(stAng < -Math.PI/2 && endAng > -Math.PI/2)
{
arrAngles.push({angle: -Math.PI/2});
}*/
if
(
stAng
<
0
&&
endAng
>
0
)
{
arrAngles
.
push
({
angle
:
0
});
}
/*if(stAng < Math.PI/2 && endAng > Math.PI/2)
{
arrAngles.push({angle: Math.PI/2});
}*/
if
(
stAng
<
Math
.
PI
&&
endAng
>
Math
.
PI
)
{
arrAngles
.
push
({
angle
:
Math
.
PI
});
}
/*if(stAng < 3/2*Math.PI && endAng > 3/2*Math.PI)
{
arrAngles.push({angle: 3/2*Math.PI});
}*/
if
(
stAng
<
2
*
Math
.
PI
&&
endAng
>
2
*
Math
.
PI
)
{
arrAngles
.
push
({
angle
:
2
*
Math
.
PI
});
}
arrAngles
.
push
({
angle
:
endAng
});
var
arrAngles
=
breakAng
(
stAng
,
swAng
);
var
frontPath
=
[];
for
(
var
i
=
1
;
i
<
arrAngles
.
length
;
i
++
)
{
...
...
@@ -8392,44 +8263,10 @@ drawPieChart.prototype =
}
//INSIDE FACES
var
insidePath
=
[];
insidePath
.
push
(
calculateInsideFaces
(
stAng
,
swAng
));
var
insidePath
=
calculateInsideFaces
(
stAng
,
swAng
);
//UP FACE
var
path
=
new
Path
();
var
gdLst
=
[];
var
radiusSpec
=
(
radius1
*
radius2
)
/
Math
.
sqrt
(
Math
.
pow
(
radius2
,
2
)
*
Math
.
pow
((
Math
.
cos
(
stAng
)),
2
)
+
Math
.
pow
(
radius1
,
2
)
*
Math
.
pow
(
Math
.
sin
(
stAng
),
2
));
var
radiusSpec2
=
(
radius1
*
radius2
)
/
Math
.
sqrt
(
Math
.
pow
(
radius2
,
2
)
*
Math
.
pow
((
Math
.
cos
(
stAng
+
swAng
)),
2
)
+
Math
.
pow
(
radius1
,
2
)
*
Math
.
pow
(
Math
.
sin
(
stAng
+
swAng
),
2
));
var
kFY
=
1
;
var
kFX
=
1
;
var
x0
=
(
xCenter
+
radiusSpec
*
Math
.
cos
(
stAng
))
*
kFX
;
var
y0
=
(
yCenter
-
radiusSpec
*
Math
.
sin
(
stAng
))
*
kFY
;
var
x1
=
(
xCenter
+
radiusSpec
*
Math
.
cos
(
stAng
))
*
kFX
;
var
y1
=
((
yCenter
+
depth
)
-
radiusSpec
*
Math
.
sin
(
stAng
))
*
kFY
;
var
x2
=
(
xCenter
+
radiusSpec2
*
Math
.
cos
(
stAng
+
swAng
))
*
kFX
;
var
y2
=
(
yCenter
-
radiusSpec2
*
Math
.
sin
(
stAng
+
swAng
))
*
kFY
;
var
x3
=
(
xCenter
+
radiusSpec2
*
Math
.
cos
(
stAng
+
swAng
))
*
kFX
;
var
y3
=
((
yCenter
+
depth
)
-
radiusSpec2
*
Math
.
sin
(
stAng
+
swAng
))
*
kFY
;
path
.
pathH
=
pathH
;
path
.
pathW
=
pathW
;
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
path
.
moveTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
lnTo
(
x0
/
pxToMm
*
pathW
,
y0
/
pxToMm
*
pathH
);
path
.
arcTo
(
radius1
/
pxToMm
*
pathW
,
radius2
/
pxToMm
*
pathH
,
-
1
*
stAng
*
cToDeg
,
-
1
*
swAng
*
cToDeg
);
path
.
lnTo
(
xCenter
/
pxToMm
*
pathW
,
yCenter
/
pxToMm
*
pathH
);
path
.
recalculate
(
gdLst
);
var
upPath
=
path
;
var
upPath
=
calculateUpFace
(
stAng
,
swAng
);
this
.
angleFor3D
+=
swAng
;
...
...
@@ -8443,103 +8280,13 @@ drawPieChart.prototype =
return
null
;
}
var
endAngle
=
startAngle
+
swapAngle
;
if
(
radius
<
0
)
{
radius
=
0
;
}
var
path
=
[];
var
arrAngles
=
[];
arrAngles
.
push
({
angle
:
startAngle
});
/*if(startAngle < -2*Math.PI && endAngle > -2*Math.PI)
{
arrAngles.push({angle: -2*Math.PI});
}
if(startAngle < -3/2*Math.PI && endAngle > -3/2*Math.PI)
{
arrAngles.push({angle: -3/2*Math.PI});
}
if(startAngle < -Math.PI && endAngle > -Math.PI)
{
arrAngles.push({angle: -Math.PI});
}
if(startAngle < -Math.PI/2 && endAngle > -Math.PI/2)
{
arrAngles.push({angle: -Math.PI/2});
}
if(startAngle < 0 && endAngle > 0)
{
arrAngles.push({angle: 0});
}
if(startAngle < Math.PI/2 && endAngle > Math.PI/2)
{
arrAngles.push({angle: Math.PI/2});
}
if(startAngle < Math.PI && endAngle > Math.PI)
{
arrAngles.push({angle: Math.PI});
}
if(startAngle < 3/2*Math.PI && endAngle > 3/2*Math.PI)
{
arrAngles.push({angle: 3/2*Math.PI});
}
if(startAngle < 2*Math.PI && endAngle > 2*Math.PI)
{
arrAngles.push({angle: 2*Math.PI});
}*/
arrAngles
.
push
({
angle
:
endAngle
});
for
(
var
i
=
1
;
i
<
arrAngles
.
length
;
i
++
)
{
var
start
=
arrAngles
[
i
-
1
].
angle
;
var
end
=
arrAngles
[
i
].
angle
;
var
swap
=
end
-
start
;
var
bIsNotDrawFrontFace
;
/*if(start + swap/2 > Math.PI && start + swap/2 < 2*Math.PI)
{
bIsNotDrawFrontFace = true;
}*/
path
.
push
(
this
.
_calculateArc3D
(
radius
,
start
,
swap
,
xCenter
,
yCenter
,
bIsNotDrawFrontFace
));
}
//если сегмент проходит 180 или 360 градусов, разбиваем его на два, чтобы боковая грань рисовалась корректно
/*if(startAngle < 0 && endAngle > 0)
{
path.push(this._calculateArc3D(radius, startAngle, 0, xCenter, yCenter));
path.push(this._calculateArc3D(radius, 0, endAngle, xCenter, yCenter));
}
if(startAngle < Math.PI && endAngle > Math.PI)
{
path.push(this._calculateArc3D(radius, startAngle, Math.PI - startAngle, xCenter, yCenter));
path.push(this._calculateArc3D(radius, Math.PI, endAngle - Math.PI, xCenter, yCenter));
}
else if(startAngle < 2*Math.PI && endAngle > 2*Math.PI)
{
path.push(this._calculateArc3D(radius, startAngle, 2*Math.PI - startAngle, xCenter, yCenter));
path.push(this._calculateArc3D(radius, 2*Math.PI, endAngle - 2*Math.PI, xCenter, yCenter));
}
else if(startAngle < -Math.PI && endAngle > -Math.PI)
{
path.push(this._calculateArc3D(radius, startAngle, - Math.PI - startAngle, xCenter, yCenter));
path.push(this._calculateArc3D(radius, Math.PI, endAngle + Math.PI, xCenter, yCenter));
}
else if(startAngle < -2*Math.PI && endAngle > -2*Math.PI)
{
path.push(this._calculateArc3D(radius, startAngle, -2*Math.PI - startAngle, xCenter, yCenter));
path.push(this._calculateArc3D(radius, 2*Math.PI, endAngle + 2*Math.PI, xCenter, yCenter));
}
else
{
path.push(this._calculateArc3D(radius, startAngle, swapAngle, xCenter, yCenter));
}*/
path
.
push
(
this
.
_calculateArc3D
(
radius
,
startAngle
,
swapAngle
,
xCenter
,
yCenter
));
return
path
;
},
...
...
@@ -8548,130 +8295,92 @@ drawPieChart.prototype =
_drawPie3D
:
function
()
{
var
numCache
=
this
.
_getFirstRealNumCache
();
var
brush
,
pen
,
val
;
var
path
;
var
t
=
this
;
var
shade
=
"
shade
"
;
var
shadeValue
=
35000
;
var
drawPath
=
function
(
path
,
pen
,
brush
,
isShadePen
,
isShadeBrush
)
{
if
(
path
)
{
var
props
=
t
.
cChartSpace
.
getParentObjects
();
var
duplicateBrush
=
brush
.
createDuplicate
();
var
cColorMod
=
new
AscFormat
.
CColorMod
;
cColorMod
.
val
=
shadeValue
;
cColorMod
.
name
=
shade
;
if
(
duplicateBrush
.
fill
.
color
)
{
duplicateBrush
.
fill
.
color
.
Mods
.
addMod
(
cColorMod
);
duplicateBrush
.
calculate
(
props
.
theme
,
props
.
slide
,
props
.
layout
,
props
.
master
,
new
AscFormat
.
CUniColor
().
RGBA
);
}
if
(
isShadePen
)
{
pen
=
AscFormat
.
CreatePenFromParams
(
duplicateBrush
,
undefined
,
undefined
,
undefined
,
undefined
,
0
);
}
if
(
isShadeBrush
)
{
brush
=
duplicateBrush
;
}
t
.
cChartDrawer
.
drawPath
(
path
,
pen
,
brush
);
}
};
//INSIDE
for
(
var
i
=
0
,
len
=
numCache
.
length
;
i
<
len
;
i
++
)
{
val
=
numCache
[
i
];
brush
=
val
.
brush
;
pen
=
val
.
pen
;
path
=
this
.
paths
.
series
[
i
];
va
r
va
l
=
numCache
[
i
];
var
brush
=
val
.
brush
;
var
pen
=
val
.
pen
;
var
path
=
this
.
paths
.
series
[
i
];
if
(
path
)
{
for
(
var
j
=
path
.
length
-
1
;
j
>=
0
;
j
--
)
{
if
(
path
[
j
]
&&
path
[
j
].
insidePath
)
{
var
props
=
this
.
cChartSpace
.
getParentObjects
();
var
duplicateBrush
=
brush
.
createDuplicate
();
var
cColorMod
=
new
AscFormat
.
CColorMod
;
cColorMod
.
val
=
35000
;
cColorMod
.
name
=
"
shade
"
;
if
(
duplicateBrush
.
fill
.
color
)
duplicateBrush
.
fill
.
color
.
Mods
.
addMod
(
cColorMod
);
duplicateBrush
.
calculate
(
props
.
theme
,
props
.
slide
,
props
.
layout
,
props
.
master
,
new
AscFormat
.
CUniColor
().
RGBA
);
//var upPen = AscFormat.CreatePenFromParams(brush, undefined, undefined, undefined, undefined, 0);
var
frontPen
=
AscFormat
.
CreatePenFromParams
(
duplicateBrush
,
undefined
,
undefined
,
undefined
,
undefined
,
0
);
//pen.setFill(duplicateBrush);
//if(!(i === numCache.length - 1 && j === path.length - 1))
for
(
var
k
=
0
;
k
<
path
[
j
].
insidePath
.
length
;
k
++
)
{
this
.
cChartDrawer
.
drawPath
(
path
[
j
].
insidePath
[
k
],
pen
,
duplicateBrush
);
}
}
//if(path[j] && path[j].upPath)
//this.cChartDrawer.drawPath(path[j].upPath, upPen, brush);
drawPath
(
path
[
j
].
insidePath
,
pen
,
brush
,
null
,
true
);
}
}
}
//FRONT
for
(
var
i
=
0
,
len
=
numCache
.
length
;
i
<
len
;
i
++
)
{
val
=
numCache
[
i
];
brush
=
val
.
brush
;
pen
=
val
.
pen
;
path
=
this
.
paths
.
series
[
i
];
va
r
va
l
=
numCache
[
i
];
var
brush
=
val
.
brush
;
var
pen
=
val
.
pen
;
var
path
=
this
.
paths
.
series
[
i
];
if
(
path
)
{
for
(
var
j
=
path
.
length
-
1
;
j
>=
0
;
j
--
)
{
if
(
path
[
j
]
&&
path
[
j
].
frontPath
)
for
(
var
k
=
0
;
k
<
path
[
j
].
frontPath
.
length
;
k
++
)
{
var
props
=
this
.
cChartSpace
.
getParentObjects
();
var
duplicateBrush
=
brush
.
createDuplicate
();
var
cColorMod
=
new
AscFormat
.
CColorMod
;
cColorMod
.
val
=
35000
;
cColorMod
.
name
=
"
shade
"
;
if
(
duplicateBrush
.
fill
.
color
)
duplicateBrush
.
fill
.
color
.
Mods
.
addMod
(
cColorMod
);
duplicateBrush
.
calculate
(
props
.
theme
,
props
.
slide
,
props
.
layout
,
props
.
master
,
new
AscFormat
.
CUniColor
().
RGBA
);
//var upPen = AscFormat.CreatePenFromParams(brush, undefined, undefined, undefined, undefined, 0);
var
frontPen
=
AscFormat
.
CreatePenFromParams
(
duplicateBrush
,
undefined
,
undefined
,
undefined
,
undefined
,
0
);
//pen.setFill(duplicateBrush);
//if(!(i === numCache.length - 1 && j === path.length - 1))
for
(
var
k
=
0
;
k
<
path
[
j
].
frontPath
.
length
;
k
++
)
{
this
.
cChartDrawer
.
drawPath
(
path
[
j
].
frontPath
[
k
],
frontPen
,
duplicateBrush
);
}
drawPath
(
path
[
j
].
frontPath
[
k
],
pen
,
brush
,
true
,
true
);
}
//if(path[j] && path[j].upPath)
//this.cChartDrawer.drawPath(path[j].upPath, upPen, brush);
}
}
}
//UP
for
(
var
i
=
0
,
len
=
numCache
.
length
;
i
<
len
;
i
++
)
{
val
=
numCache
[
i
];
brush
=
val
.
brush
;
pen
=
val
.
pen
;
path
=
this
.
paths
.
series
[
i
];
va
r
va
l
=
numCache
[
i
];
var
brush
=
val
.
brush
;
var
pen
=
val
.
pen
;
var
path
=
this
.
paths
.
series
[
i
];
if
(
path
)
{
for
(
var
j
=
path
.
length
-
1
;
j
>=
0
;
j
--
)
{
if
(
path
[
j
]
&&
path
[
j
].
upPath
)
{
var
props
=
this
.
cChartSpace
.
getParentObjects
();
var
duplicateBrush
=
brush
.
createDuplicate
();
var
cColorMod
=
new
AscFormat
.
CColorMod
;
cColorMod
.
val
=
35000
;
cColorMod
.
name
=
"
shade
"
;
if
(
duplicateBrush
.
fill
.
color
)
duplicateBrush
.
fill
.
color
.
Mods
.
addMod
(
cColorMod
);
duplicateBrush
.
calculate
(
props
.
theme
,
props
.
slide
,
props
.
layout
,
props
.
master
,
new
AscFormat
.
CUniColor
().
RGBA
);
//var upPen = AscFormat.CreatePenFromParams(brush, undefined, undefined, undefined, undefined, 0);
//var frontPen = AscFormat.CreatePenFromParams(duplicateBrush, undefined, undefined, undefined, undefined, 0);
if
(
null
===
pen
)
{
pen
=
AscFormat
.
CreatePenFromParams
(
duplicateBrush
,
undefined
,
undefined
,
undefined
,
undefined
,
0
);
}
//pen.setFill(duplicateBrush);
//if(!(i === numCache.length - 1 && j === path.length - 1))
//this.cChartDrawer.drawPath(path[j].frontPath, frontPen, duplicateBrush);
this
.
cChartDrawer
.
drawPath
(
path
[
j
].
upPath
,
pen
,
brush
);
}
drawPath
(
path
[
j
].
upPath
,
pen
,
brush
);
}
}
}
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment