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
0d137805
Commit
0d137805
authored
Mar 30, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Отрисовка спаклайнов
parent
25b8e107
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
25 deletions
+138
-25
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+26
-1
common/Charts/DrawingObjects.js
common/Charts/DrawingObjects.js
+112
-24
No files found.
cell/model/WorkbookElems.js
View file @
0d137805
...
...
@@ -4463,9 +4463,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 @
0d137805
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
/* DrawingObjects.js
...
...
@@ -329,6 +329,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
//-----------------------------------------------------------------------------------
...
...
@@ -1937,6 +2008,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