示例#1
0
    string GetListItem(float newXValue, float newYValue)
    {
        // set significant figures, optional metric unit prefix and formatting in list x and y values
        string xListItem;

        if (xHasMetricFormat)
        {
            xListItem = MathScientific.ToMetric(newXValue, xValueFormat, listNumSigFigs.x);
        }
        else
        {
            xListItem = MathScientific.ToFormattedValue(newXValue, xValueFormat, listNumSigFigs.x);
        }

        string yListItem;

        if (yHasMetricFormat)
        {
            yListItem = MathScientific.ToMetric(newYValue, yValueFormat, listNumSigFigs.y);
        }
        else
        {
            yListItem = MathScientific.ToFormattedValue(newYValue, yValueFormat, listNumSigFigs.y);
        }

        return("X: " + xListItem + ",\n\t Y: " + yListItem);
    }
 // takes a label value, and related varaibles, and returns it formatted to fit the axis formatting
 public string FormatLabel(float value, string valueFormat, int sigFigs)
 {
     if (unitIsMetric)
     {
         return(MathScientific.ToMetric(value, valueFormat, BaseSigFigs + sigFigs, customThsdPow: ThsdPow));
     }
     return(MathScientific.ToFormattedValue(value, valueFormat, BaseSigFigs + sigFigs));
 }
示例#3
0
    ///<summary>Adds a new value to the Tab, including Graph, Ticker List and dataValues.</summary>
    ///<param name = "newValue">The value to be added to the graph (displayed on y-axis)</param>
    public void AddSingleValue(float newValue)
    {
        dataValues.Add(newValue);
        graphScript.AddPoint(newValue);
        // set decimals in list value
        string newListItem;

        if (yHasMetricFormat)
        {
            newListItem = MathScientific.ToMetric(newValue, valueFormat, listNumSigFigs);
        }
        else
        {
            newListItem = MathScientific.ToFormattedValue(newValue, valueFormat, listNumSigFigs);
        }
        tickerList.GetComponent <ListController> ().AddListDataItem(newListItem);
    }