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
846d472f
Commit
846d472f
authored
Apr 14, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Оси спарклайнов
parent
919452a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
103 deletions
+148
-103
common/Charts/DrawingObjects.js
common/Charts/DrawingObjects.js
+49
-6
common/Drawings/Format/ChartSpace.js
common/Drawings/Format/ChartSpace.js
+99
-97
No files found.
common/Charts/DrawingObjects.js
View file @
846d472f
...
...
@@ -427,16 +427,38 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
var
val_ax_props
=
new
asc_ValAxisSettings
();
val_ax_props
.
putMinValRule
(
c_oAscValAxisRule
.
auto
);
val_ax_props
.
putMaxValRule
(
c_oAscValAxisRule
.
auto
);
if
(
settings
.
type
!==
c_oAscChartTypeSettings
.
barStackedPer
)
{
val_ax_props
.
putMinValRule
(
c_oAscValAxisRule
.
auto
);
val_ax_props
.
putMaxValRule
(
c_oAscValAxisRule
.
auto
);
}
else
{
val_ax_props
.
putMinValRule
(
c_oAscValAxisRule
.
fixed
);
val_ax_props
.
putMinVal
(
-
1
);
val_ax_props
.
putMaxValRule
(
c_oAscValAxisRule
.
fixed
);
val_ax_props
.
putMaxVal
(
1
);
}
val_ax_props
.
putTickLabelsPos
(
c_oAscTickLabelsPos
.
TICK_LABEL_POSITION_NONE
);
val_ax_props
.
putInvertValOrder
(
false
);
if
(
oSparklineGroup
.
rightToLeft
)
{
val_ax_props
.
putInvertValOrder
(
true
);
}
else
{
val_ax_props
.
putInvertValOrder
(
false
);
}
val_ax_props
.
putDispUnitsRule
(
c_oAscValAxUnits
.
none
);
val_ax_props
.
putMajorTickMark
(
c_oAscTickMark
.
TICK_MARK_NONE
);
val_ax_props
.
putMinorTickMark
(
c_oAscTickMark
.
TICK_MARK_NONE
);
val_ax_props
.
putCrossesRule
(
c_oAscCrossesRule
.
auto
);
var
cat_ax_props
=
new
asc_CatAxisSettings
();
cat_ax_props
.
putIntervalBetweenLabelsRule
(
c_oAscBetweenLabelsRule
.
auto
);
cat_ax_props
.
putLabelsPosition
(
c_oAscLabelsPosition
.
betweenDivisions
);
...
...
@@ -2291,16 +2313,36 @@ function DrawingObjects() {
oSparklineGroup
.
updateCache
(
range
);
}
};
_this
.
checkSparklineGroupMinMaxVal
=
function
(
oSparklineGroup
)
{
var
maxVal
=
null
,
minVal
=
null
;
if
(
oSparklineGroup
.
type
!==
Asc
.
ESparklineType
.
Stacked
&&
(
Asc
.
SparklineAxisMinMax
.
Group
===
oSparklineGroup
.
minAxisType
||
Asc
.
SparklineAxisMinMax
.
Group
===
oSparklineGroup
.
maxAxisType
))
{
for
(
var
i
=
0
;
i
<
oSparklineGroup
.
arrSparklines
.
length
;
++
i
)
{
if
(
!
oSparklineGroup
.
arrCachedSparklines
[
j
])
{
var
oSparklineView
=
new
CSparklineView
();
oSparklineView
.
initFromSparkline
(
oSparklineGroup
.
arrSparklines
[
j
],
oSparklineGroup
,
worksheet
);
oSparklineGroup
.
addView
(
oSparklineView
,
j
);
}
var
aPoints
=
getPtsFromSeries
(
oSparklineView
.
chartSpace
.
chart
.
plotArea
.
charts
[
0
].
series
[
0
]);
}
}
};
_this
.
drawSparkLineGroups
=
function
(
oDrawingContext
,
oSparklineGroups
,
range
)
{
oDrawingContext
.
save
();
var
graphics
=
new
CGraphics
();
graphics
.
init
(
oDrawingContext
.
ctx
,
oDrawingContext
.
getWidth
(
0
),
oDrawingContext
.
getHeight
(
0
),
oDrawingContext
.
getWidth
(
3
)
*
nSparklineMultiplier
,
oDrawingContext
.
getHeight
(
3
)
*
nSparklineMultiplier
);
graphics
.
m_oFontManager
=
g_fontManager
;
graphics
.
SaveGrState
();
for
(
var
i
=
0
;
i
<
oSparklineGroups
.
arrSparklineGroup
.
length
;
++
i
)
{
var
oSparklineGroup
=
oSparklineGroups
.
arrSparklineGroup
[
i
];
for
(
var
j
=
0
;
j
<
oSparklineGroup
.
arrSparklines
.
length
;
++
j
)
{
if
(
!
oSparklineGroup
.
arrCachedSparklines
[
j
])
{
var
oSparklineView
=
new
CSparklineView
();
...
...
@@ -2312,8 +2354,9 @@ function DrawingObjects() {
}
oSparklineGroup
.
arrCachedSparklines
[
j
].
draw
(
graphics
);
}
}
oDrawingContext
.
restor
e
();
graphics
.
RestoreGrStat
e
();
};
_this
.
rebuildChartGraphicObjects
=
function
(
data
)
...
...
common/Drawings/Format/ChartSpace.js
View file @
846d472f
...
...
@@ -2317,128 +2317,130 @@ CChartSpace.prototype =
},
recalculateReferences
:
function
(
)
checkValByNumRef
:
function
(
workbook
,
ser
,
val
,
bVertical
)
{
var
worksheet
=
this
.
worksheet
;
//this.pointsMap = {};
if
(
!
worksheet
)
return
;
if
(
this
.
recalcInfo
.
recalculateBBox
)
if
(
val
&&
val
.
numRef
&&
typeof
val
.
numRef
.
f
===
"
string
"
/*(!val.numRef.numCache || val.numRef.numCache.pts.length === 0)*/
)
{
this
.
recalculateBBox
();
this
.
recalcInfo
.
recalculateBBox
=
false
;
}
var
checkValByNumRef
=
function
(
oThis
,
ser
,
val
,
bVertical
)
{
if
(
val
&&
val
.
numRef
&&
typeof
val
.
numRef
.
f
===
"
string
"
/*(!val.numRef.numCache || val.numRef.numCache.pts.length === 0)*/
)
var
first_slice
=
0
,
last_slice
=
0
;
if
(
val
.
numRef
.
f
[
0
]
===
"
(
"
)
{
var
first_slice
=
0
,
last_slice
=
0
;
if
(
val
.
numRef
.
f
[
0
]
===
"
(
"
)
{
first_slice
=
1
;
}
if
(
val
.
numRef
.
f
[
val
.
numRef
.
f
.
length
-
1
]
===
"
)
"
)
{
last_slice
=
-
1
;
}
else
{
last_slice
=
val
.
numRef
.
f
.
length
;
}
var
f1
=
val
.
numRef
.
f
.
slice
(
first_slice
,
last_slice
);
var
arr_f
=
f1
.
split
(
"
,
"
);
first_slice
=
1
;
}
if
(
val
.
numRef
.
f
[
val
.
numRef
.
f
.
length
-
1
]
===
"
)
"
)
{
last_slice
=
-
1
;
}
else
{
last_slice
=
val
.
numRef
.
f
.
length
;
}
var
f1
=
val
.
numRef
.
f
.
slice
(
first_slice
,
last_slice
);
var
arr_f
=
f1
.
split
(
"
,
"
);
var
num_cache
;
if
(
!
val
.
numRef
.
numCache
)
{
num_cache
=
new
CNumLit
();
num_cache
.
setFormatCode
(
"
General
"
);
}
else
{
num_cache
=
val
.
numRef
.
numCache
;
removePtsFromLit
(
num_cache
);
}
var
lit_format_code
=
typeof
num_cache
.
formatCode
===
"
string
"
&&
num_cache
.
formatCode
.
length
>
0
?
num_cache
.
formatCode
:
"
General
"
;
var
pt_index
=
0
,
i
,
j
,
cell
,
pt
,
worksheet_id
,
hidden
=
true
,
row_hidden
,
col_hidden
,
nPtCount
;
for
(
i
=
0
;
i
<
arr_f
.
length
;
++
i
)
var
num_cache
;
if
(
!
val
.
numRef
.
numCache
)
{
num_cache
=
new
CNumLit
();
num_cache
.
setFormatCode
(
"
General
"
);
}
else
{
num_cache
=
val
.
numRef
.
numCache
;
removePtsFromLit
(
num_cache
);
}
var
lit_format_code
=
typeof
num_cache
.
formatCode
===
"
string
"
&&
num_cache
.
formatCode
.
length
>
0
?
num_cache
.
formatCode
:
"
General
"
;
var
pt_index
=
0
,
i
,
j
,
cell
,
pt
,
worksheet_id
,
hidden
=
true
,
row_hidden
,
col_hidden
,
nPtCount
;
for
(
i
=
0
;
i
<
arr_f
.
length
;
++
i
)
{
var
parsed_ref
=
parserHelp
.
parse3DRef
(
arr_f
[
i
]);
if
(
parsed_ref
)
{
var
parsed_ref
=
parserHelp
.
parse3DRef
(
arr_f
[
i
]
);
if
(
parsed_ref
)
var
source_worksheet
=
workbook
.
getWorksheetByName
(
parsed_ref
.
sheet
);
if
(
source_worksheet
)
{
var
source_worksheet
=
oThis
.
worksheet
.
workbook
.
getWorksheetByName
(
parsed_ref
.
sheet
);
if
(
source_worksheet
)
worksheet_id
=
source_worksheet
.
getId
()
+
""
;
var
range1
=
source_worksheet
.
getRange2
(
parsed_ref
.
range
);
if
(
range1
)
{
worksheet_id
=
source_worksheet
.
getId
()
+
""
;
var
range1
=
source_worksheet
.
getRange2
(
parsed_ref
.
range
);
if
(
range1
)
{
var
range
=
range1
.
bbox
;
var
range
=
range1
.
bbox
;
if
(
range
.
r1
===
range
.
r2
||
bVertical
===
true
)
if
(
range
.
r1
===
range
.
r2
||
bVertical
===
true
)
{
row_hidden
=
source_worksheet
.
getRowHidden
(
range
.
r1
);
for
(
j
=
range
.
c1
;
j
<=
range
.
c2
;
++
j
)
{
row_hidden
=
source_worksheet
.
getRowHidden
(
range
.
r1
);
for
(
j
=
range
.
c1
;
j
<=
range
.
c2
;
++
j
)
if
(
!
row_hidden
&&
!
source_worksheet
.
getColHidden
(
j
))
{
if
(
!
row_hidden
&&
!
source_worksheet
.
getColHidden
(
j
))
cell
=
source_worksheet
.
getCell3
(
range
.
r1
,
j
);
if
(
typeof
cell
.
getValueWithFormat
()
===
"
string
"
&&
cell
.
getValueWithFormat
().
length
>
0
)
{
cell
=
source_worksheet
.
getCell3
(
range
.
r1
,
j
);
if
(
typeof
cell
.
getValueWithFormat
()
===
"
string
"
&&
cell
.
getValueWithFormat
().
length
>
0
)
hidden
=
false
;
pt
=
new
CNumericPoint
();
pt
.
setIdx
(
pt_index
);
pt
.
setVal
(
parseFloat
(
cell
.
getValue
()));
if
(
cell
.
getNumFormatStr
()
!==
lit_format_code
)
{
hidden
=
false
;
pt
=
new
CNumericPoint
();
pt
.
setIdx
(
pt_index
);
pt
.
setVal
(
parseFloat
(
cell
.
getValue
()));
if
(
cell
.
getNumFormatStr
()
!==
lit_format_code
)
{
pt
.
setFormatCode
(
cell
.
getNumFormatStr
())
}
num_cache
.
addPt
(
pt
);
//addPointToMap(oThis.pointsMap, source_worksheet, range.r1, j, pt);
pt
.
setFormatCode
(
cell
.
getNumFormatStr
())
}
num_cache
.
addPt
(
pt
);
}
pt_index
++
;
}
pt_index
++
;
}
else
}
else
{
col_hidden
=
source_worksheet
.
getColHidden
(
range
.
c1
);
for
(
j
=
range
.
r1
;
j
<=
range
.
r2
;
++
j
)
{
col_hidden
=
source_worksheet
.
getColHidden
(
range
.
c1
);
for
(
j
=
range
.
r1
;
j
<=
range
.
r2
;
++
j
)
if
(
!
col_hidden
&&
!
source_worksheet
.
getRowHidden
(
j
))
{
if
(
!
col_hidden
&&
!
source_worksheet
.
getRowHidden
(
j
))
cell
=
source_worksheet
.
getCell3
(
j
,
range
.
c1
);
if
(
typeof
cell
.
getValueWithFormat
()
===
"
string
"
&&
cell
.
getValueWithFormat
().
length
>
0
)
{
cell
=
source_worksheet
.
getCell3
(
j
,
range
.
c1
);
if
(
typeof
cell
.
getValueWithFormat
()
===
"
string
"
&&
cell
.
getValueWithFormat
().
length
>
0
)
hidden
=
false
;
pt
=
new
CNumericPoint
();
pt
.
setIdx
(
pt_index
);
pt
.
setVal
(
parseFloat
(
cell
.
getValue
()));
if
(
cell
.
getNumFormatStr
()
!==
lit_format_code
)
{
hidden
=
false
;
pt
=
new
CNumericPoint
();
pt
.
setIdx
(
pt_index
);
pt
.
setVal
(
parseFloat
(
cell
.
getValue
()));
if
(
cell
.
getNumFormatStr
()
!==
lit_format_code
)
{
pt
.
setFormatCode
(
cell
.
getNumFormatStr
())
}
num_cache
.
addPt
(
pt
);
//addPointToMap(oThis.pointsMap, source_worksheet, j, range.c1, pt);
pt
.
setFormatCode
(
cell
.
getNumFormatStr
())
}
num_cache
.
addPt
(
pt
);
}
pt_index
++
;
}
pt_index
++
;
}
}
}
}
}
num_cache
.
setPtCount
(
pt_index
);
val
.
numRef
.
setNumCache
(
num_cache
);
if
(
!
(
val
instanceof
CCat
))
{
ser
.
isHidden
=
hidden
;
ser
.
isHiddenForLegend
=
hidden
;
}
}
};
num_cache
.
setPtCount
(
pt_index
);
val
.
numRef
.
setNumCache
(
num_cache
);
if
(
!
(
val
instanceof
CCat
))
{
ser
.
isHidden
=
hidden
;
ser
.
isHiddenForLegend
=
hidden
;
}
}
},
recalculateReferences
:
function
()
{
var
worksheet
=
this
.
worksheet
;
//this.pointsMap = {};
if
(
!
worksheet
)
return
;
if
(
this
.
recalcInfo
.
recalculateBBox
)
{
this
.
recalculateBBox
();
this
.
recalcInfo
.
recalculateBBox
=
false
;
}
var
checkCatByNumRef
=
function
(
oThis
,
ser
,
cat
,
bVertical
)
{
...
...
@@ -2543,9 +2545,9 @@ CChartSpace.prototype =
{
ser
=
series
[
j
];
//val
checkValByNumRef
(
this
,
ser
,
ser
.
val
);
this
.
checkValByNumRef
(
this
.
worksheet
.
workbook
,
ser
,
ser
.
val
);
//cat
checkValByNumRef
(
this
,
ser
,
ser
.
cat
,
bVert
);
this
.
checkValByNumRef
(
this
.
worksheet
.
workbook
,
ser
,
ser
.
cat
,
bVert
);
checkCatByNumRef
(
this
,
ser
,
ser
.
cat
,
bVert
);
//tx
checkCatByNumRef
(
this
,
ser
,
ser
.
tx
,
isRealBool
(
bVert
)
?
!
bVert
:
undefined
);
...
...
@@ -2566,8 +2568,8 @@ CChartSpace.prototype =
for
(
j
=
0
;
j
<
series
.
length
;
++
j
)
{
ser
=
series
[
j
];
checkValByNumRef
(
this
,
ser
,
ser
.
xVal
,
bVert
);
checkValByNumRef
(
this
,
ser
,
ser
.
yVal
);
this
.
checkValByNumRef
(
this
.
worksheet
.
workbook
,
ser
,
ser
.
xVal
,
bVert
);
this
.
checkValByNumRef
(
this
.
worksheet
.
workbook
,
ser
,
ser
.
yVal
);
checkCatByNumRef
(
this
,
ser
,
ser
.
tx
,
isRealBool
(
bVert
)
?
!
bVert
:
undefined
);
if
(
ser
.
isHidden
)
...
...
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