private string defaultTooltipLabeler(WMG_Series aSeries, WMG_Node aNode)
    {
        // Find out the point value data for this node
        Vector2 nodeData     = aSeries.getNodeValue(aNode);
        float   numberToMult = Mathf.Pow(10f, aSeries.theGraph.tooltipNumberDecimals);
        string  nodeX        = (Mathf.Round(nodeData.x * numberToMult) / numberToMult).ToString();
        string  nodeY        = (Mathf.Round(nodeData.y * numberToMult) / numberToMult).ToString();

        // Determine the tooltip text to display
        string textToSet;

        if (aSeries.seriesIsLine)
        {
            textToSet = "(" + nodeX + ", " + nodeY + ")";
        }
        else
        {
            textToSet = nodeY;
        }
        if (aSeries.theGraph.tooltipDisplaySeriesName)
        {
            textToSet = aSeries.seriesName + ": " + textToSet;
        }
        return(textToSet);
    }
Exemple #2
0
    string customTooltipLabeler(WMG_Series aSeries, WMG_Node aNode)
    {
        Vector2 nodeData = aSeries.getNodeValue(aNode);

        tooltipNumberFormatInfo.CurrencyDecimalDigits = aSeries.theGraph.tooltipNumberDecimals;
        string textToSet = nodeData.y.ToString("C", tooltipNumberFormatInfo);

        if (aSeries.theGraph.tooltipDisplaySeriesName)
        {
            textToSet = aSeries.seriesName + ": " + textToSet;
        }
        return(textToSet);
    }
Exemple #3
0
    void updateIndicator()
    {
        if (series1.getPoints().Count == 0)
        {
            return;
        }
        WMG_Node lastPoint = series1.getLastPoint().GetComponent <WMG_Node>();

        graph.changeSpritePositionToY(indicatorGO, lastPoint.transform.localPosition.y);
        Vector2 nodeData = series1.getNodeValue(lastPoint);
        //indicatorLabelNumberFormatInfo.CurrencyDecimalDigits = indicatorNumDecimals;
        string textToSet = nodeData.y.ToString();

        graph.changeLabelText(indicatorGO.transform.GetChild(0).GetChild(0).gameObject, textToSet);
    }
    private string defaultTooltipLabeler(WMG_Series aSeries, WMG_Node aNode)
    {
        // Find out the point value data for this node
        Vector2 nodeData = aSeries.getNodeValue(aNode);
        float numberToMult = Mathf.Pow(10f, aSeries.theGraph.tooltipNumberDecimals);
        string nodeX = (Mathf.Round(nodeData.x*numberToMult)/numberToMult).ToString();
        string nodeY = (Mathf.Round(nodeData.y*numberToMult)/numberToMult).ToString();

        // Determine the tooltip text to display
        string textToSet;
        if (aSeries.seriesIsLine) {
            textToSet = "(" + nodeX + ", " + nodeY + ")";
        }
        else {
            textToSet = nodeY;
        }
        if (aSeries.theGraph.tooltipDisplaySeriesName) {
            textToSet = aSeries.seriesName + ": " + textToSet;
        }
        return textToSet;
    }
    private void TooltipNodeMouseEnter(WMG_Series aSeries, WMG_Node aNode, bool state)
    {
        if (isTooltipObjectNull())
        {
            return;
        }
        if (state)
        {
            // Find out what point value data is for this node
            Vector2 nodeData     = aSeries.getNodeValue(aNode);
            float   numberToMult = Mathf.Pow(10f, theGraph.tooltipNumberDecimals);
            string  nodeX        = (Mathf.Round(nodeData.x * numberToMult) / numberToMult).ToString();
            string  nodeY        = (Mathf.Round(nodeData.y * numberToMult) / numberToMult).ToString();

            // Determine the tooltip to display and set the text
            string textToSet;
            if (theGraph.graphType != WMG_Axis_Graph.graphTypes.line)
            {
                textToSet = nodeY;
            }
            else
            {
                textToSet = "(" + nodeX + ", " + nodeY + ")";
            }
            if (theGraph.tooltipDisplaySeriesName)
            {
                textToSet = aSeries.seriesName + ": " + textToSet;
            }
            changeLabelText(theGraph.toolTipLabel, textToSet);

            // Resize this control to match the size of the contents
            changeSpriteWidth(theGraph.toolTipPanel, Mathf.RoundToInt(getSpriteWidth(theGraph.toolTipLabel)) + 24);

            // Ensure tooltip is in position before showing it so it doesn't appear to jump
            repositionTooltip();

            // Display the base panel
            showControl(theGraph.toolTipPanel);
            bringSpriteToFront(theGraph.toolTipPanel);

            Vector3 newVec = new Vector3(2, 2, 1);
            if (theGraph.graphType != WMG_Axis_Graph.graphTypes.line)
            {
                if (theGraph.orientationType == WMG_Axis_Graph.orientationTypes.vertical)
                {
                    newVec = new Vector3(1, 1.1f, 1);
                }
                else
                {
                    newVec = new Vector3(1.1f, 1, 1);
                }
            }

            performTooltipAnimation(aNode.transform, newVec);
        }
        else
        {
            hideControl(theGraph.toolTipPanel);
            sendSpriteToBack(theGraph.toolTipPanel);

            performTooltipAnimation(aNode.transform, new Vector3(1, 1, 1));
        }
    }
	string customTooltipLabeler(WMG_Series aSeries, WMG_Node aNode) {
		Vector2 nodeData = aSeries.getNodeValue(aNode);
		tooltipNumberFormatInfo.CurrencyDecimalDigits = aSeries.theGraph.tooltipNumberDecimals;
		string textToSet = nodeData.y.ToString("C", tooltipNumberFormatInfo);
		if (aSeries.theGraph.tooltipDisplaySeriesName) {
			textToSet = aSeries.seriesName + ": " + textToSet;
		}
		return textToSet;
	}
    private void TooltipNodeMouseEnter(WMG_Series aSeries, WMG_Node aNode, bool state)
    {
        if (isTooltipObjectNull()) return;
        if (state) {
            // Find out what point value data is for this node
            Vector2 nodeData = aSeries.getNodeValue(aNode);
            float numberToMult = Mathf.Pow(10f, theGraph.tooltipNumberDecimals);
            string nodeX = (Mathf.Round(nodeData.x*numberToMult)/numberToMult).ToString();
            string nodeY = (Mathf.Round(nodeData.y*numberToMult)/numberToMult).ToString();

            // Determine the tooltip to display and set the text
            string textToSet;
            if (theGraph.graphType != WMG_Axis_Graph.graphTypes.line) {
                textToSet = nodeY;
            }
            else {
                textToSet = "(" + nodeX + ", " + nodeY + ")";
            }
            if (theGraph.tooltipDisplaySeriesName) {
                textToSet = aSeries.seriesName + ": " + textToSet;
            }
            changeLabelText(theGraph.toolTipLabel, textToSet);

            // Resize this control to match the size of the contents
            changeSpriteWidth(theGraph.toolTipPanel, Mathf.RoundToInt(getSpriteWidth(theGraph.toolTipLabel)) + 24);

            // Ensure tooltip is in position before showing it so it doesn't appear to jump
            repositionTooltip();

            // Display the base panel
            showControl(theGraph.toolTipPanel);
            bringSpriteToFront(theGraph.toolTipPanel);

            Vector3 newVec = new Vector3(2,2,1);
            if (theGraph.graphType != WMG_Axis_Graph.graphTypes.line) {
                if (theGraph.orientationType == WMG_Axis_Graph.orientationTypes.vertical) {
                    newVec = new Vector3(1,1.1f,1);
                }
                else {
                    newVec = new Vector3(1.1f,1,1);
                }
            }

            performTooltipAnimation(aNode.transform, newVec);
        }
        else {
            hideControl(theGraph.toolTipPanel);
            sendSpriteToBack(theGraph.toolTipPanel);

            performTooltipAnimation(aNode.transform, new Vector3(1,1,1));
        }
    }