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
fe5617ad
Commit
fe5617ad
authored
Mar 30, 2016
by
Sergey Luzyanin
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Отрисовка спаклайнов
parent
7e9472db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
115 additions
and
2 deletions
+115
-2
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+26
-1
common/Charts/DrawingObjects.js
common/Charts/DrawingObjects.js
+89
-1
No files found.
cell/model/WorkbookElems.js
View file @
fe5617ad
...
...
@@ -4439,9 +4439,34 @@ function sparklineGroup() {
this
.
colorHigh
=
null
;
this
.
colorLow
=
null
;
this
.
f
=
'
??
'
;
this
.
arrSparklines
=
[];
this
.
arrCachedSparklines
=
[];
}
sparklineGroup
.
prototype
.
clearCached
=
function
()
{
this
.
arrCachedSparklines
.
length
=
0
;
};
sparklineGroup
.
prototype
.
addView
=
function
(
oSparklineView
)
{
this
.
arrCachedSparklines
.
push
(
oSparklineView
);
};
sparklineGroup
.
prototype
.
draw
=
function
(
oDrawingContext
)
{
var
graphics
=
new
CGraphics
();
graphics
.
init
(
oDrawingContext
.
ctx
,
oDrawingContext
.
getWidth
(
0
),
oDrawingContext
.
getHeight
(
0
),
oDrawingContext
.
getWidth
(
3
),
oDrawingContext
.
getHeight
(
3
));
graphics
.
m_oFontManager
=
g_fontManager
;
for
(
var
i
=
0
;
i
<
this
.
arrCachedSparklines
.
length
;
++
i
)
{
this
.
arrCachedSparklines
[
i
].
draw
(
graphics
);
}
};
sparklineGroup
.
prototype
.
updateCache
=
function
(
wsView
)
{
wsView
.
objectRender
.
createSparklineViews
(
this
);
};
function
sparkline
()
{
this
.
sqref
=
'
??
'
;
// ToDo добавить значение по умолчанию
this
.
f
=
'
??
'
;
...
...
common/Charts/DrawingObjects.js
View file @
fe5617ad
"
use strict
"
;
"
use strict
"
;
/* DrawingObjects.js
*
...
...
@@ -305,6 +305,77 @@ prot["asc_setFormatCode"] = prot.asc_setFormatCode;
function
CSparklineView
()
{
this
.
col
=
null
;
this
.
row
=
null
;
this
.
ws
=
null
;
this
.
extX
=
null
;
this
.
extY
=
null
;
this
.
chartSpace
=
null
;
}
CSparklineView
.
prototype
.
initFromSparkline
=
function
(
oSparkline
,
oSparklineGroup
,
worksheetView
)
{
this
.
ws
=
worksheetView
;
var
settings
=
new
asc_ChartSettings
();
switch
(
oSparklineGroup
.
type
)
{
case
Asc
.
ESparklineType
.
Column
:
{
settings
.
type
=
c_oAscChartTypeSettings
.
barNormal
;
break
;
}
case
Asc
.
ESparklineType
.
Stacked
:
{
settings
.
type
=
c_oAscChartTypeSettings
.
barStacked
;
break
;
}
default
:
{
settings
.
type
=
c_oAscChartTypeSettings
.
lineNormal
;
break
;
}
}
var
ser
=
new
asc_CChartSeria
();
ser
.
Val
.
Formula
=
oSparkline
.
f
;
var
chartSeries
=
{
series
:
[
ser
],
parsedHeaders
:
{
bLeft
:
false
,
bTop
:
false
}};
var
chart_space
=
DrawingObjectsController
.
prototype
.
_getChartSpace
(
chartSeries
,
settings
,
true
);
chart_space
.
setWorksheet
(
worksheetView
.
model
);
this
.
chartSpace
=
chart_space
;
var
oBBox
=
worksheetView
.
model
.
getCell
(
oSparkline
.
sqref
);
this
.
col
=
oBBox
.
c1
;
this
.
row
=
oBBox
.
r1
;
this
.
extX
=
worksheetView
.
getColumnWidth
(
oBBox
.
c1
,
3
);
this
.
extY
=
worksheetView
.
getRowHeight
(
oBBox
.
r1
,
3
);
CheckSpPrXfrm
(
this
.
chartSpace
);
this
.
chartSpace
.
spPr
.
xfrm
.
setOffX
(
0
);
this
.
chartSpace
.
spPr
.
xfrm
.
setOffY
(
0
);
this
.
chartSpace
.
spPr
.
xfrm
.
setExtX
(
this
.
extX
);
this
.
chartSpace
.
spPr
.
xfrm
.
setExtY
(
this
.
extY
);
this
.
chartSpace
.
recalculate
();
};
CSparklineView
.
prototype
.
draw
=
function
(
graphics
)
{
var
x
=
this
.
ws
.
getCellLeft
(
this
.
col
,
3
);
var
y
=
this
.
ws
.
getCellTop
(
this
.
row
,
3
);
var
extX
=
this
.
ws
.
getColumnWidth
(
this
.
col
,
3
);
var
extY
=
this
.
ws
.
getRowHeight
(
this
.
row
,
3
);
if
(
Math
.
abs
(
this
.
extX
-
extX
)
>
0.01
||
Math
.
abs
(
this
.
extY
-
extY
)
>
0.01
)
{
this
.
chartSpace
.
spPr
.
xfrm
.
setExtX
(
extX
);
this
.
chartSpace
.
spPr
.
xfrm
.
setExtY
(
extY
);
this
.
extX
=
extX
;
this
.
extY
=
extY
;
this
.
chartSpace
.
recalculate
();
}
graphics
.
m_oCoordTransform
.
tx
=
x
;
graphics
.
m_oCoordTransform
.
ty
=
y
;
};
//-----------------------------------------------------------------------------------
// Manager
//-----------------------------------------------------------------------------------
...
...
@@ -1913,6 +1984,23 @@ function DrawingObjects() {
}
};
_this
.
createSparklineViews
=
function
(
oSparkLineGroup
)
{
oSparkLineGroup
.
clearCached
();
for
(
var
i
=
0
;
i
<
oSparkLineGroup
.
arrSparklines
.
length
;
++
i
)
{
var
oSparklineView
=
new
CSparklineView
();
oSparklineView
.
initFromSparkline
(
oSparkLineGroup
.
arrSparklines
[
i
],
oSparkLineGroup
,
worksheet
);
oSparkLineGroup
.
addView
(
oSparklineView
);
}
};
_this
.
drawSparkLineGroup
=
function
(
oSparkLineGroup
,
oDrawingContext
)
{
},
_this
.
rebuildChartGraphicObjects
=
function
(
data
)
{
if
(
!
worksheet
)
...
...
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