HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create a chart
4
var chart = anychart.column([
5
{x: "Facebook", y: 100},
6
{x: "Twitter", y: 120},
7
{x: "LinkedIn", y: 180},
8
{x: "Pinterest", y: 170}
9
]);
10
11
// set the chart title
12
chart.title("Click to Share with Custom Defaults");
13
14
// set default export settings
15
// they affect both shareWith*() methods
16
// and context menu export
17
anychart.exports.facebook({caption: "A sample shared with Facebook", link: "https://anychart.com", height: "600", appID: "1167712323282103"});
18
anychart.exports.twitter("https://export.anychart.com/sharing/twitter", "800", "600");
19
anychart.exports.linkedin("AnyChart Area Chart sample shared with LinkedIn", undefined, undefined, "400");
20
anychart.exports.pinterest("https://anychart.com", undefined, "800", undefined);
21
22
// attach click listener
23
chart.listen("pointClick", function(e){
24
switch (e.point.get("x")) {
25
case "Facebook":
26
chart.shareWithFacebook();
27
break;
28
case "Twitter":
29
chart.shareWithTwitter();
30
break;
31
case "LinkedIn":
32
chart.shareWithLinkedIn();
33
break;
34
case "Pinterest":
35
chart.shareWithPinterest();
36
break;
37
}
38
});
39
40
41
// set the container id
42
chart.container("container");
43
// initiate drawing the chart
44
chart.draw();
45
});