var RadarChart = { draw: function(id, d, options){ var cfg = { radius: 5, w: 600, h: 600, factor: 1, factorLegend: .85, levels: 3, maxValue: 0, radians: 2 * Math.PI, opacityArea: 0.5, ToRight: 5, TranslateX: 80, TranslateY: 30, ExtraWidthX: 100, ExtraWidthY: 100, color: d3.scaleOrdinal().range(["#6F257F", "#CA0D59"]) }; if('undefined' !== typeof options){ for(var i in options){ if('undefined' !== typeof options[i]){ cfg[i] = options[i]; } } } cfg.maxValue = 100; var allAxis = (d[0].map(function(i, j){return i.area})); var total = allAxis.length; var radius = cfg.factor*Math.min(cfg.w/2, cfg.h/2); var Format = d3.format('%'); d3.select(id).select("svg").remove(); var g = d3.select(id) .append("svg") .attr("width", cfg.w+cfg.ExtraWidthX) .attr("height", cfg.h+cfg.ExtraWidthY) .append("g") .attr("transform", "translate(" + cfg.TranslateX + "," + cfg.TranslateY + ")"); var tooltip; //Circular segments for(var j=0; j" + (d.value) + ""); }) .on("mouseout", function(d){ tooltip.style("display", "none");}); series++; }); } };