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
addf2669
Commit
addf2669
authored
Dec 15, 2016
by
GoshaZotov
Committed by
GitHub
Dec 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #90 from ONLYOFFICE/Feature/3d_perspective_pie
Feature/3d perspective pie
parents
3328c59d
d621e895
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1394 additions
and
826 deletions
+1394
-826
common/Charts/3DTransformation.js
common/Charts/3DTransformation.js
+90
-12
common/Charts/ChartsDrawer.js
common/Charts/ChartsDrawer.js
+1304
-814
No files found.
common/Charts/3DTransformation.js
View file @
addf2669
...
...
@@ -90,11 +90,10 @@ function Processor3D(width, height, left, right, bottom, top, chartSpace, charts
this
.
angleOy
=
this
.
view3D
&&
this
.
view3D
.
rotY
?
(
-
this
.
view3D
.
rotY
/
360
)
*
(
Math
.
PI
*
2
)
:
0
;
this
.
angleOz
=
this
.
view3D
&&
this
.
view3D
.
rotZ
?
(
-
this
.
view3D
.
rotZ
/
360
)
*
(
Math
.
PI
*
2
)
:
0
;
/*if(this.view3D.rAngAx && this.view3D.rotX < 0
)
if
(
!
this
.
view3D
.
rAngAx
&&
AscFormat
.
c_oChartTypes
.
Pie
===
this
.
chartsDrawer
.
calcProp
.
type
)
{
this.angleOx = - this.angleOx;
this.angleOy = - this.angleOy;
}*/
this
.
angleOy
=
0
;
}
this
.
orientationCatAx
=
null
;
this
.
orientationValAx
=
null
;
...
...
@@ -139,6 +138,55 @@ Processor3D.prototype.calaculate3DProperties = function(baseDepth, gapDepth, bIs
this
.
_recalculateScaleWithMaxWidth
();
}
}
if
(
AscFormat
.
c_oChartTypes
.
Pie
===
this
.
chartsDrawer
.
calcProp
.
type
&&
!
this
.
view3D
.
rAngAx
)
{
//TODO пересмотреть функцию
this
.
tempChangeAspectRatioForPie
();
}
};
Processor3D
.
prototype
.
tempChangeAspectRatioForPie
=
function
()
{
var
perspectiveDepth
=
this
.
depthPerspective
;
var
widthCanvas
=
this
.
widthCanvas
;
var
originalWidthChart
=
widthCanvas
-
this
.
left
-
this
.
right
;
var
heightCanvas
=
this
.
heightCanvas
;
var
heightChart
=
heightCanvas
-
this
.
top
-
this
.
bottom
;
var
points
=
[],
faces
=
[];
points
.
push
(
new
Point3D
(
this
.
left
+
originalWidthChart
/
2
,
this
.
top
,
perspectiveDepth
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
,
this
.
top
,
perspectiveDepth
/
2
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
+
originalWidthChart
,
this
.
top
,
perspectiveDepth
/
2
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
+
originalWidthChart
/
2
,
this
.
top
,
0
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
+
originalWidthChart
/
2
,
this
.
top
+
heightChart
,
perspectiveDepth
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
,
this
.
top
+
heightChart
,
perspectiveDepth
/
2
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
+
originalWidthChart
,
this
.
top
+
heightChart
,
perspectiveDepth
/
2
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
+
originalWidthChart
/
2
,
this
.
top
+
heightChart
,
0
,
this
));
faces
.
push
([
0
,
1
,
2
,
3
]);
faces
.
push
([
2
,
5
,
4
,
3
]);
faces
.
push
([
1
,
6
,
7
,
0
]);
faces
.
push
([
6
,
5
,
4
,
7
]);
faces
.
push
([
7
,
4
,
3
,
0
]);
faces
.
push
([
1
,
6
,
2
,
5
]);
var
minMaxOx
=
this
.
_getMinMaxOx
(
points
,
faces
);
var
minMaxOy
=
this
.
_getMinMaxOy
(
points
,
faces
);
var
kF
=
((
minMaxOx
.
right
-
minMaxOx
.
left
)
/
originalWidthChart
);
if
((
minMaxOy
.
bottom
-
minMaxOy
.
top
)
/
kF
>
heightChart
)
{
kF
=
((
minMaxOy
.
bottom
-
minMaxOy
.
top
)
/
heightChart
);
}
this
.
aspectRatioX
=
this
.
aspectRatioX
*
kF
;
this
.
aspectRatioY
=
this
.
aspectRatioY
*
kF
;
this
.
aspectRatioZ
=
this
.
aspectRatioZ
*
kF
;
};
Processor3D
.
prototype
.
calculateCommonOptions
=
function
()
...
...
@@ -157,6 +205,13 @@ Processor3D.prototype._calculateAutoHPercent = function()
this
.
hPercent
=
this
.
view3D
.
hPercent
===
null
?
(
heightLine
/
widthLine
)
:
this
.
view3D
.
hPercent
/
100
;
if
(
this
.
chartsDrawer
.
calcProp
.
type
===
AscFormat
.
c_oChartTypes
.
HBar
&&
((
this
.
view3D
.
hPercent
===
null
&&
this
.
view3D
.
rAngAx
)
||
(
this
.
view3D
.
hPercent
!==
null
&&
!
this
.
view3D
.
rAngAx
)))
this
.
hPercent
=
1
/
this
.
hPercent
;
if
(
AscFormat
.
c_oChartTypes
.
Pie
===
this
.
chartsDrawer
.
calcProp
.
type
)
{
this
.
hPercent
=
0.12
;
//this.view3D.depthPercent = 180;
}
}
};
...
...
@@ -1107,6 +1162,12 @@ Processor3D.prototype._calculateDepthPerspective = function()
var
gapWidth
=
this
.
chartSpace
.
chart
.
plotArea
.
chart
.
gapWidth
!=
null
?
(
this
.
chartSpace
.
chart
.
plotArea
.
chart
.
gapWidth
/
100
)
:
(
150
/
100
);
var
gapDepth
=
this
.
chartSpace
.
chart
.
plotArea
.
chart
.
gapDepth
!=
null
?
(
this
.
chartSpace
.
chart
.
plotArea
.
chart
.
gapDepth
/
100
)
:
(
150
/
100
);
if
(
AscFormat
.
c_oChartTypes
.
Area
===
this
.
chartsDrawer
.
calcProp
.
type
)
{
gapWidth
=
0
;
gapDepth
=
0
;
}
var
baseDepth
=
width
/
(
seriesCount
-
(
seriesCount
-
1
)
*
overlap
+
gapWidth
);
if
(
this
.
chartsDrawer
.
calcProp
.
subType
==
"
standard
"
||
this
.
chartsDrawer
.
calcProp
.
type
==
AscFormat
.
c_oChartTypes
.
Line
||
isNormalArea
)
baseDepth
=
(
width
/
(
seriesCount
-
(
seriesCount
-
1
)
*
overlap
+
gapWidth
))
*
seriesCount
;
...
...
@@ -1187,6 +1248,21 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/)
//add test points for parallelepiped rect
var
points
=
[];
var
faces
=
[];
/*if(AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type)
{
points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this));
points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart, this.top, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart / 2, this.top, 0, this));
points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, perspectiveDepth, this));
points.push(new Point3D(this.left, this.top + heightChart, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart, this.top + heightChart, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this));
}
else
{*/
points
.
push
(
new
Point3D
(
this
.
left
,
this
.
top
,
perspectiveDepth
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
,
heightChart
+
this
.
top
,
perspectiveDepth
,
this
));
points
.
push
(
new
Point3D
(
originalWidthChart
+
this
.
left
,
heightChart
+
this
.
top
,
perspectiveDepth
,
this
));
...
...
@@ -1195,6 +1271,7 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/)
points
.
push
(
new
Point3D
(
originalWidthChart
+
this
.
left
,
heightChart
+
this
.
top
,
0
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
,
heightChart
+
this
.
top
,
0
,
this
));
points
.
push
(
new
Point3D
(
this
.
left
,
this
.
top
,
0
,
this
));
//}
faces
.
push
([
0
,
1
,
2
,
3
]);
faces
.
push
([
2
,
5
,
4
,
3
]);
...
...
@@ -1449,6 +1526,7 @@ Processor3D.prototype.checkOutSideArea = function(newPoints)
}
};
calculateZ
(
100
);
calculateZ
(
10
);
calculateZ
(
1
);
...
...
common/Charts/ChartsDrawer.js
View file @
addf2669
This diff is collapsed.
Click to expand it.
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