Skip to content

Commit

Permalink
* bug in firefox solved using 200ms setTimeout (still don't know the …
Browse files Browse the repository at this point in the history
…exact reason)
  • Loading branch information
c0untd0wn committed May 31, 2012
1 parent fe333b3 commit 3852cb8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion css/basic.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* page styles */
body { font-family: "Segoe UI", Frutiger,Tahoma,Helvetica,"Helvetica Neue", Arial, sans-serif; }
table { border-collapse: collapse; display: none; }
table { border-collapse: collapse; }
td, th {
text-align: center;
border: 1px solid #ddd;
Expand Down
1 change: 1 addition & 0 deletions iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
<link href="css/visualize.css" type="text/css" rel="stylesheet" />
</head>
<body>
<input type="button" value="See it in table" />
</body>
</html>
32 changes: 26 additions & 6 deletions js/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,40 @@ $(function(){
href: "css/visualize-dark.css"
}).appendTo("head");
}
$('#input_table', window.parent.document).clone().appendTo('body');

graph_or_table = 0;

$('#input_table', window.parent.document).clone().prependTo('body');
$('thead th:last-child').remove();
$('tbody td:last-child').remove();
$('tbody tr:last').remove();
$('input').click(function(){
if(graph_or_table == 0){
$('table').show();
$('.visualize').hide();
graph_or_table = 1;
$('input').val('See it in graph');
}
else{
$('table').hide();
$('.visualize').show();
graph_or_table = 0;
$('input').val('See it in table');
}
});
$('caption, th, td').each(function(){
i = $(this).find('input');
v = i.val();
p = i.parent();
p.empty();
p.text(v);
});
type = $.getUrlVar('type');
if(type == 'pie'){ $('table').visualize({type: 'pie', parseDirection: $.getUrlVar('axis'), height: '300px', width: '420px'}); }
else if(type == 'bar'){ $('table').visualize({type: 'bar', parseDirection: $.getUrlVar('axis'), width: '420px'}); }
else if(type == 'area'){ $('table').visualize({type: 'area', parseDirection: $.getUrlVar('axis'), width: '420px'}); }
else{ $('table').visualize({type: 'line', parseDirection: $.getUrlVar('axis'), width: '420px'}); }
setTimeout(function(){
$('#input_table').hide();
type = $.getUrlVar('type');
if(type == 'pie'){ $('#input_table').visualize({type: 'pie', parseDirection: $.getUrlVar('axis'), height: '300px', width: '420px'}); alert($('table').html()); }
else if(type == 'bar'){ $('#input_table').visualize({type: 'bar', parseDirection: $.getUrlVar('axis'), width: '420px'}); }
else if(type == 'area'){ $('#input_table').visualize({type: 'area', parseDirection: $.getUrlVar('axis'), width: '420px'}); }
else{ $('#input_table').visualize({type: 'line', parseDirection: $.getUrlVar('axis'), width: '420px'}); }
}, 200);
});

0 comments on commit 3852cb8

Please sign in to comment.