1 | <html><head>
|
---|
2 | <meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
---|
3 |
|
---|
4 | <script type="text/javascript" src="../js/json/json2.js"></script>
|
---|
5 | <script type="text/javascript" src="../js/swfobject.js"></script>
|
---|
6 |
|
---|
7 | <script type="text/javascript">
|
---|
8 |
|
---|
9 | function ofc_ready()
|
---|
10 | {
|
---|
11 | alert('ofc_ready');
|
---|
12 | //load();
|
---|
13 | }
|
---|
14 |
|
---|
15 | function open_flash_chart_data()
|
---|
16 | {
|
---|
17 | alert( 'reading data' );
|
---|
18 | return JSON.stringify(chart);
|
---|
19 | }
|
---|
20 |
|
---|
21 | function load_1()
|
---|
22 | {
|
---|
23 | tmp = findSWF("my_chart");
|
---|
24 | x = tmp.load( JSON.stringify(chart) );
|
---|
25 | }
|
---|
26 |
|
---|
27 | function load_2()
|
---|
28 | {
|
---|
29 | tmp = findSWF("my_chart");
|
---|
30 | x = tmp.load( JSON.stringify(chart2) );
|
---|
31 | }
|
---|
32 |
|
---|
33 | function findSWF(movieName) {
|
---|
34 | if (navigator.appName.indexOf("Microsoft")!= -1) {
|
---|
35 | return window[movieName];
|
---|
36 | } else {
|
---|
37 | return document[movieName];
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | var chart = {
|
---|
42 | "title":{
|
---|
43 | "text": "Many data lines",
|
---|
44 | "style": "{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}"
|
---|
45 | },
|
---|
46 |
|
---|
47 | "y_legend":{
|
---|
48 | "text": "Open Flash Chart",
|
---|
49 | "style": "{color: #736AFF; font-size: 12px;}"
|
---|
50 | },
|
---|
51 |
|
---|
52 | "elements":[
|
---|
53 | {
|
---|
54 | "type": "bar",
|
---|
55 | "alpha": 0.5,
|
---|
56 | "colour": "#9933CC",
|
---|
57 | "text": "Page views",
|
---|
58 | "font-size": 10,
|
---|
59 | "values" : [9,6,7,9,5,7,6,9,7]
|
---|
60 | },
|
---|
61 | {
|
---|
62 | "type": "bar",
|
---|
63 | "alpha": 0.5,
|
---|
64 | "colour": "#CC9933",
|
---|
65 | "text": "Page views 2",
|
---|
66 | "font-size": 10,
|
---|
67 | "values" : [6,7,9,5,7,6,9,7,3]
|
---|
68 | }
|
---|
69 | ],
|
---|
70 |
|
---|
71 | "x_axis":{
|
---|
72 | "stroke":1,
|
---|
73 | "tick_height":10,
|
---|
74 | "colour":"#d000d0",
|
---|
75 | "grid_colour":"#00ff00",
|
---|
76 | "labels": ["January","February","March","April","May","June","July","August","Spetember"]
|
---|
77 | },
|
---|
78 |
|
---|
79 | "y_axis":{
|
---|
80 | "stroke": 4,
|
---|
81 | "tick_length": 3,
|
---|
82 | "colour": "#d000d0",
|
---|
83 | "grid_colour": "#00ff00",
|
---|
84 | "offset": 0,
|
---|
85 | "max": 20
|
---|
86 | }
|
---|
87 | };
|
---|
88 |
|
---|
89 |
|
---|
90 | var chart2 = {
|
---|
91 | "title":{
|
---|
92 | "text": "Sketch",
|
---|
93 | "style": "{font-size:35px; color: #567300}"
|
---|
94 | },
|
---|
95 |
|
---|
96 | "elements":[
|
---|
97 | {
|
---|
98 | "type": "bar_sketch",
|
---|
99 | "colour": "#81AC00",
|
---|
100 | "outline-colour": "#567300",
|
---|
101 | "text": "Sketch",
|
---|
102 | "font-size": 10,
|
---|
103 | "offset": 6,
|
---|
104 | "values" : [
|
---|
105 | 3,
|
---|
106 | 8,
|
---|
107 | -5,
|
---|
108 | {"top":5,"outline-colour": "#7030A0", "tip": "outline"},
|
---|
109 | 4,
|
---|
110 | {"top":5, "colour": "#99FF00", "tip": "colour"},
|
---|
111 | {"top":-3,"colour": "#99FF00", "outline-colour": "#7030A0", "tip": "colour + outline"},
|
---|
112 | 2,
|
---|
113 | 7.5]
|
---|
114 | }
|
---|
115 | ],
|
---|
116 |
|
---|
117 | "x_axis":{
|
---|
118 | "labels": ["January","February","March","April","May","June","July","August","Spetember"]
|
---|
119 | },
|
---|
120 |
|
---|
121 | "y_axis":{
|
---|
122 | "min": -10,
|
---|
123 | "max": 10
|
---|
124 | },
|
---|
125 |
|
---|
126 | "tooltip":{
|
---|
127 | "text": "My Tip<br>#top#,#bottom# = #val#"
|
---|
128 | }
|
---|
129 |
|
---|
130 | };
|
---|
131 |
|
---|
132 | alert( chart );
|
---|
133 | </script>
|
---|
134 |
|
---|
135 | </head>
|
---|
136 | <body>
|
---|
137 |
|
---|
138 | <div id="my_chart"></div>
|
---|
139 |
|
---|
140 | <script type="text/javascript">
|
---|
141 | swfobject.embedSWF("../open-flash-chart/open-flash-chart.swf", "my_chart", "450", "300", "9.0.0");
|
---|
142 | </script>
|
---|
143 |
|
---|
144 |
|
---|
145 |
|
---|
146 | <div>
|
---|
147 | <INPUT TYPE=BUTTON OnClick="load_1();" VALUE="Chart 1">
|
---|
148 | <INPUT TYPE=BUTTON OnClick="load_2();" VALUE="Chart 2">
|
---|
149 | </div>
|
---|
150 |
|
---|
151 | </body>
|
---|
152 | </html>
|
---|