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
9d18b2d0
Commit
9d18b2d0
authored
Sep 05, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes for stacked hbar charts
parent
5b3ee017
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
27 deletions
+64
-27
common/Charts/3DTransformation.js
common/Charts/3DTransformation.js
+4
-4
common/Charts/ChartsDrawer.js
common/Charts/ChartsDrawer.js
+60
-23
No files found.
common/Charts/3DTransformation.js
View file @
9d18b2d0
...
...
@@ -243,7 +243,7 @@ Processor3D.prototype._calculateScaleNStandard = function()
var
widthLine
=
this
.
widthCanvas
-
(
this
.
left
+
this
.
right
);
var
heightLine
=
this
.
heightCanvas
-
(
this
.
top
+
this
.
bottom
);
var
trueDepth
=
this
.
depthPerspective
*
Math
.
sin
(
-
this
.
angleOx
);
var
trueDepth
=
Math
.
abs
(
this
.
depthPerspective
*
Math
.
sin
(
-
this
.
angleOx
)
);
var
mustHeight
=
heightLine
-
trueDepth
;
var
mustWidth
=
this
.
chartsDrawer
.
calcProp
.
type
===
AscFormat
.
c_oChartTypes
.
HBar
?
mustHeight
*
this
.
hPercent
:
mustHeight
/
this
.
hPercent
;
...
...
@@ -846,7 +846,7 @@ Processor3D.prototype._calculateDepth = function()
var
basePercent
=
this
.
view3D
&&
this
.
view3D
.
depthPercent
?
this
.
view3D
.
depthPercent
/
100
:
globalBasePercent
/
100
;
//процент от базовой глубины
var
seriesCount
=
this
.
chartsDrawer
.
calcProp
.
seriesCount
;
var
ptCount
=
this
.
chartsDrawer
.
calcProp
.
ptCount
;
var
sinOx
=
Math
.
sin
(
-
this
.
angleOx
);
var
sinOx
=
Math
.
abs
(
Math
.
sin
(
-
this
.
angleOx
)
);
var
sinOy
=
Math
.
sin
(
-
this
.
angleOy
);
var
hPercent
=
type
==
AscFormat
.
c_oChartTypes
.
HBar
?
1
:
this
.
hPercent
;
var
depthPercent
=
this
.
view3D
.
depthPercent
!==
null
?
this
.
view3D
.
depthPercent
/
100
:
1
;
...
...
@@ -872,7 +872,7 @@ Processor3D.prototype._calculateDepth = function()
{
chartWidth
=
widthOneBar
+
heightHPercent
;
}
else
if
(
this
.
angleOx
!==
0
/* && this.angleOy !== 0*/
)
//AngleOYNoAut + AngleOYNoAutPerHeight + (ANGLEOX+ANGLEOY) + AngleOYOXNoAut + ANGLEOXANGLEOYHPerDPer(ANGLEOX+ANGLEOY HPercent)
else
if
(
this
.
angleOx
!==
0
)
//AngleOYNoAut + AngleOYNoAutPerHeight + (ANGLEOX+ANGLEOY) + AngleOYOXNoAut + ANGLEOXANGLEOYHPerDPer(ANGLEOX+ANGLEOY HPercent)
{
//если выставить ширину 255 будет так же, как и в документе с расчётами
b
=
(
seriesCount
-
(
seriesCount
-
1
)
*
overlap
+
gapWidth
);
...
...
@@ -912,7 +912,7 @@ Processor3D.prototype._calculateDepth = function()
depth
=
depth
*
Math
.
sin
(
-
this
.
angleOx
);
}
return
sinOx
!==
0
?
depth
/
Math
.
sin
(
-
this
.
angleOx
)
:
depth
;
return
sinOx
!==
0
?
depth
/
sinOx
:
depth
;
};
Processor3D
.
prototype
.
_calculateDepthPerspective
=
function
()
...
...
common/Charts/ChartsDrawer.js
View file @
9d18b2d0
...
...
@@ -1075,6 +1075,10 @@ CChartsDrawer.prototype =
this
.
calcProp
.
max
=
this
.
calcProp
.
scale
[
this
.
calcProp
.
scale
.
length
-
1
];
this
.
calcProp
.
min
=
this
.
calcProp
.
scale
[
0
];
}
this
.
calcProp
.
axisMin
=
this
.
calcProp
.
scale
[
0
]
<
this
.
calcProp
.
scale
[
this
.
calcProp
.
scale
.
length
-
1
]
?
this
.
calcProp
.
scale
[
0
]
:
this
.
calcProp
.
scale
[
this
.
calcProp
.
scale
.
length
-
1
];
this
.
calcProp
.
axisMax
=
this
.
calcProp
.
scale
[
0
]
<
this
.
calcProp
.
scale
[
this
.
calcProp
.
scale
.
length
-
1
]
?
this
.
calcProp
.
scale
[
this
.
calcProp
.
scale
.
length
-
1
]
:
this
.
calcProp
.
scale
[
0
];
},
//****new calculate data****
...
...
@@ -1397,9 +1401,9 @@ CChartsDrawer.prototype =
axisMax
=
manualMax
!==
null
&&
manualMax
!==
undefined
?
manualMax
:
trueMinMax
.
max
;
var
percentChartMax
=
100
;
if
(
this
.
calcProp
.
subType
==
'
stackedPer
'
&&
axisMax
>
percentChartMax
)
if
(
this
.
calcProp
.
subType
==
'
stackedPer
'
&&
axisMax
>
percentChartMax
&&
manualMax
===
null
)
axisMax
=
percentChartMax
;
if
(
this
.
calcProp
.
subType
==
'
stackedPer
'
&&
axisMin
<
-
percentChartMax
)
if
(
this
.
calcProp
.
subType
==
'
stackedPer
'
&&
axisMin
<
-
percentChartMax
&&
manualMin
===
null
)
axisMin
=
-
percentChartMax
;
...
...
@@ -1418,6 +1422,10 @@ CChartsDrawer.prototype =
if
(
axis
&&
axis
.
majorUnit
!==
null
)
{
step
=
axis
.
majorUnit
;
if
(
this
.
calcProp
.
subType
==
'
stackedPer
'
)
{
step
=
step
*
100
;
}
}
else
{
...
...
@@ -1553,9 +1561,11 @@ CChartsDrawer.prototype =
_getArrayAxisValues
:
function
(
minUnit
,
axisMin
,
axisMax
,
step
,
manualMin
,
manualMax
)
{
var
arrayValues
=
[];
var
stackedPerMax
=
null
!==
manualMax
?
manualMax
:
100
;
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
if
(
this
.
calcProp
.
subType
==
'
stackedPer
'
&&
(
minUnit
+
step
*
i
)
>
100
)
if
(
this
.
calcProp
.
subType
==
'
stackedPer
'
&&
(
minUnit
+
step
*
i
)
>
stackedPerMax
)
break
;
arrayValues
[
i
]
=
minUnit
+
step
*
i
;
...
...
@@ -6522,30 +6532,57 @@ drawHBarChart.prototype =
_getStartYColumnPosition
:
function
(
seriesHeight
,
j
,
i
,
val
,
xPoints
,
summBarVal
)
{
var
startY
,
diffYVal
,
width
,
numCache
,
dVal
,
curVal
,
prevVal
,
endBlockPosition
,
startBlockPosition
;
var
nullPositionOX
=
this
.
cChartSpace
.
chart
.
plotArea
.
catAx
.
posX
?
this
.
cChartSpace
.
chart
.
plotArea
.
catAx
.
posX
*
this
.
chartProp
.
pxToMM
:
this
.
cChartSpace
.
chart
.
plotArea
.
catAx
.
xPos
*
this
.
chartProp
.
pxToMM
;
if
(
this
.
chartProp
.
subType
==
"
stacked
"
)
var
catAx
=
this
.
cChartSpace
.
chart
.
plotArea
.
catAx
;
var
nullPositionOX
=
catAx
.
posX
?
catAx
.
posX
*
this
.
chartProp
.
pxToMM
:
catAx
.
xPos
*
this
.
chartProp
.
pxToMM
;
if
(
this
.
chartProp
.
subType
==
"
stacked
"
||
this
.
chartProp
.
subType
==
"
stackedPer
"
)
{
curVal
=
this
.
_getStackedValue
(
this
.
chartProp
.
series
,
i
,
j
,
val
);
prevVal
=
this
.
_getStackedValue
(
this
.
chartProp
.
series
,
i
-
1
,
j
,
val
);
endBlockPosition
=
this
.
cChartDrawer
.
getYPosition
((
curVal
),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
;
startBlockPosition
=
prevVal
?
this
.
cChartDrawer
.
getYPosition
((
prevVal
),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
:
nullPositionOX
;
startY
=
startBlockPosition
;
width
=
endBlockPosition
-
startBlockPosition
;
if
(
this
.
cChartSpace
.
chart
.
plotArea
.
valAx
.
scaling
.
orientation
!=
ORIENTATION_MIN_MAX
)
width
=
-
width
;
}
else
if
(
this
.
chartProp
.
subType
==
"
stackedPer
"
)
{
this
.
_calculateSummStacked
(
j
);
curVal
=
this
.
_getStackedValue
(
this
.
chartProp
.
series
,
i
,
j
,
val
);
prevVal
=
this
.
_getStackedValue
(
this
.
chartProp
.
series
,
i
-
1
,
j
,
val
);
endBlockPosition
=
this
.
cChartDrawer
.
getYPosition
((
curVal
/
this
.
summBarVal
[
j
]),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
;
startBlockPosition
=
this
.
summBarVal
[
j
]
?
this
.
cChartDrawer
.
getYPosition
((
prevVal
/
this
.
summBarVal
[
j
]),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
:
nullPositionOX
;
if
(
this
.
chartProp
.
subType
==
"
stacked
"
)
{
//если максимальное значение задано вручную, и присутвуют точки, которые больше этого значения
if
(
curVal
>
this
.
cChartDrawer
.
calcProp
.
axisMax
)
{
curVal
=
this
.
cChartDrawer
.
calcProp
.
axisMax
;
}
if
(
curVal
<
this
.
cChartDrawer
.
calcProp
.
axisMin
)
{
curVal
=
this
.
cChartDrawer
.
calcProp
.
axisMin
;
}
endBlockPosition
=
this
.
cChartDrawer
.
getYPosition
((
curVal
),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
;
startBlockPosition
=
prevVal
?
this
.
cChartDrawer
.
getYPosition
((
prevVal
),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
:
nullPositionOX
;
}
else
{
this
.
_calculateSummStacked
(
j
);
var
test
=
this
.
summBarVal
[
j
];
//если максимальное значение задано вручную, и присутвуют точки, которые больше этого значения
if
(
curVal
/
test
>
this
.
cChartDrawer
.
calcProp
.
axisMax
)
{
curVal
=
this
.
cChartDrawer
.
calcProp
.
axisMax
*
test
;
}
if
(
curVal
/
test
<
this
.
cChartDrawer
.
calcProp
.
axisMin
)
{
curVal
=
this
.
cChartDrawer
.
calcProp
.
axisMin
*
test
;
}
if
(
prevVal
/
test
>
this
.
cChartDrawer
.
calcProp
.
axisMax
)
{
prevVal
=
this
.
cChartDrawer
.
calcProp
.
axisMax
*
test
;
}
if
(
prevVal
/
test
<
this
.
cChartDrawer
.
calcProp
.
axisMin
)
{
prevVal
=
this
.
cChartDrawer
.
calcProp
.
axisMin
*
test
;
}
endBlockPosition
=
this
.
cChartDrawer
.
getYPosition
((
curVal
/
test
),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
;
startBlockPosition
=
test
?
this
.
cChartDrawer
.
getYPosition
((
prevVal
/
test
),
xPoints
,
true
)
*
this
.
chartProp
.
pxToMM
:
nullPositionOX
;
}
startY
=
startBlockPosition
;
width
=
endBlockPosition
-
startBlockPosition
;
...
...
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