if( typeof html5jp == 'undefined' ) { html5jp = new Object(); } if( typeof html5jp.graph == 'undefined' ) { html5jp.graph = new Object(); } html5jp.graph.radar = function (id) { var elm = document.getElementById(id); if(! elm) { return; } if(elm.nodeName != "CANVAS") { return; } if(elm.parentNode.nodeName != "DIV") { return; }; this.canvas = elm; if ( ! this.canvas ){ return; } if ( ! this.canvas.getContext ){ return; } this.ctx = this.canvas.getContext('2d'); this.canvas.style.margin = "0"; this.canvas.parentNode.style.position = "relative"; this.canvas.parentNode.style.padding = "0"; }; html5jp.graph.radar.prototype.draw = function(items, inparams) { if( ! this.ctx ) {return;} var params = { aCap: [], aCapColor: "#000000", aCapFontSize: "12px", aCapFontFamily: "Arial,sans-serif", aMax: null, aMin: 0, backgroundColor: "#ffffff", cBackgroundColor: "#eeeeee", cBackgroundGradation: true, chartShape: "polygon", faceColors: null, _faceColors: ["rgb(24,41,206)", "rgb(198,0,148)", "rgb(214,0,0)", "rgb(255,156,0)", "rgb(33,156,0)", "rgb(33,41,107)", "rgb(115,0,90)", "rgb(132,0,0)", "rgb(165,99,0)", "rgb(24,123,0)"], faceAlpha: 0.1, borderAlpha: 0.5, borderWidth: 1, axisColor: "#aaaaaa", axisWidth: 1, aLinePositions: "auto", aLineWidth: 1, aLineColor: "#cccccc", sLabel: true, sLabelColor: "#000000", sLabelFontSize: "10px", sLabelFontFamily: "Arial,sans-serif", legend: true, legendFontSize: "12px", legendFontFamily: "Arial,sans-serif", legendColor: "#000000" }; if( inparams && typeof(inparams) == 'object' ) { for( var key in inparams ) { if( key.match(/^_/) ) { continue; } params[key] = inparams[key]; } } if( params.faceColors != null && params.faceColors.length > 0 ) { for( var i=0; i 10) { item_num = 10; } params.itemNum = item_num; var angle_num = 0; for(var i=0; i 24) { angle_num = 24; } params.angleNum = angle_num; var axis_angles = [Math.PI/2]; for(var i=1; i= max_v) { max_v = v; } if(min_v == null) { min_v = v; } else if(v <= min_v) { min_v = v; } } if(n - 1 >= max_n) { max_n = n - 1; } } if( typeof(params.aMin) != "number" ) { params.aMin = 0; } if( typeof(params.aMax) != "number" ) { params.aMax = max_v; } if( typeof(params.aLinePositions) == "string" && params.aLinePositions == "auto" ) { params.aLinePositions = this._aline_positions_auto_calc(params.aMin, params.aMax); } this._draw_aline(params, cpos, axis_angles); this._draw_axis(params, cpos, axis_angles); this._draw_scale_label(params, cpos); for(var i=0; i 5 ) { unit = unit * 2; } else if( unum <= 2 ) { unit = unit * 3 / 10 } var i = 1; while(min+unit*i<=max) { array.push(min+unit*i); i++; } for(var i=0; i params.angleNum) { n = params.angleNum; } for(var i=0; i this.canvas.width * 0.98 ) { x = this.canvas.width * 0.98 - s.w; } if( y < this.canvas.height * 0.02 ) { y = this.canvas.height * 0.02; } if( y + s.h > this.canvas.height * 0.98 ) { y = this.canvas.height * 0.98 - s.h; } x = Math.round(x); y = Math.round(y); this._drawText(x, y, text, params.aCapFontSize, params.aCapFontFamily, params.aCapColor); } }; html5jp.graph.radar.prototype._draw_scale_label = function(params, cpos) { if( params.sLabel != true) { return; } if( typeof(params.aLinePositions) != "object" || params.aLinePositions.length < 1 ) { return; } for(var i=0; i