Skip to content

Instantly share code, notes, and snippets.

@patilv
Created May 7, 2014 12:55
Show Gist options
  • Save patilv/db9abacc8820687bd156 to your computer and use it in GitHub Desktop.
Save patilv/db9abacc8820687bd156 to your computer and use it in GitHub Desktop.
datable
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css'>
<script src='http://code.jquery.com/jquery-1.10.2.min.js' type='text/javascript'></script>
<script src='http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 800px;
height: 400px;
}
</style>
</head>
<body >
<table id = 'chart240833c5541e' class = 'rChart datatables'></table>
<script type="text/javascript" charset="utf-8">
var chartParamschart240833c5541e = {
"dom": "chart240833c5541e",
"width": 800,
"height": 400,
"table": {
"aaData": [
[
2009,
97,
11,
2207,
639,
3,
19,
9,
465,
97,
47,
335,
3929,
215954,
96270,
80672,
73328,
862688,
35083,
60311,
8511,
11371,
26814
],
[
2006,
94,
18,
1946,
393,
2,
18,
0,
103,
100,
16,
344,
3034,
206079,
94181,
78091,
66076,
821654,
23956,
51286,
7145,
10267,
24810
],
[
2002,
54,
20,
1430,
427,
2,
20,
2,
99,
114,
3,
152,
2323,
201979,
91100,
63899,
52238,
745127,
10584,
34153,
5211,
8385,
23921
],
[
1998,
35,
33,
831,
448,
2,
28,
6,
32,
45,
11,
35,
1506,
199064,
89013,
49287,
43141,
656445,
5505,
28456,
4479,
6926,
23791
],
[
1995,
49,
0,
694,
263,
0,
30,
2,
42,
55,
9,
88,
1232,
205351,
96263,
43760,
44723,
606286,
4444,
26471,
3343,
6531,
24729
],
[
1990,
25,
0,
306,
125,
0,
13,
0,
8,
35,
9,
90,
611,
273116,
133594,
49824,
45830,
534143,
3683,
19427,
2375,
6118,
44476
],
[
1986,
23,
0,
300,
101,
0,
0,
0,
1,
36,
12,
49,
522,
275132,
120920,
40904,
23454,
411376,
3417,
16891,
875,
5071,
33945
],
[
1983,
6,
8,
219,
87,
4,
0,
1,
0,
28,
10,
45,
408,
270101,
128140,
38672,
16127,
386320,
3441,
13178,
660,
4397,
30453
]
],
"aoColumns": [
{
"sTitle": "Year"
},
{
"sTitle": "Bengali"
},
{
"sTitle": "Gujarati"
},
{
"sTitle": "Hindi"
},
{
"sTitle": "HindiUrdu"
},
{
"sTitle": "Kannada"
},
{
"sTitle": "Malayalam"
},
{
"sTitle": "Marathi"
},
{
"sTitle": "Punjabi"
},
{
"sTitle": "Tamil"
},
{
"sTitle": "Telugu"
},
{
"sTitle": "Urdu"
},
{
"sTitle": "Indian"
},
{
"sTitle": "French"
},
{
"sTitle": "German"
},
{
"sTitle": "Italian"
},
{
"sTitle": "Japanese"
},
{
"sTitle": "Spanish"
},
{
"sTitle": "Arabic"
},
{
"sTitle": "Chinese"
},
{
"sTitle": "Korean"
},
{
"sTitle": "Portuguese"
},
{
"sTitle": "Russian"
}
],
"bScrollInfinite": true,
"bScrollCollapse": true,
"sScrollY": "200px",
"width": "500px"
},
"id": "chart240833c5541e"
}
$('#' + chartParamschart240833c5541e.id).removeClass("rChart")
$(document).ready(function() {
drawDataTable(chartParamschart240833c5541e)
});
function drawDataTable(chartParams){
var dTable = $('#' + chartParams.dom).dataTable(
chartParams.table
);
//first use rCharts width
$('#'+chartParams.id+"_wrapper").css("width",chartParams.width)
$('#'+chartParams.id+"_wrapper").css("width",chartParams.table.width)
//then if specified change to table width
$('#'+chartParams.id+"_wrapper").css("margin-left", "auto");
$('#'+chartParams.id+"_wrapper").css("margin-right", "auto");
dTable.fnAdjustColumnSizing();
}
</script>
<script></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment