Esempio n. 1
0
 void updateGrids()
 {
     for (int i = 0; i < numGrids; i++)
     {
         if (grids.Count <= i)
         {
             WMG_Series aGrid = addSeriesAt(i);
             aGrid.connectFirstToLast = true;
             aGrid.hidePoints         = true;
             grids.Add(aGrid);
         }
     }
     for (int i = grids.Count - 1; i >= 0; i--)
     {
         if (grids[i] != null && i >= numGrids)
         {
             deleteSeriesAt(i);
             grids.RemoveAt(i);
         }
     }
     for (int i = 0; i < numGrids; i++)
     {
         WMG_Series aGrid = lineSeries[i].GetComponent <WMG_Series>();
         aGrid.pointValues.SetList(WMG_Util.GenCircular(numPoints, offset.x, offset.y, (i + 1f) / numGrids * (radarMaxVal - radarMinVal), degreeOffset));
         aGrid.lineScale   = gridLineWidth;
         aGrid.linePadding = gridLineWidth;
         aGrid.lineColor   = gridColor;
     }
 }
    void updateGrids()
    {
        // create or delete grids
        for (int i = 0; i < numGrids; i++)
        {
            if (grids.Count <= i)
            {
                WMG_Series aGrid = addSeriesAt(i);
                aGrid.hidePoints = true;
                grids.Add(aGrid);
            }
        }
        for (int i = grids.Count - 1; i >= 0; i--)
        {
            if (grids[i] != null && i >= numGrids)
            {
                deleteSeriesAt(i);
                grids.RemoveAt(i);
            }
        }
        // update grid data
        List <Vector2> alternateGridTypeOuterPoints = new List <Vector2>();

        if (alternateGridType)
        {
            alternateGridTypeOuterPoints = WMG_Util.GenCircular(numPoints, offset.x, offset.y, (radarMaxVal - radarMinVal), degreeOffset);
        }
        for (int i = 0; i < numGrids; i++)
        {
            WMG_Series aGrid = lineSeries[i].GetComponent <WMG_Series>();
            aGrid.connectFirstToLast = alternateGridType ? false : true;
            if (alternateGridType)
            {
                List <Vector2> gridPoints = new List <Vector2> ();
                gridPoints.Add(new Vector2(offset.x, offset.y));
                gridPoints.Add(alternateGridTypeOuterPoints [i]);
                aGrid.pointValues.SetList(gridPoints);
            }
            else
            {
                aGrid.pointValues.SetList(WMG_Util.GenCircular(numPoints, offset.x, offset.y, (i + 1f) / numGrids * (radarMaxVal - radarMinVal), degreeOffset));
            }
            aGrid.lineScale   = gridLineWidth;
            aGrid.linePadding = gridLineWidth;
            aGrid.lineColor   = gridColor;
        }
    }
Esempio n. 3
0
    void updateLabels()
    {
        if (!createdLabels)
        {
            WMG_Series labels = addSeriesAt(numDataSeries + numGrids);
            labels.hideLines   = true;
            createdLabels      = true;
            labels.pointPrefab = 3;
            radarLabels        = labels;
        }

        for (int i = 0; i < numPoints; i++)
        {
            if (labelStrings.Count <= i)
            {
                labelStrings.AddNoCb("", ref _labelStrings);
            }
        }
        for (int i = labelStrings.Count - 1; i >= 0; i--)
        {
            if (labelStrings[i] != null && i >= numPoints)
            {
                labelStrings.RemoveAtNoCb(i, ref _labelStrings);
            }
        }

        radarLabels.hidePoints = hideLabels;
        radarLabels.pointValues.SetList(WMG_Util.GenCircular(numPoints, offset.x, offset.y, labelsOffset + (radarMaxVal - radarMinVal), degreeOffset));
        List <GameObject> labelGOs = radarLabels.getPoints();

        for (int i = 0; i < labelGOs.Count; i++)
        {
            if (i >= numPoints)
            {
                break;
            }
            changeLabelFontSize(labelGOs[i], fontSize);
            changeLabelText(labelGOs[i], labelStrings[i]);
        }
        radarLabels.pointColor = labelsColor;
    }