protected override void AddAxisLabel(NGraph.Axis axis, GameObject pLabelGameObject, Vector3 pPosition, float val)
    {
        Text          pLabel         = pLabelGameObject.AddComponent <Text>();
        RectTransform pRectTransform = pLabel.GetComponent <RectTransform>();

        pLabel.font     = AxisLabelDynamicFont;
        pLabel.fontSize = fontSize;
        pLabel.color    = AxisLabelColor;

        if (axis == NGraph.Axis.X)
        {
            pPosition.y     -= 10;
            pLabel.alignment = TextAnchor.MiddleCenter;
        }
        else if (axis == NGraph.Axis.Y)
        {
            pRectTransform.sizeDelta = new Vector2(100, 100);
            pPosition.x     -= 55;
            pLabel.alignment = TextAnchor.MiddleRight;
        }
        pLabel.text = val.ToString();

        pLabelGameObject.transform.localPosition = pPosition;

        if (AxisLabelCallback != null)
        {
            AxisLabelCallback(axis, pLabel, val);
        }
    }
Exemple #2
0
    protected override void AddAxisLabel(NGraph.Axis axis, GameObject pLabelGameObject, Vector3 pPosition, float val)
    {
        UILabel pLabel = pLabelGameObject.AddComponent <UILabel>();

        pLabel.overflowMethod = UILabel.Overflow.ResizeFreely;
        if (AxisLabelDynamicFont != null)
        {
            pLabel.trueTypeFont = AxisLabelDynamicFont;
            pLabel.fontSize     = fontSize;
        }
        else
        {
            pLabel.bitmapFont = AxisLabelBitmapFont;
        }
        pLabel.color = AxisLabelColor;

        if (axis == NGraph.Axis.X)
        {
            pLabel.pivot = UIWidget.Pivot.Top;
        }
        else if (axis == NGraph.Axis.Y)
        {
            pLabel.pivot = UIWidget.Pivot.Right;
        }
        pLabel.text = val.ToString();

        pLabelGameObject.transform.localPosition = pPosition;

        if (AxisLabelCallback != null)
        {
            AxisLabelCallback(axis, pLabel, val);
        }
    }
 protected abstract void AddAxisLabel(NGraph.Axis axis, GameObject pLabelGameObject, Vector3 pPosition, float val);