source: code/Website/data-files/json-test.html@ 7849

Last change on this file since 7849 was 7849, checked in by dennisw, 15 years ago
File size: 2.9 KB
Line 
1<html><head>
2<meta http-equiv="content-type" content="text/html; charset=UTF-8">
3
4<script type="text/javascript" src="../js/swfobject.js"></script>
5<script type="text/javascript" src="../js/json/json2.js"></script>
6
7<script type="text/javascript">
8
9function ofc_ready()
10{
11 alert('ofc_ready');
12 // tmp = findSWF("ofc");
13 // x = tmp.load( JSON.stringify(data) );
14}
15
16function open_flash_chart_data()
17{
18 alert( 'reading data' );
19 return JSON.stringify(data);
20}
21
22function load()
23{
24 tmp = findSWF("ofc");
25 x = tmp.load( JSON.stringify(data_2) );
26}
27
28function findSWF(movieName) {
29 if (navigator.appName.indexOf("Microsoft")!= -1) {
30 return window[movieName];
31 } else {
32 return document[movieName];
33 }
34}
35
36var data = {
37
38 "title_":{
39 "text":"Custom tooltip",
40 "style":"{font-size: 20px; font-family: Verdana; text-align: center;}"
41 },
42
43 "elements":[
44 {
45 "type": "bar",
46 "colour": "#9933CC",
47 "text": "Page views",
48 "font-size": 10,
49 "values" : [9,6,7,9,5,7,6,9,9]
50 }
51 ],
52 "x_axis":{
53 "labels": ["January","February","March","April","May","June","July","August","Spetember"]
54 },
55 "y_axis":{
56 "max":20
57 },
58 "tooltip":{
59 "shadow":false,
60 "stroke":5,
61 "colour":"#00d000",
62 "background":"#d0d0ff",
63 "title":"{font-size: 14px; color: #905050;}",
64 "body":"{font-size: 10px; font-weight: bold; color: #9090ff;}"
65 }
66}
67
68var data_2 = {
69 "title":{
70 "text": "Many data lines",
71 "style": "{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}"
72 },
73
74 "y_legend":{
75 "text": "Open Flash Chart",
76 "style": "{color: #736AFF; font-size: 12px;}"
77 },
78
79 "elements":[
80 {
81 "type": "bar",
82 "alpha": 0.5,
83 "colour": "#9933CC",
84 "text": "Page views",
85 "font-size": 10,
86 "values" : [9,6,7,9,5,7,6,9,7]
87 },
88 {
89 "type": "bar",
90 "alpha": 0.5,
91 "colour": "#CC9933",
92 "text": "Page views 2",
93 "font-size": 10,
94 "values" : [9,6,7,9,5,7,6,9,7]
95 }
96 ],
97
98 "x_axis":{
99 "stroke":1,
100 "tick_height":10,
101 "colour":"#d000d0",
102 "grid_colour":"#00ff00",
103 "labels": ["January","February","March","April","May","June","July","August","Spetember"]
104 },
105
106 "y_axis":{
107 "stroke": 4,
108 "tick_length": 3,
109 "colour": "#d000d0",
110 "grid_colour": "#00ff00",
111 "offset": 0,
112 "max": 20
113 }
114}
115
116
117
118</script>
119
120
121</head>
122<body>
123
124
125<div id="my_chart"></div>
126
127<script type="text/javascript">
128var so = new SWFObject("../open-flash-chart/open-flash-chart.swf?p=moo", "ofc", "300", "250", "9", "#FFFFFF");
129so.addParam("allowScriptAccess", "always" );//"sameDomain");
130so.write("my_chart");
131</script>
132
133<a href="javascript:load()">load json</a>
134
135</body>
136</html>
Note: See TracBrowser for help on using the repository browser.