Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Sascha Herzinger
AdaCharts
Commits
1864ad15
Commit
1864ad15
authored
Feb 01, 2019
by
Sascha Herzinger
Browse files
new capture setup/teardown
parent
33a0910c
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/test-scatterplot.html
View file @
1864ad15
...
@@ -40,8 +40,8 @@
...
@@ -40,8 +40,8 @@
function
update
()
{
function
update
()
{
scatterplot
.
update
({
scatterplot
.
update
({
values
:
generateRandomData
(
1
000
,
-
10000
,
10000
),
values
:
generateRandomData
(
2
000
,
-
10000
,
10000
),
categories
:
{
name
:
'
Gender
'
,
0
:
'
male
'
,
2
:
'
female
'
,
1
:
'
N/A
'
},
categories
:
{
name
:
'
Gender
'
,
0
:
'
male
'
,
1
:
'
female
'
,
2
:
'
N/A
'
},
title
:
'
Scatterplot
'
,
title
:
'
Scatterplot
'
,
xAxisLabel
:
'
X Axis Values
'
,
xAxisLabel
:
'
X Axis Values
'
,
yAxisLabel
:
'
Y Axis Values
'
,
yAxisLabel
:
'
Y Axis Values
'
,
...
...
src/charts/Chart.js
View file @
1864ad15
...
@@ -22,8 +22,10 @@ export default class {
...
@@ -22,8 +22,10 @@ export default class {
this
.
render
(
args
);
this
.
render
(
args
);
}
}
prepareSVGForCapture
()
{
captureSetup
()
{
throw
Error
(
'
prepareSVGForCapture() not implemented.
'
);
}
captureTeardown
()
{
}
}
get
containerWidth
()
{
get
containerWidth
()
{
...
@@ -35,6 +37,7 @@ export default class {
...
@@ -35,6 +37,7 @@ export default class {
}
}
toPNG
()
{
toPNG
()
{
this
.
captureSetup
();
html2canvas
(
this
.
container
).
then
((
canvas
)
=>
{
html2canvas
(
this
.
container
).
then
((
canvas
)
=>
{
const
img
=
canvas
.
toDataURL
(
'
image/png
'
);
const
img
=
canvas
.
toDataURL
(
'
image/png
'
);
const
a
=
document
.
createElement
(
'
a
'
);
const
a
=
document
.
createElement
(
'
a
'
);
...
@@ -43,6 +46,7 @@ export default class {
...
@@ -43,6 +46,7 @@ export default class {
document
.
body
.
appendChild
(
a
);
document
.
body
.
appendChild
(
a
);
a
.
click
();
a
.
click
();
document
.
body
.
removeChild
(
a
);
document
.
body
.
removeChild
(
a
);
this
.
captureTeardown
();
});
});
}
}
}
}
src/charts/impl/Heatmap.js
View file @
1864ad15
...
@@ -48,10 +48,6 @@ export default class extends Chart {
...
@@ -48,10 +48,6 @@ export default class extends Chart {
return
'
heatmap
'
;
return
'
heatmap
'
;
}
}
prepareSVGForCapture
()
{
return
this
.
svg
;
}
prepareValues
({
values
,
rows
,
cols
})
{
prepareValues
({
values
,
rows
,
cols
})
{
this
.
data
=
[];
this
.
data
=
[];
rows
.
forEach
((
row
,
i
)
=>
{
rows
.
forEach
((
row
,
i
)
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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