Skip to content

Commit 587fc5e

Browse files
committed
Starte implementing bar style (showing top surface already)
1 parent 32b423b commit 587fc5e

File tree

4 files changed

+243
-87
lines changed

4 files changed

+243
-87
lines changed

js/src/graph3d/examples/example14_bar.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
22
<html>
33
<head>
4-
<title>Graph 3D bar chart demo</title>
4+
<title>Graph 3D bar style</title>
55

66
<style>
77
body {font: 10pt arial;}
@@ -47,10 +47,7 @@
4747
width: "600px",
4848
height: "600px",
4949
style: "bar",
50-
xMin: -1,
51-
xMax: 11,
52-
yMin: -1,
53-
yMax: 11,
50+
barWidth: 1,
5451
showPerspective: true,
5552
showGrid: true,
5653
showShadow: false,
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<html>
3+
<head>
4+
<title>Graph 3D dot-line style</title>
5+
6+
<style>
7+
body {font: 10pt arial;}
8+
</style>
9+
10+
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
11+
<script type="text/javascript" src="../graph3d.js"></script>
12+
13+
<script type="text/javascript">
14+
var data = null;
15+
var graph = null;
16+
17+
google.load("visualization", "1");
18+
19+
// Set callback to run when API is loaded
20+
google.setOnLoadCallback(drawVisualization);
21+
22+
function custom(x, y) {
23+
return (Math.sin(x/Math.PI) * Math.cos(y/Math.PI) * 50 + 50);
24+
}
25+
26+
// Called when the Visualization API is loaded.
27+
function drawVisualization() {
28+
// Create and populate a data table.
29+
data = new google.visualization.DataTable();
30+
data.addColumn('number', 'x');
31+
data.addColumn('number', 'y');
32+
data.addColumn('number', 'z');
33+
34+
// create some nice looking data with sin/cos
35+
var steps = 20; // number of datapoints will be steps*steps
36+
var axisMax = 10;
37+
var axisStep = axisMax / steps;
38+
for (var x = 0; x <= axisMax; x+=axisStep) {
39+
for (var y = 0; y <= axisMax; y+=axisStep) {
40+
var value = custom(x,y);
41+
data.addRow([x, y, value]);
42+
}
43+
}
44+
45+
// specify options
46+
var options = {
47+
width: "600px",
48+
height: "600px",
49+
style: "dot-line",
50+
xMin: -1,
51+
xMax: 11,
52+
yMin: -1,
53+
yMax: 11,
54+
showPerspective: true,
55+
showGrid: true,
56+
showShadow: false,
57+
keepAspectRatio: true,
58+
verticalRatio: 0.5
59+
};
60+
61+
// Instantiate our graph object.
62+
graph = new links.Graph3d(document.getElementById('mygraph'));
63+
64+
// Draw our graph with the created data and options
65+
graph.draw(data, options);
66+
}
67+
</script>
68+
</head>
69+
70+
<body>
71+
<div id="mygraph"></div>
72+
73+
<div id="info"></div>
74+
</body>
75+
</html>

js/src/graph3d/examples/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ <h1>Examples</h1>
2121
<p><a href="example12_datastream.html">example12_datastream.html</a></p>
2222
<p><a href="example13_mobile.html">example13_mobile.html</a></p>
2323
<p><a href="example14_bar.html">example14_bar.html</a></p>
24+
<p><a href="example15_dot-line.html">example15_dot-line.html</a></p>
2425

2526
</div>
2627
</body>

0 commit comments

Comments
 (0)