Welcome to IOPWiki, Commander.
With the release of the new game, we encourage contributions to topics related to Girls' Frontline 2. Learn how to contribute, read the maintenance guide, and join our Discord server to discuss major changes.
If you or someone you know can help deciphering the game files, contact our administrator.

Widget:StatsGraph: Difference between revisions

Welcome to IOP Wiki. This website is maintained by the Girls' Frontline community and is free to edit by anyone.
Jump to navigation Jump to search
Removed logging
Dynamically creating orientation lines
Line 39: Line 39:
   var style = document.createElementNS(svgNS, 'style');
   var style = document.createElementNS(svgNS, 'style');
   style.setAttribute('type', "text/css");
   style.setAttribute('type', "text/css");
   var styleData = document.createTextNode('line.radial {stroke: #333;stroke-width: 4pt;}polygon {stroke-width: 4pt;}svg {fill: none;stroke: #777;stroke-opacity: 1;stroke-width: 1pt;}text {fill: #000;font-family: Arial, Helvetica, sans-serif;font-size: 2.5em;font-weight: normal;stroke: none;text-anchor: middle;}.unit { stroke: #f73; }');
   var styleData = document.createTextNode('line.emphased {stroke-width:3pt} line.radial {stroke: #333;stroke-width: 4pt;}polygon {stroke-width: 4pt;}svg {fill: none;stroke: #777;stroke-opacity: 1;stroke-width: 1pt;}text {fill: #000;font-family: Arial, Helvetica, sans-serif;font-size: 2.5em;font-weight: normal;stroke: none;text-anchor: middle;}.unit { stroke: #f73; }');
   style.appendChild(styleData);
   style.appendChild(styleData);
   svg.appendChild(style);
   svg.appendChild(style);
Line 48: Line 48:
   var wedge = document.createElementNS(svgNS, 'g');
   var wedge = document.createElementNS(svgNS, 'g');
   wedge.setAttribute('id', "wedge" + graphId);
   wedge.setAttribute('id', "wedge" + graphId);
 
  var directionCount = dataComplete[0].data.length;
  var degreeSpacing = 360 / directionCount;
    
    
   var radialLine = document.createElementNS(svgNS, 'line');
   var radialLine = document.createElementNS(svgNS, 'line');
Line 53: Line 56:
   radialLine.setAttribute('y2', 325);
   radialLine.setAttribute('y2', 325);
   wedge.appendChild(radialLine);
   wedge.appendChild(radialLine);
   radialLine = document.createElementNS(svgNS, 'line');
    
   radialLine.setAttribute('y1', -75);
   for (int lineIdx=1;lineY<5;lineIdx++) {
  radialLine.setAttribute('x2', -64.95);
    var orientationLine = document.createElementNS(svgNS, 'line');
  radialLine.setAttribute('y2', -37.5);
    var lineDistance = lineIdx * -75;
  wedge.appendChild(radialLine);
    var rotate = (-degreeSpacing * Math.PI) / 180;
  radialLine = document.createElementNS(svgNS, 'line');
    orientationLine.setAttribute('y1', lineDistance);
  radialLine.setAttribute('y1', -150);
    orientationLine.setAttribute('x2', lineDistance*Math.sin(rotate));
  radialLine.setAttribute('x2', -129.9);
    orientationLine.setAttribute('y2', lineDistance*Math.cos(rotate));
  radialLine.setAttribute('y2', -75);
    if (lineIdx % 2 == 0) {
  radialLine.setAttribute('stroke-width', "3pt");
      orientationLine.setAttribute('class', 'emphased');
  wedge.appendChild(radialLine);
    }
  radialLine = document.createElementNS(svgNS, 'line');
    wedge.appendChild(orientationLine);
  radialLine.setAttribute('y1', -225);
  }
  radialLine.setAttribute('x2', -194.86);
  radialLine.setAttribute('y2', -112.5);
  wedge.appendChild(radialLine);
  radialLine = document.createElementNS(svgNS, 'line');
  radialLine.setAttribute('y1', -300);
  radialLine.setAttribute('x2', -259.81);
  radialLine.setAttribute('y2', -150);
  radialLine.setAttribute('stroke-width', "3pt");
  wedge.appendChild(radialLine);
   defs.appendChild(wedge);
   defs.appendChild(wedge);
   svg.appendChild(defs);
   svg.appendChild(defs);
Line 82: Line 76:
   gDrawing.setAttribute('transform', 'translate(400 400)');
   gDrawing.setAttribute('transform', 'translate(400 400)');
    
    
  var directionCount = dataComplete[0].data.length;
  var degreeSpacing = 360 / directionCount;
   for (var dataIdx=0; dataIdx<directionCount; dataIdx++) {
   for (var dataIdx=0; dataIdx<directionCount; dataIdx++) {
     var propertyLine = document.createElementNS(svgNS, 'use');
     var propertyLine = document.createElementNS(svgNS, 'use');

Revision as of 12:40, 2 October 2019