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

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