Ignore:
Timestamp:
02/29/12 16:32:21 (13 years ago)
Author:
cartis
Message:

klaar voor testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/Cartis/Tiles preview/js/classes/graphs.js

    r290 r296  
    1010        var _data;
    1111        var _graphObject;
     12        var _title;
    1213        this._container = document.getElementById(containerName);
    1314       
    14         this.init = function(id, data, type, size) {
     15        this.init = function(id, data, type, size, title) {
    1516            // Draw the graph to the element
    1617            _id = id;
     
    1819            _type = type;
    1920            _size = size;
     21            if (title) _title = title;
    2022
    2123            var canvas = document.createElement("canvas");
     
    2830            switch (_type) {
    2931                case "Pie":
     32                    // Hardcoded data
     33                    // Participant age
     34                    _data = [5,7,9,4];
    3035                    _graphObject = new RGraph.Pie(_id, _data);
     36                    _graphObject.Set('chart.labels', ['20-30 (20 participants)', '30-40 (28 participants)', '40-50 (36 participants)', '50+ (16 participants)']);
     37                    _graphObject.Set('chart.text.color', '#fff');
    3138                    break;
    3239                case "Bar":
     40                    // Hardcoded data
     41                    // Quality of control
     42                    _data = [4,20,50,18,8];
    3343                    _graphObject = new RGraph.Bar(_id, _data);
    34                     _graphObject.Set('chart.labels', ['Jan', 'Piet', 'Shaniqua']);
     44                    _graphObject.Set('chart.labels', ['Bad','Subpar','Average','Above average','Good']);
     45                    _graphObject.Set('chart.text.color', '#fff');
    3546                    break;
    3647                case "Radar":
    37                     _graphObject = new RGraph.Radar(_id, _data);
     48                    //Hardcoded data
     49                    // Gameplay errors
     50                    _data = [24,20,26,35,36,29,25,16];
     51                    _graphObject = new RGraph.Radar(_id, _data);                                 
     52                    _graphObject.Set('chart.labels',['Bram','Paula','Jules','Joel','Tyrone','Henk','Darcy','Frans']);
     53                    _graphObject.Set('chart.text.color', '#000');
     54                    _graphObject.Set('chart.strokestyle','black');
     55
    3856                    break;
    3957                case "Rose":
    4058                    _graphObject = new RGraph.Rose(_id, _data);
     59                    _graphObject.Set('chart.text.color', '#000');
    4160                    break;
    4261            }
    4362           
    4463            // Set standard properties.
    45             _graphObject.Set('chart.text.color', '#fff');
    4664            _graphObject.Set('chart.shadow', false);
    4765            _graphObject.Set('chart.colors', ['rgba(240,240,240,0.5)', 'rgba(240,240,240,0.5)', 'rgba(240,240,240,0.5)']);
    4866            _graphObject.Set('chart.axis.color', 'rgba(240,240,240,0.5)');
    4967            _graphObject.Set('chart.strokestyle', 'rgba(240,240,240,1.0)');
     68            if (title) {
     69                _graphObject.Set('chart.title', title);
     70                _graphObject.Set('chart.title.color', 'white');
     71            }
    5072           
    5173            //enlarge click event
     
    91113            */
    92114            var largeGraph = new Graph("largeContainer");
    93             largeGraph.init("enlarged", _data, _type, [900,550]);
     115            largeGraph.init("enlarged", _data, _type, [900,550], _title);
    94116            var clearDiv = document.createElement("div");
    95117            $(clearDiv).css("float", "left").css("clear", "both");
Note: See TracChangeset for help on using the changeset viewer.