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
3f5054d1
Commit
3f5054d1
authored
Nov 11, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bugs in applying charts presets
parent
f37d7861
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
61 deletions
+64
-61
common/Drawings/CommonController.js
common/Drawings/CommonController.js
+43
-18
common/Shapes/EditorSettings.js
common/Shapes/EditorSettings.js
+21
-43
No files found.
common/Drawings/CommonController.js
View file @
3f5054d1
...
@@ -2744,8 +2744,10 @@ DrawingObjectsController.prototype =
...
@@ -2744,8 +2744,10 @@ DrawingObjectsController.prototype =
var
type
=
chartSettings
.
getType
();
var
type
=
chartSettings
.
getType
();
if
(
AscFormat
.
isRealNumber
(
style_index
)){
if
(
AscFormat
.
isRealNumber
(
style_index
)){
--
style_index
;
--
style_index
;
if
(
AscCommon
.
g_oChartPresets
[
type
]
&&
AscCommon
.
g_oChartPresets
[
type
][
style_index
]){
var
oCurChartSettings
=
this
.
getPropsFromChart
(
chartSpace
);
AscFormat
.
ApplyPresetToChartSpace
(
chartSpace
,
AscCommon
.
g_oChartPresets
[
type
][
style_index
]);
var
_cur_type
=
oCurChartSettings
.
type
;
if
(
AscCommon
.
g_oChartPresets
[
_cur_type
]
&&
AscCommon
.
g_oChartPresets
[
_cur_type
][
style_index
]){
AscFormat
.
ApplyPresetToChartSpace
(
chartSpace
,
AscCommon
.
g_oChartPresets
[
_cur_type
][
style_index
]);
return
;
return
;
}
}
}
}
...
@@ -9762,23 +9764,34 @@ function ApplyDLblsProps(aPr, oObj, oDrawingDocument, i, baseFills){
...
@@ -9762,23 +9764,34 @@ function ApplyDLblsProps(aPr, oObj, oDrawingDocument, i, baseFills){
lbls
.
setShowVal
(
aPr
[
10
]);
lbls
.
setShowVal
(
aPr
[
10
]);
}
}
function
ApplyPresetToChartSpace
(
oChartSpace
,
aPreset
){
function
ApplyPresetToChartSpace
(
oChartSpace
,
aPreset
,
bCreate
){
var
oDrawingDocument
=
oChartSpace
.
getDrawingDocument
();
var
oDrawingDocument
=
oChartSpace
.
getDrawingDocument
();
oChartSpace
.
setStyle
(
aPreset
[
0
]);
oChartSpace
.
setStyle
(
aPreset
[
0
]);
ApplySpPr
(
aPreset
[
1
],
oChartSpace
);
ApplySpPr
(
aPreset
[
1
],
oChartSpace
);
ApplyTxPr
(
aPreset
[
2
],
oChartSpace
,
oDrawingDocument
);
ApplyTxPr
(
aPreset
[
2
],
oChartSpace
,
oDrawingDocument
);
if
(
!
bCreate
&&
!
oChartSpace
.
chart
.
title
){
oChartSpace
.
chart
.
setTitle
(
new
AscFormat
.
CTitle
());
oChartSpace
.
chart
.
title
.
setOverlay
(
false
);
}
if
(
oChartSpace
.
chart
.
title
){
if
(
oChartSpace
.
chart
.
title
){
ApplySpPr
(
aPreset
[
3
],
oChartSpace
.
chart
.
title
);
ApplySpPr
(
aPreset
[
3
],
oChartSpace
.
chart
.
title
);
ApplyTxPr
(
aPreset
[
4
],
oChartSpace
.
chart
.
title
,
oDrawingDocument
);
ApplyTxPr
(
aPreset
[
4
],
oChartSpace
.
chart
.
title
,
oDrawingDocument
);
}
}
var
style
=
AscFormat
.
CHART_STYLE_MANAGER
.
getStyleByIndex
(
this
.
style
);
var
style
=
AscFormat
.
CHART_STYLE_MANAGER
.
getStyleByIndex
(
aPreset
[
0
]
);
ApplyLegendProps
(
aPreset
[
5
],
oChartSpace
.
chart
.
legend
,
oDrawingDocument
);
if
(
!
aPreset
[
5
]
&&
!
bCreate
){
if
(
!
aPreset
[
5
]){
oChartSpace
.
chart
.
setLegend
(
null
);
oChartSpace
.
chart
.
setLegend
(
null
);
}
}
else
{
if
(
!
bCreate
&&
aPreset
[
5
]){
oChartSpace
.
chart
.
setLegend
(
new
AscFormat
.
CLegend
());
oChartSpace
.
chart
.
legend
.
setOverlay
(
false
);
}
}
ApplyLegendProps
(
aPreset
[
5
],
oChartSpace
.
chart
.
legend
,
oDrawingDocument
);
var
oPlotArea
=
oChartSpace
.
chart
.
plotArea
;
var
oPlotArea
=
oChartSpace
.
chart
.
plotArea
;
ApplySpPr
(
aPreset
[
6
],
oPlotArea
);
ApplySpPr
(
aPreset
[
6
],
oPlotArea
);
ApplyTxPr
(
aPreset
[
7
],
oPlotArea
,
oDrawingDocument
);
ApplyTxPr
(
aPreset
[
7
],
oPlotArea
,
oDrawingDocument
);
...
@@ -9790,15 +9803,16 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
...
@@ -9790,15 +9803,16 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
ApplyPropsToValAxis
(
aPreset
[
9
],
oAxisByTypes
.
valAx
[
i
],
oDrawingDocument
);
ApplyPropsToValAxis
(
aPreset
[
9
],
oAxisByTypes
.
valAx
[
i
],
oDrawingDocument
);
}
}
var
oChart
=
oPlotArea
.
charts
[
0
];
var
oChart
=
oPlotArea
.
charts
[
0
]
,
base_fills
;
ApplyDLblsProps
(
aPreset
[
10
],
oChart
,
oDrawingDocument
);
ApplyDLblsProps
(
aPreset
[
10
],
oChart
,
oDrawingDocument
);
for
(
i
=
0
;
i
<
oChart
.
series
.
length
;
++
i
){
for
(
i
=
0
;
i
<
oChart
.
series
.
length
;
++
i
){
var
pts
=
AscFormat
.
getPtsFromSeries
(
oChart
.
series
[
i
]);
var
pts
=
AscFormat
.
getPtsFromSeries
(
oChart
.
series
[
i
]);
var
base_fills
=
AscFormat
.
getArrayFillsFromBase
(
style
.
fill2
,
AscFormat
.
getMaxIdx
(
pts
));
for
(
var
j
=
oChart
.
series
[
i
].
dPt
.
length
;
j
>
-
1
;
--
j
){
oChart
.
series
[
i
].
removeDPt
(
j
);
}
if
(
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_PieChart
||
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_DoughnutChart
){
if
(
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_PieChart
||
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_DoughnutChart
){
for
(
var
j
=
oChart
.
series
[
i
].
dPt
.
length
;
j
>
-
1
;
--
j
){
base_fills
=
AscFormat
.
getArrayFillsFromBase
(
style
.
fill2
,
AscFormat
.
getMaxIdx
(
pts
));
oChart
.
series
[
i
].
removeDPt
(
j
);
}
for
(
j
=
0
;
j
<
pts
.
length
;
++
j
){
for
(
j
=
0
;
j
<
pts
.
length
;
++
j
){
var
oDPt
=
new
AscFormat
.
CDPt
();
var
oDPt
=
new
AscFormat
.
CDPt
();
oDPt
.
setBubble3D
(
false
);
oDPt
.
setBubble3D
(
false
);
...
@@ -9808,6 +9822,7 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
...
@@ -9808,6 +9822,7 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
}
}
}
}
else
{
else
{
base_fills
=
AscFormat
.
getArrayFillsFromBase
(
style
.
fill2
,
oChart
.
series
.
length
);
ApplySpPr
(
aPreset
[
11
],
oChart
.
series
[
i
],
i
,
base_fills
);
ApplySpPr
(
aPreset
[
11
],
oChart
.
series
[
i
],
i
,
base_fills
);
}
}
if
(
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_PieChart
||
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_DoughnutChart
){
if
(
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_PieChart
||
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_DoughnutChart
){
...
@@ -9835,6 +9850,16 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
...
@@ -9835,6 +9850,16 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
}
}
}
}
if
(
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_PieChart
||
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_DoughnutChart
){
oChart
.
setVaryColors
(
true
);
}
else
{
if
(
oChart
.
setVaryColors
){
oChart
.
setVaryColors
(
false
);
}
}
if
(
oChart
.
setGapWidth
){
if
(
oChart
.
setGapWidth
){
oChart
.
setGapWidth
(
aPreset
[
13
]);
oChart
.
setGapWidth
(
aPreset
[
13
]);
}
}
...
@@ -9892,26 +9917,26 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
...
@@ -9892,26 +9917,26 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset){
}
}
if
(
oChart
.
setHiLowLines
){
if
(
oChart
.
getObjectType
()
===
AscDFH
.
historyitem_type_StockChart
){
var
oOlDSpPr
=
oChartSpace
.
spPr
;
var
oOlDSpPr
=
oChartSpace
.
spPr
&&
oChartSpace
.
spPr
.
createDuplicate
();
oChartSpace
.
setSpPr
(
null
);
ApplySpPr
(
aPreset
[
23
],
oChartSpace
);
ApplySpPr
(
aPreset
[
23
],
oChartSpace
);
oChart
.
setHiLowLines
(
oChartSpace
.
spPr
);
oChart
.
setHiLowLines
(
oChartSpace
.
spPr
);
oChartSpace
.
setSpPr
(
oOlDSpPr
);
}
if
(
oChart
.
setUpDownBars
){
if
(
!
aPreset
[
24
]){
if
(
!
aPreset
[
24
]){
oChart
.
setUpDownBars
(
null
);
oChart
.
setUpDownBars
(
null
);
}
}
else
{
else
{
oChart
.
setUpDownBars
(
new
AscFormat
.
CUpDownBars
());
oChart
.
setUpDownBars
(
new
AscFormat
.
CUpDownBars
());
var
oOlDSpPr
=
oChartSpace
.
spPr
;
oChartSpace
.
setSpPr
(
null
)
;
ApplySpPr
(
aPreset
[
24
][
0
],
oChartSpace
);
ApplySpPr
(
aPreset
[
24
][
0
],
oChartSpace
);
oChart
.
upDownBars
.
setDownBars
(
oChartSpace
.
spPr
);
oChart
.
upDownBars
.
setDownBars
(
oChartSpace
.
spPr
);
oChart
.
upDownBars
.
setGapWidth
(
aPreset
[
24
][
1
]);
oChart
.
upDownBars
.
setGapWidth
(
aPreset
[
24
][
1
]);
oChartSpace
.
setSpPr
(
null
);
ApplySpPr
(
aPreset
[
24
][
2
],
oChartSpace
);
ApplySpPr
(
aPreset
[
24
][
2
],
oChartSpace
);
oChart
.
upDownBars
.
setUpBars
(
oChartSpace
.
spPr
);
oChart
.
upDownBars
.
setUpBars
(
oChartSpace
.
spPr
);
oChartSpace
.
setSpPr
(
oOlDSpPr
);
}
}
oChartSpace
.
setSpPr
(
oOlDSpPr
);
}
}
}
}
function
CMathPainter
(
_api
)
function
CMathPainter
(
_api
)
...
...
common/Shapes/EditorSettings.js
View file @
3f5054d1
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