Example #1
0
    // 1.
    void display0()
    {
        ClearAllChange();
        string[] xTimes  = new string[] { "Jan. 2021", "Feb. 2021", "Mar. 2021", "Apr. 2021", "May 2021" };
        string[] xSpaces = new string[] { "ESTIA1", "ESTIA2", "ESTIA3", "ESTIA4", "ESTIA5", "ESTIA6" };

        sbyte[] yData       = new sbyte[] { 12, 18, 25, 10, 20 };
        string  xAxisLegend = "<size=7><line-height=60>";

        for (int i = 0; i < xTimes.Length; i++)
        {
            xAxisLegend += xTimes[i] + "\n";
        }
        string yAxisLegend = "<size=7>";

        for (int i = 0; i < xSpaces.Length; i++)
        {
            yAxisLegend += xSpaces[i] + "<space=38>";
        }

        for (int i = 0; i < expanDialSticks.NbRows; i++)
        {
            for (int j = 0; j < expanDialSticks.NbColumns; j++)
            {
                int   datum = UnityEngine.Random.Range(0, 40);
                float coeff = datum / 40f;
                expanDialSticks[i, j].TargetText  = "<b>" + datum + " MWh</b>";
                expanDialSticks[i, j].TargetColor = new Color(1f - coeff, 1f - coeff, 1f);
                expanDialSticks[i, j].TargetTextureChangeDuration = 1f;

                expanDialSticks[i, j].TargetPosition            = (sbyte)datum;
                expanDialSticks[i, j].TargetShapeChangeDuration = 1f;
            }
        }
        expanDialSticks.triggerTextureChange();
        expanDialSticks.triggerShapeChange();

        /*string legend = "<line-height=1em><voffset=-8><size=32><color=\"green\">•</voffset><size=8><color=\"black\">energy production\n"
         + "<voffset=-8><size=32><color=\"orange\">•</voffset><size=8><color=\"black\">energy storage\n"
         + "<voffset=-8><size=32><color=\"blue\">•</voffset><size=8><color=\"black\">energy consumption\n";*/

        /*string labels = "<size=7><pos=3%>Past month <pos=85%>Next month\n";
         * string direction = "<line-height=10><size=9>◄────────────────────────────────────────────►\n";
         * string titles = "<b><line-height=10><size=10><pos=0%>Data Type<pos=30%>Mode<pos=50%>Time Scale<pos=75%>Space Scale</b>\n";
         * string firstOption = "<line-height=7><size=7><pos=0%><color=#0000FFFF>■ <color=#000000FF>Energy Consumption<pos=30%><alpha=#FF>Time<pos=50%><alpha=#AA>Hours<pos=75%><alpha=#AA>Devices\n";
         * string secondOption = "<line-height=7><size=7><pos=0%><color=#FF9900AA>■ <color=#000000AA>Energy Storage<pos=30%><alpha=#AA>Space<pos=50%><alpha=#AA>Days<pos=75%><alpha=#AA>Rooms\n";
         * string thirdOption = "<line-height=7><size=7><pos=0%><color=#00FF00AA>■ <color=#000000AA>Energy Production<pos=50%><alpha=#FF>Months<pos=75%><alpha=#FF>Buildings ► ESTIA1\n";
         * string legend = labels + direction + titles +  firstOption + secondOption + thirdOption;*/
        expanDialSticks.setLeftBorderText(TextAlignmentOptions.Center, 16, Color.black, xAxisLegend, new Vector3(90f, -90f, 0f));
        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 8, Color.black, yAxisLegend, new Vector3(90f, -90f, 0f));
        //expanDialSticks.setRightBorderText(TextAlignmentOptions.Center, 16, Color.black, legend, new Vector3(90f, 90f, 0f));
    }
Example #2
0
    public void LegendFromLabels()
    {
        string xLegendFirst  = "<line-height=6><size=4>";
        string xLegendSecond = "<line-height=8><size=6>";
        string xLegendThird  = "<line-height=10><size=8>";

        for (int i = 0; i < dataSet.xLabels.Length; i++)
        {
            string   xLabel    = dataSet.xLabels[i];
            string[] subLabels = xLabel.Split('\n');
            int      pos       = (int)((i / (float)dataSet.xLabels.Length) * 100f);
            switch (subLabels.Length)
            {
            case 1:
                xLegendThird += "<pos=" + pos + "%>" + subLabels[0];
                break;

            case 2:
                xLegendThird  += "<pos=" + pos + "%>" + subLabels[1];
                xLegendSecond += "<pos=" + pos + "%>" + subLabels[0];
                break;

            case 3:
                xLegendThird  += "<pos=" + pos + "%>" + subLabels[2];
                xLegendSecond += "<pos=" + pos + "%>" + subLabels[1];
                xLegendFirst  += "<pos=" + pos + "%>" + subLabels[0];
                break;

            default:
                xLegendThird += "<pos=" + pos + "%>" + subLabels[0];
                break;
            }
        }
        string xLegend = "";

        if (xLegendFirst != "<line-height=6><size=4>")
        {
            xLegend += xLegendFirst + "\n";
        }
        if (xLegendSecond != "<line-height=8><size=6>")
        {
            xLegend += xLegendSecond + "\n";
        }
        if (xLegendThird != "<line-height=10><size=8>")
        {
            xLegend += xLegendThird + "\n";
        }


        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 16, Color.black, xLegend, new Vector3(90f, -90f, 0f));

        string yLegend = "";

        for (int i = 0; i < dataSet.yLabels.Length; i++)
        {
            string   yLabel    = dataSet.yLabels[i];
            string[] subLabels = yLabel.Split('\n');
            switch (subLabels.Length)
            {
            case 1:
                yLegend += "<line-height=10><size=8>" + subLabels[0] + "<line-height=60>\n";
                break;

            case 2:
                yLegend += "<line-height=8><size=6>" + subLabels[0] + "\n";
                yLegend += "<line-height=10><size=8>" + subLabels[1] + "\n";
                yLegend += "<line-height=42>\n";
                break;

            case 3:
                yLegend += "<line-height=6><size=4>" + subLabels[0] + "\n";
                yLegend += "<line-height=8><size=6>" + subLabels[1] + "\n";
                yLegend += "<line-height=10><size=8>" + subLabels[2] + "\n";
                yLegend += "<line-height=36>\n";
                break;

            default:
                yLegend += "<line-height=10>" + subLabels[0] + "<line-height=60>\n";
                break;
            }
        }
        expanDialSticks.setLeftBorderText(TextAlignmentOptions.Center, 16, Color.black, yLegend, new Vector3(90f, -90f, 0f));
    }
    // Rover Control

    void displayRoverControlStart()
    {
        ClearAllChange();
        // Pitch/Roll/Yaw/Throlle/On/Pull/push
        // Button on/off
        expanDialSticks[4, 5].TargetText     = "Start";
        expanDialSticks[4, 5].TargetColor    = new Color(0f, 1f, 0f);
        expanDialSticks[4, 5].TargetTextSize = 2f;
        expanDialSticks[4, 5].TargetTextureChangeDuration = 1f;
        expanDialSticks[4, 5].TargetPosition            = 5;
        expanDialSticks[4, 5].TargetShapeChangeDuration = 1f;
        expanDialSticks.triggerTextureChange();
        expanDialSticks.triggerShapeChange();
        string legend = "Starting the rover with a button.";

        expanDialSticks.setLeftBorderText(TextAlignmentOptions.Center, LEGEND_SIZE, Color.black, legend, new Vector3(90f, 0f, 0f));
        expanDialSticks.setRightBorderText(TextAlignmentOptions.Center, LEGEND_SIZE, Color.black, legend, new Vector3(90f, 180f, 0f));
    }