Changeset 276 for Dev/branches/Cartis/js
- Timestamp:
- 02/21/12 13:56:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/Cartis/js/dashboardScripts.js
r242 r276 22 22 var mockupData = { 23 23 muData1: [1,2,3,4,5,6], //pie charts 24 muData2: [[1,2,3],[4,5,6]], //bar charts 25 muData3: [[1,2],[3,4],[5,6]] //radar charts 24 muData2: [[1,7],[4,2],[9,6]], //bar charts 25 muData3: [6,8,7,5,9,7,6,4], //radar charts 26 muData4 : [8,34,6,56,3,23] // rose charts 26 27 } 27 28 … … 40 41 var uid = values[values.length-1]; 41 42 var type; 43 42 44 switch (selectBox.id) { 43 45 case "dbSessionInstancesList": … … 50 52 break; 51 53 default: 52 alert("No valid type passed!"); 54 var value = values[0]; 55 var opt; 56 for (var n = 0; n < selectBox.options.length; n++) { 57 if (selectBox.options[n].value == value) { 58 opt = selectBox.options[n]; 59 type = opt.attributes[1].value; 60 } 61 } 62 if (type == null || type == undefined) //error?!?!?! 53 63 break; 54 64 } … … 208 218 form.appendChild(input); 209 219 form.submit(); 210 220 //alert("Graph type is now: "+graphSelection); 211 221 212 222 } … … 225 235 graphSelection.graphType = "Pie"; 226 236 break; 237 case "rose": 238 graphSelection.graphType = "Rose"; 239 break; 227 240 default: 228 241 break; … … 233 246 drawGraph('chart1', 450, 200, graphSelection.graphType, data); 234 247 235 248 // alert("Graph type is now: "+graphSelection.graphType); 236 249 } 237 250 … … 247 260 */ 248 261 // temporary!!!; 249 graphSelection.graphData = mockupData.muData1; 250 return mockupData.muData1; 251 252 //alert("Data is now being formatted"); 262 263 switch (graphSelection.graphType) { 264 case "Bar": 265 graphSelection.graphData = mockupData.muData2; 266 break; 267 case "Pie": 268 graphSelection.graphData = mockupData.muData1; 269 break; 270 case "Radar": 271 graphSelection.graphData = mockupData.muData3; 272 break; 273 case "Rose": 274 graphSelection.graphData = mockupData.muData4; 275 break; 276 } 277 278 return graphSelection.graphData; 279 280 //alert("Data is now being formatted"); 253 281 } 254 282 … … 271 299 case "Bar": 272 300 chart1 = new RGraph.Bar(name, data); 301 chart1.Set('chart.labels', ['1 fault', '2 faults', '3 faults', '4 faults', '5 faults', '6 faults']); 302 chart1.Set('chart.colors', ['#77f', '#7f7', '#f77']); 273 303 break; 274 304 case "Pie": 275 305 chart1 = new RGraph.Pie(name, data); 306 chart1.Set('chart.labels', ['1 fault', '2 faults', '3 faults', '4 faults', '5 faults', '6 faults']); 307 chart1.Set('chart.colors', ['#77f', '#7f7', '#f77']); 276 308 break; 277 309 case "Radar": 278 310 chart1 = new RGraph.Radar(name, data); 279 break; 280 default: 281 break; 282 } 283 284 //chart1.Set('chart.background.barcolor1', 'white'); 285 // chart1.Set('chart.background.barcolor2', 'white'); 286 chart1.Set('chart.labels', ['1st', '2nd', '3rd', '4th', '5th', '6th']); 287 //chart1.Set('chart.key', ['Aapjes', 'Hertjes']); 288 //chart1.Set('chart.key.position.y', 35); 289 //chart1.Set('chart.key.position', 'gutter'); 290 //chart1.Set('chart.key.background', 'rgb(255,255,255)'); 291 chart1.Set('chart.colors', ['#77f', '#7f7']); 292 chart1.Set('chart.shadow', true); 293 chart1.Set('chart.shadow.blur', 15); 311 chart1.Set('chart.colors.alpha', '50%'); 312 chart1.Set('chart.colors', ['rgba(112,112,240,0.5)', 'rgba(112,240,112,0.5)', 'rgba(240,112,112,0.5)']); 313 break; 314 case "Rose": 315 chart1 = new RGraph.Rose(name, data); 316 chart1.Set('chart.labels', ['1 fault', '2 faults', '3 faults', '4 faults', '5 faults', '6 faults']); 317 chart1.Set('chart.colors', ['#77f', '#7f7', '#f77']); 318 break; 319 default: 320 break; 321 } 322 323 324 325 chart1.Set('chart.shadow', false); 326 chart1.Set('chart.shadow.blur', 0); 294 327 chart1.Set('chart.shadow.offsetx', 0); 295 328 chart1.Set('chart.shadow.offsety', 0); … … 308 341 } 309 342 343 344 310 345 function addToDashboard() { 346 alert('You saved "'+graphSelection.graphType.toLowerCase()+' chart" to dashboard!'); 311 347 doorstuurData.graphs.push(["graph"+doorstuurData.count+1, 450, 200, graphSelection.graphType, graphSelection.graphData]); 312 348 doorstuurData.count++; 313 349 } 350 //Helper 351 352 function checkBack(url) { 353 if (confirm("Are you sure you want to go back? You will lose your selected data.")) { 354 window.location = url ; 355 } 356 } 357
Note: See TracChangeset
for help on using the changeset viewer.