Exemple #1
0
    public void Visualize()
    {
        listToVisualize = parser.ExtractValues(mode);
        interval        = 16 / listToVisualize.Count;

        if (interval <= 0.03f)
        {
            interval = 0.03f;
        }

        xLen = listToVisualize.Count * (float)interval - 250 * (float)interval;

        dotDrawer.width = xLen;

        axis.SetPosition(2, new Vector3(xLen, -3, 0));


        minVal = listToVisualize.Min();
        maxVal = listToVisualize.Max();
        avg    = listToVisualize.Average();

        infoText.text = string.Format("Min: {0} | Max: {1} | Average: {2}", minVal, maxVal, avg);

        middle       = (maxVal + minVal) / 2;
        maxDiff      = maxVal - middle;
        heightPerVal = 2.5f / maxDiff;

        Debug.Log("MId " + middle);
        Debug.Log("maxDiff " + maxDiff);
        Debug.Log("Max " + maxVal + " Min " + minVal);

        List <Vector3> pointsList = GraphPoints();

        lineRenderer.positionCount = pointsList.Count;
        lineRenderer.SetPositions(pointsList.ToArray());
        lineRenderer.Simplify(SimplifyTolerance);
    }