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
Added label output
Removed inline style and turned graph upside down
Line 3: Line 3:
    
    
   var oldX = 0;
   var oldX = 0;
   var oldY = (max-min) == 0 ? 0 : (300 / (max-min)) * (val - min);
   var oldY = (max-min) == 0 ? 0 : -(300 / (max-min)) * (val - min);
    
    
   if (degree == 0) {
   if (degree == 0) {
Line 35: Line 35:
   svg.setAttribute('preserveAspectRatio', "none");
   svg.setAttribute('preserveAspectRatio', "none");
   svg.setAttribute('version', "1.1");
   svg.setAttribute('version', "1.1");
 
  /* Inline styling; maybe export to common.css? */
  var style = document.createElementNS(svgNS, 'style');
  style.setAttribute('type', "text/css");
  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);
  svg.appendChild(style);
    
    
   /* This pretty much defines the base net lines */
   /* This pretty much defines the base net lines */
Line 54: Line 47:
   var radialLine = document.createElementNS(svgNS, 'line');
   var radialLine = document.createElementNS(svgNS, 'line');
   radialLine.setAttribute('class', 'radial');
   radialLine.setAttribute('class', 'radial');
   radialLine.setAttribute('y2', 325);
   radialLine.setAttribute('y2', -325);
   wedge.appendChild(radialLine);
   wedge.appendChild(radialLine);
    
    
   for (var lineIdx=1;lineIdx<5;lineIdx++) {
   for (var lineIdx=1;lineIdx<5;lineIdx++) {
     var orientationLine = document.createElementNS(svgNS, 'line');
     var orientationLine = document.createElementNS(svgNS, 'line');
     var lineDistance = lineIdx * 75;
     var lineDistance = lineIdx * -75;
     var rotate = (degreeSpacing * Math.PI) / 180;
     var rotate = (degreeSpacing * Math.PI) / 180;
     orientationLine.setAttribute('y1', lineDistance);
     orientationLine.setAttribute('y1', lineDistance);
Line 95: Line 88:
       var label = document.createElementNS(svgNS, 'text');
       var label = document.createElementNS(svgNS, 'text');
       var rotate = (-degreeSpacing * labelIdx * Math.PI) / 180;
       var rotate = (-degreeSpacing * labelIdx * Math.PI) / 180;
       label.setAttribute('x', 340*Math.sin(rotate));
       label.setAttribute('x', -340*Math.sin(rotate));
       label.setAttribute('y', 340*Math.cos(rotate));
       label.setAttribute('y', -340*Math.cos(rotate));
       label.appendChild(document.createTextNode(polygonParams.data[labelIdx].label));
       label.appendChild(document.createTextNode(polygonParams.data[labelIdx].label));
       gDrawing.appendChild(label);
       gDrawing.appendChild(label);

Revision as of 13:28, 2 October 2019