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
5d84250e
Commit
5d84250e
authored
May 25, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add chart on worksheet
parent
24555f00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
174 additions
and
0 deletions
+174
-0
cell/apiBuilder.js
cell/apiBuilder.js
+174
-0
No files found.
cell/apiBuilder.js
View file @
5d84250e
...
@@ -24,6 +24,34 @@
...
@@ -24,6 +24,34 @@
this
.
range
=
range
;
this
.
range
=
range
;
}
}
/**
* Class representing a graphical object.
* @constructor
*/
function
ApiDrawing
(
Drawing
)
{
this
.
Drawing
=
Drawing
;
}
/**
* This type specifies the types, create charts
* @typedef {("bar" | "barStacked" | "barStackedPercent" | "bar3D" | "barStacked3D" | "barStackedPercent3D" | "barStackedPercent3DPerspective" | "horizontalBar" | "horizontalBarStacked" | "horizontalBarStackedPercent" | "horizontalBar3D" | "horizontalBarStacked3D" | "horizontalBarStackedPercent3D" | "lineNormal" | "lineStacked" | "lineStackedPercent" | "line3D" | "pie" | "pie3D" | "doughnut" | "scatter" | "stock")} ChartType
*/
/**
* Class representing a Chart.
* @constructor
*
*/
function
ApiChart
(
Chart
)
{
ApiChart
.
superclass
.
constructor
.
call
(
this
,
Chart
.
parent
);
this
.
Chart
=
Chart
;
}
AscCommon
.
extendClass
(
ApiChart
,
ApiDrawing
);
/**
/**
* Returns an object that represents the active sheet
* Returns an object that represents the active sheet
* @memberof Api
* @memberof Api
...
@@ -71,6 +99,148 @@
...
@@ -71,6 +99,148 @@
this
.
worksheet
.
setColWidth
(
width
,
column
,
column
);
this
.
worksheet
.
setColWidth
(
width
,
column
,
column
);
};
};
/**
* Set column width
* @memberof ApiWorksheet
* @param {string} sDataRange
* @param {bool} bInRows
* @param {ChartType} sType
* @param {number} nStyleIndex
* @param {string} sFromRange
* @param {string} sToRange
* @param {}
*/
ApiWorksheet
.
prototype
.
addChart
=
function
(
sDataRange
,
bInRows
,
sType
,
nStyleIndex
,
nFromCol
,
nFromRow
,
nToCol
,
nToRow
)
{
History
.
Create_NewPoint
();
var
settings
=
new
AscCommon
.
asc_ChartSettings
();
switch
(
sType
)
{
case
"
bar
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
barNormal
;
break
;
}
case
"
barStacked
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
barStacked
;
break
;
}
case
"
barStackedPercent
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
barStackedPer
;
break
;
}
case
"
bar3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
barNormal3d
;
break
;
}
case
"
barStacked3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
barStacked3d
;
break
;
}
case
"
barStackedPercent3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
barStackedPer3d
;
break
;
}
case
"
barStackedPercent3DPerspective
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
barNormal3dPerspective
;
break
;
}
case
"
horizontalBar
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
hBarNormal
;
break
;
}
case
"
horizontalBarStacked
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
hBarStacked
;
break
;
}
case
"
horizontalBarStackedPercent
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
hBarStackedPer
;
break
;
}
case
"
horizontalBar3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
hBarNormal3d
;
break
;
}
case
"
horizontalBarStacked3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
hBarStacked3d
;
break
;
}
case
"
horizontalBarStackedPercent3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
hBarStackedPer3d
;
break
;
}
case
"
lineNormal
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
lineNormal
;
break
;
}
case
"
lineStacked
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
lineStacked
;
break
;
}
case
"
lineStackedPercent
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
lineStackedPer
;
break
;
}
case
"
line3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
line3d
;
break
;
}
case
"
pie
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
pie
;
break
;
}
case
"
pie3D
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
pie3d
;
break
;
}
case
"
doughnut
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
doughnut
;
break
;
}
case
"
scatter
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
scatter
;
break
;
}
case
"
stock
"
:
{
settings
.
type
=
Asc
.
c_oAscChartTypeSettings
.
stock
;
break
;
}
}
settings
.
style
=
nStyleIndex
;
settings
.
inColumns
=
!
bInRows
;
settings
.
range
=
sDataRange
;
var
oChart
=
AscFormat
.
DrawingObjectsController
.
prototype
.
getChartSpace
(
this
.
worksheet
,
settings
);
oChart
.
setWorksheet
(
this
.
worksheet
);
oChart
.
setBFromSerialize
(
true
);
oChart
.
addToDrawingObjects
();
oChart
.
setDrawingBaseCoords
(
nFromCol
,
0
,
nFromRow
,
0
,
nToCol
,
0
,
nToRow
,
0
,
0
,
0
,
0
,
0
);
if
(
AscFormat
.
isRealNumber
(
nStyleIndex
))
{
oChart
.
setStyle
(
nStyleIndex
);
}
};
/**
/**
* Set cell value
* Set cell value
* @memberof ApiRange
* @memberof ApiRange
...
@@ -122,6 +292,9 @@
...
@@ -122,6 +292,9 @@
this
.
range
.
setAlignHorizontal
(
value
);
this
.
range
.
setAlignHorizontal
(
value
);
};
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Export
// Export
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
@@ -131,6 +304,7 @@
...
@@ -131,6 +304,7 @@
ApiWorksheet
.
prototype
[
"
getRange
"
]
=
ApiWorksheet
.
prototype
.
getRange
;
ApiWorksheet
.
prototype
[
"
getRange
"
]
=
ApiWorksheet
.
prototype
.
getRange
;
ApiWorksheet
.
prototype
[
"
formatAsTable
"
]
=
ApiWorksheet
.
prototype
.
formatAsTable
;
ApiWorksheet
.
prototype
[
"
formatAsTable
"
]
=
ApiWorksheet
.
prototype
.
formatAsTable
;
ApiWorksheet
.
prototype
[
"
setColumnWidth
"
]
=
ApiWorksheet
.
prototype
.
setColumnWidth
;
ApiWorksheet
.
prototype
[
"
setColumnWidth
"
]
=
ApiWorksheet
.
prototype
.
setColumnWidth
;
ApiWorksheet
.
prototype
[
"
addChart
"
]
=
ApiWorksheet
.
prototype
.
addChart
;
ApiRange
.
prototype
[
"
setValue
"
]
=
ApiRange
.
prototype
.
setValue
;
ApiRange
.
prototype
[
"
setValue
"
]
=
ApiRange
.
prototype
.
setValue
;
ApiRange
.
prototype
[
"
setFontColor
"
]
=
ApiRange
.
prototype
.
setFontColor
;
ApiRange
.
prototype
[
"
setFontColor
"
]
=
ApiRange
.
prototype
.
setFontColor
;
...
...
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