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
dde95331
Commit
dde95331
authored
Dec 05, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes for angles calculating
parent
e1834561
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
14 deletions
+74
-14
common/Charts/ChartsDrawer.js
common/Charts/ChartsDrawer.js
+74
-14
No files found.
common/Charts/ChartsDrawer.js
View file @
dde95331
...
...
@@ -8513,10 +8513,12 @@ drawPieChart.prototype =
var
numCache
=
this
.
_getFirstRealNumCache
();
var
sumData
=
this
.
cChartDrawer
.
_getSumArray
(
numCache
,
true
);
var
startAngle
=
this
.
cChartSpace
.
chart
.
view3D
&&
this
.
cChartSpace
.
chart
.
view3D
.
rotY
?
(
-
this
.
cChartSpace
.
chart
.
view3D
.
rotY
/
360
)
*
(
Math
.
PI
*
2
)
:
0
startAngle
+=
Math
.
PI
/
2
;
var
startAngle
=
Math
.
PI
/
2
;
var
newStartAngle
=
startAngle
;
var
firstAngle
=
this
.
cChartSpace
.
chart
.
view3D
&&
this
.
cChartSpace
.
chart
.
view3D
.
rotY
?
(
-
this
.
cChartSpace
.
chart
.
view3D
.
rotY
/
360
)
*
(
Math
.
PI
*
2
)
:
0
;
var
getAngleByCoordsSidesTriangle
=
function
(
aC
,
bC
,
cC
)
{
var
res
;
...
...
@@ -8550,14 +8552,35 @@ drawPieChart.prototype =
};
var
angles
=
[];
for
(
var
i
=
numCache
.
length
-
1
;
i
>=
0
;
i
--
)
for
(
var
i
=
numCache
.
length
;
i
>=
0
;
i
--
)
{
//рассчитываем угол
if
(
i
===
numCache
.
length
)
{
var
swapAngle
=
firstAngle
}
else
{
var
partOfSum
=
numCache
[
i
].
val
/
sumData
;
var
swapAngle
=
Math
.
abs
((
parseFloat
(
partOfSum
))
*
(
Math
.
PI
*
2
));
}
var
tempSwapAngle
=
0
,
newSwapAngle
=
0
,
tempStartAngle
=
startAngle
;
while
(
true
)
{
if
(
i
===
numCache
.
length
&&
swapAngle
<
0
)
{
if
(
tempStartAngle
-
Math
.
PI
/
2
>
startAngle
+
swapAngle
)
{
tempSwapAngle
=
-
Math
.
PI
/
2
;
}
else
{
tempSwapAngle
=
(
startAngle
+
swapAngle
)
-
tempStartAngle
;
}
}
else
{
if
(
tempStartAngle
+
Math
.
PI
/
2
<
startAngle
+
swapAngle
)
{
...
...
@@ -8567,26 +8590,63 @@ drawPieChart.prototype =
{
tempSwapAngle
=
(
startAngle
+
swapAngle
)
-
tempStartAngle
;
}
}
var
p1
=
getPointsByAngle
(
tempStartAngle
);
var
p2
=
getPointsByAngle
(
tempStartAngle
+
tempSwapAngle
);
newSwapAngle
+=
getAngleByCoordsSidesTriangle
({
x
:
p2
.
x
-
p1
.
x
,
y
:
p2
.
y
-
p1
.
y
},
{
x
:
xCenter
-
p1
.
x
,
y
:
yCenter
-
p1
.
y
},
{
x
:
xCenter
-
p2
.
x
,
y
:
yCenter
-
p2
.
y
});
if
(
i
===
numCache
.
length
&&
swapAngle
<
0
)
{
if
(
tempStartAngle
-
Math
.
PI
/
2
>
startAngle
+
swapAngle
)
{
tempStartAngle
-=
Math
.
PI
/
2
;
}
else
{
if
(
i
!==
numCache
.
length
)
angles
.
push
({
start
:
newStartAngle
,
swap
:
newSwapAngle
,
end
:
newStartAngle
+
newSwapAngle
});
break
;
}
}
else
{
if
(
tempStartAngle
+
Math
.
PI
/
2
<
startAngle
+
swapAngle
)
{
tempStartAngle
+=
Math
.
PI
/
2
;
}
else
{
if
(
i
!==
numCache
.
length
)
angles
.
push
({
start
:
newStartAngle
,
swap
:
newSwapAngle
,
end
:
newStartAngle
+
newSwapAngle
});
break
;
}
}
}
startAngle
+=
swapAngle
;
if
(
i
===
numCache
.
length
)
{
if
(
swapAngle
<
0
)
{
newStartAngle
-=
newSwapAngle
;
}
else
{
newStartAngle
+=
newSwapAngle
;
}
}
else
{
newStartAngle
+=
newSwapAngle
;
}
}
return
angles
;
},
...
...
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