HTMLcopy
1
<div id="container"></div>
2
<div style="position: absolute; top: 40px; left: 60%; width: 31%;">
3
<input style="margin-bottom: 10px;" type="button" value="getJpgBase64String" onclick="getJpgBase64String()">
4
<textarea style="width: 100%;" rows="5" cols="70" id="getJpgBase64String"></textarea>
5
</div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
var chart;
2
anychart.onDocumentReady(function () {
3
var data = getData();
4
5
chart = anychart.pert();
6
chart.data(data, 'as-table');
7
chart.margin([0, '45%', 0, 0]);
8
chart.title('Returns JPG as base64 string');
9
chart.container('container');
10
chart.draw();
11
});
12
13
function getJpgBase64String() {
14
15
// Get JPG as base64 string.
16
chart.getJpgBase64String(function (response) {
17
var base64String = document.getElementById('getJpgBase64String');
18
base64String.innerHTML = response;
19
});
20
}
21
22
function getData() {
23
return [
24
{id: 'A1', duration: 1, name: 'Task A'},
25
{id: 'A2', duration: 3, name: 'Task B'},
26
{id: 'A3', duration: 3, name: 'Task C'},
27
{id: 'A4', duration: 1, name: 'Task D'},
28
{id: 'A5', duration: 2, name: 'Task AD', dependsOn: ['A1', 'A4']},
29
{id: 'A6', duration: 2, name: 'Task BC', dependsOn: ['A2', 'A3']}
30
];
31
}