Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions demos/barchartfromfile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>barchart</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Yane Frenski">

<style>
#threegraphs-valuelable{
color: #fff;
text-shadow: 1px 1px 2px #000;
position: absolute;
top: 200px;
left: 500px;
z-index: 9;
font-size: 16px;
display: none;
padding: 10px;
background: #26272b;
border: 1px solid #fff;
}
</style>
<link rel="stylesheet" type="text/css" href="../src/style.css">
<script type="text/javascript" src="../lib/three.min.js"></script>
<script type="text/javascript" src="../lib/TrackballControls.js"></script>
<script type="text/javascript" src="../lib/TrackballControlsTouch.js"></script>
<script type="text/javascript" src="../src/ThreeGraphs.js"></script>
<script type="text/javascript" src="../fonts/helvetiker_bold.typeface.js"></script>

</head>
<body bgcolor="#D8CEF6">
<p id="errormessage"></p>
<div id="wrapper">



<div class="leftadvanced">
<a href="barchart.html">New graph</a> <br>


Choose graph style:
<form>
<input type="radio" name="bartype" onchange="setzeroaxis();" value="" checked>No data values on axis<br><br>
<input type="radio" name="bartype" onchange="setoneaxis();" value="">Data values 1 axis<br> <br>
<input type="radio" name="bartype" onchange="settwoaxis();" value="" >Data values 2 axises</names><br>

</form>

Select a text file:
<input type="file" id="fileInput">
</div>
</div>


<script>
function settwoaxis() {

window.datacellvalueonaxis = 'twoaxis';
}


function setoneaxis() {
window.datacellvalueonaxis = 'oneaxis';
}

function setzeroaxis() {
window.datacellvalueonaxis = 'zeroaxis';
}

function setCommaSeparated() {
window.separatorchar = ',';
}

window.reversecols = '1';
</script>


<script src="../src/text.js">
</script>

<!-- -->
<div id="threegraphs-valuelable">
sss
</div>
</body>
</html>
54 changes: 54 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#wrapper {
margin: 0 auto;
position: absolute;
width: 100px;
background: #EFF5FB;
padding: 2px;
}

#fileDisplayArea {
}

body {
margin: 0;
padding: 0;
}


div.left {
font-size: 18px;
margin: 2px 0 2px 0;
padding: 2px;
}

#wrapper {
margin: 0 auto;
position: absolute;
width: 100px;
background: #EFF5FB;
padding: 2px;
}

#fileDisplayArea {
}

body {
margin: 0;
padding: 0;
}



div.left{
font-size: 18px;
margin: 2px 0 2px 0;
padding: 2px;
}


div.leftadvanced {
font-size: 12px;
margin: 2px 0 2px 0;
padding: 2px;
}

29 changes: 29 additions & 0 deletions src/text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
window.onload = function() {

var fileInput = document.getElementById('fileInput');
//var fileDisplayArea = document.getElementById('fileDisplayArea');

fileInput.addEventListener('change', function(e) {
var file = fileInput.files[0];
var textType = /text.*/;
// if (file.type.match(textType)) {

var reader = new FileReader();

reader.onload = function(e) {
//fileDisplayArea.innerText = reader.result;
window.myinit = reader.result;
newBarChart = new THREEGRAPHS.BarChartFromFile ( reader.result );
newBarChart.init();


}

reader.readAsText(file);
// } else {
// fileDisplayArea.innerText = "File not supported!";
// }
// hei4(window.myinit);

});
}
Loading