示例#1
0
 void Start()
 {
     lineChart = GetComponent <GraphChart>();
     if (lineChart != null)
     {
     }
 }
示例#2
0
    void Start()
    {
        Graph = GetComponent <GraphChart>();
        //  GetComponent<HorizontalAxis>().Format
        Graph.DataSource.AddCategory("sa", lineMaterial, lineThickness, lineTiling, innerFill, strechFill, pointMaterial, pointSize);
        if (Graph == null) // the ChartGraph info is obtained via the inspector
        {
            return;
        }
        float x = 3f * TotalPoints;

        Graph.DataSource.StartBatch();              // calling StartBatch allows changing the graph data without redrawing the graph for every change
        Graph.DataSource.ClearCategory("Player 1"); // clear the "Player 1" category. this category is defined using the GraphChart inspector
        //    Graph.DataSource.ClearCategory("P2"); // clear the "Player 2" category. this category is defined using the GraphChart inspector

        // for (int i = 0; i < TotalPoints; i++)  //add random points to the graph
        //  {
        //       Graph.DataSource.AddPointToCategory("sa", System.DateTime.Now - System.TimeSpan.FromSeconds(x), UnityEngine.Random.value * 20f + 10f); // each time we call AddPointToCategory
        //       Graph.DataSource.AddPointToCategory("Player 1", System.DateTime.Now  - System.TimeSpan.FromSeconds(x), UnityEngine.Random.value * 10f); // each time we call AddPointToCategory
        //        x -= UnityEngine.Random.value * 3f;
        //        lastX = x;
        //    }

        for (int i = 0; i < TotalPoints; i++)  //add random points to the graph
        {
            Graph.DataSource.AddCategory(categories[i], lineMaterial, lineThickness, lineTiling, innerFill, strechFill, pointMaterial, pointSize);
        }

        GetComponent <GraphChart>().DataSource.HorizontalViewOrigin = (DateTime.Today - new DateTime(1970, 1, 1)).TotalSeconds + (DateTime.Now - DateTime.Today).TotalSeconds;

        Graph.DataSource.EndBatch(); // finally we call EndBatch , this will cause the GraphChart to redraw itself
    }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        this_imageList = transform.GetComponent<ImageList>();

        mainBG = transform.Find("MainBG_img").gameObject;
        stepTxt = mainBG.transform.GetChild(0).GetComponent<Text>();
        bpmTxt = mainBG.transform.GetChild(1).GetComponent<Text>();
        calTxt = mainBG.transform.GetChild(2).GetComponent<Text>();
        todayTxt = mainBG.transform.GetChild(3).GetComponent<Text>();

        stepBtn = this_imageList.GetButton("Step_btn_img");
        bpmBtn = this_imageList.GetButton("BPM_btn_img");
        calBtn = this_imageList.GetButton("Calories_btn_img");
        arrow = transform.Find("Arrow_img").gameObject;

        posArrow = new Vector3[3];
        for (int i = 0; i < posArrow.Length; i++)
        {
            posArrow[i] = new Vector3(-50, -23 - (i * 91), 0);
        }

        nState = 0;

        barChart = transform.Find("Fit_BarChart").GetComponent<BarChart>();
        graphChart = transform.Find("Fit_Graph").GetComponent<GraphChart>();
        graphMaxChart = transform.Find("Fit_Graph_Max").GetComponent<GraphChart>();
        dayTxt = new Text[7];
        valueTxt = new Text[7];
        valueMaxTxt = new Text[7];
        for (int i = 0; i < dayTxt.Length; i++)
        {
            dayTxt[i] = graphChart.transform.Find("DateList").transform.GetChild(i).GetComponent<Text>();
            valueTxt[i] = graphChart.transform.Find("ValueList").transform.GetChild(i).GetComponent<Text>();
            valueMaxTxt[i] = graphMaxChart.transform.Find("ValueList").transform.GetChild(i).GetComponent<Text>();
        }

        // hover event set
        hoverSize = 63;
        nonSize = 51;
        hoverColor = new Color32(255, 0, 0, 255);
        nonColor = new Color32(255, 255, 255, 255);

        legend_bpm = graphChart.transform.Find("Legend").transform.Find("MinMax").gameObject;

        SetDateTimes();

        todayTxt.text = DateTime.Today.ToString("yyyy. MM. dd");

        // debug
        Main.Instance.Status_Fit.SetDatabase(0, "1740", "62", "69", "1403");
        Main.Instance.Status_Fit.SetDatabase(1, "1642", "0", "0", "131");
        Main.Instance.Status_Fit.SetDatabase(2, "1892", "61", "90", "5995");
        Main.Instance.Status_Fit.SetDatabase(3, "1845", "64", "70", "3266");
        Main.Instance.Status_Fit.SetDatabase(4, "3195", "61", "82", "4443");
        Main.Instance.Status_Fit.SetDatabase(5, "3620", "65", "75", "9602");
        Main.Instance.Status_Fit.SetDatabase(6, "2365", "0", "0", "3173");
    }
 private void switchChart(GraphChart chart)
 {
     //if (chart != currentChart) {
     timeOffset = 0;
     currentGraph.gameObject.SetActive(false);
     chart.gameObject.SetActive(true);
     currentGraph = chart;
     updateData();
     //}
 }
示例#5
0
    // Start is called before the first frame update
    void Start()
    {
        this_imageList = transform.GetComponent <ImageList>();

        mainBG   = transform.Find("MainBG_img").gameObject;
        recordBG = transform.Find("RecordBG_img").gameObject;

        weightTxt = mainBG.transform.GetChild(0).GetComponent <Text>();
        dateTxt   = recordBG.transform.GetChild(0).GetComponent <Text>();
        subTxt    = recordBG.transform.GetChild(1).GetComponent <Text>();

        latestBtn = this_imageList.GetButton("Latest_btn");
        week1Btn  = this_imageList.GetButton("1Week_btn");
        week2Btn  = this_imageList.GetButton("2Week_btn");

        recordBG.SetActive(false);

        nState = 0;

        barChart   = transform.Find("Scale_BarChart").GetComponent <BarChart>();
        graphChart = transform.Find("Scale_Graph").GetComponent <GraphChart>();
        dayTxt     = new Text[7];
        valueTxt   = new Text[7];
        for (int i = 0; i < dayTxt.Length; i++)
        {
            dayTxt[i]   = graphChart.transform.Find("DateList").transform.GetChild(i).GetComponent <Text>();
            valueTxt[i] = graphChart.transform.Find("ValueList").transform.GetChild(i).GetComponent <Text>();
        }

        // hover event set
        hoverSize  = 53;
        nonSize    = 41;
        hoverColor = new Color32(255, 0, 0, 255);
        nonColor   = new Color32(255, 255, 255, 255);

        // debug
        Main.Instance.Status_Scale.SetDatabase(0, "72.6", "07.24 08:32");
        Main.Instance.Status_Scale.SetDatabase(1, "72.6", "07.24 08:32");
        Main.Instance.Status_Scale.SetDatabase(2, "72.6", "07.24 08:32");
        Main.Instance.Status_Scale.SetDatabase(3, "73.5", "07.27 09:24");
        Main.Instance.Status_Scale.SetDatabase(4, "73.8", "07.28 10:39");
        Main.Instance.Status_Scale.SetDatabase(5, "73.8", "07.28 10:39");
        Main.Instance.Status_Scale.SetDatabase(6, "73.8", "07.28 10:39");

        Main.Instance.Status_Scale.SetDatabase(7, "73.4", "07.31 13:40");
        Main.Instance.Status_Scale.SetDatabase(8, "73.4", "07.31 13:40");
        Main.Instance.Status_Scale.SetDatabase(9, "73.4", "07.31 13:40");
        Main.Instance.Status_Scale.SetDatabase(10, "73.4", "07.31 13:40");
        Main.Instance.Status_Scale.SetDatabase(11, "73.4", "07.31 13:40");
        Main.Instance.Status_Scale.SetDatabase(12, "73.4", "07.31 13:40");
        Main.Instance.Status_Scale.SetDatabase(13, "73.4", "07.31 13:40");
    }
示例#6
0
    protected override void Start()
    {
        base.Start();


        if (_Graph == null)
        {
            _Graph = gameObject.GetComponentsInChildren <GraphChart>(true)[0];

            _Graph.HorizontalValueToStringMap.Add(5, "Sec");
            _Graph.VerticalValueToStringMap.Add(5, "A");
        }
    }
示例#7
0
    public void SetGraphResults()
    {
        graph = GetComponent <GraphChart>();
        if (graph != null)
        {
            graph.DataSource.StartBatch(); // start a new update batch


            for (var i = 0; i < results.Count; i++)
            {
                //add 30 random points , each with a category and an x,y value
                graph.DataSource.AddPointToCategory("Period" + " " + i, results[i], 0);
            }

            graph.DataSource.EndBatch(); // end the update batch . this call will render the graph
        }
    }
示例#8
0
    void Start()
    {
        var labels = GetComponent <ItemLabels>();

        if (labels != null)
        {
            fractionDigits = labels.FractionDigits;
        }
        else
        {
            fractionDigits = 2;
        }

        var graph = GetComponent <GraphChart>();

        if (graph != null)
        {
            mChart = graph;
        }
    }
示例#9
0
        /// <summary>
        /// Sets properties of the newly created graph object and
        /// gets references to important scripts of the new object
        /// </summary>
        /// <param name="graphWidget">The corresponding GraphWidget which holds the data</param>
        private void InitGraphObject(GraphWidget graphWidget)
        {
            graph = GetComponentInChildren <GraphChart>();
            if (graph == null)
            {
                // the ChartGraph info is obtained via the inspector
                Debug.LogWarning("No GraphChart found! Place this script into a graph chart!");
                return;
            }

            lineMaterial = new Material(Shader.Find("Chart/Canvas/Solid"));
            graph.DataSource.AddCategory(graphWidget.name, lineMaterial, 20, new MaterialTiling(false, 20), null, true, null, 20);

            graph.AutoScrollHorizontally             = true;
            graph.DataSource.AutomaticHorizontalView = graphWidget.showCompleteHistory;
            if (verticalAxis == null)
            {
                verticalAxis          = graph.GetComponent <VerticalAxis>();
                horizontalAxis        = graph.GetComponent <HorizontalAxis>();
                horizontalAxis.Format = AxisFormat.Time;
            }
            // has to be changed if the graph gets other TextMeshProUGUI scripts
            titleText = GetComponentInChildren <TextMeshProUGUI>();
        }
示例#10
0
 void OnEnable()
 {
     graph = GetComponent <GraphChart>();
 }
 void Start()
 {
     OctoPrintConnector.Instance.NewTemperatureDataRecieved += OctoPrintConnector_OnNewTemperatureDataRecieved;
     Graph = GetComponent <GraphChart>();
 }
示例#12
0
    // Use this for initialization
    void Start()
    {
        this_imageList = transform.GetComponent <ImageList>();

        scoreTxt = transform.Find("ScoreBG_img").transform.Find("Score_txt").GetComponent <Text>();

        weightBG  = transform.Find("WeightBG_img").gameObject;
        weightTxt = weightBG.transform.GetChild(0).GetComponent <Text>();
        smmTxt    = weightBG.transform.GetChild(1).GetComponent <Text>();
        bfmTxt    = weightBG.transform.GetChild(2).GetComponent <Text>();

        fatBG  = transform.Find("FatBG_img").gameObject;
        bmiTxt = fatBG.transform.GetChild(0).GetComponent <Text>();
        pbfTxt = fatBG.transform.GetChild(1).GetComponent <Text>();
        whrTxt = fatBG.transform.GetChild(2).GetComponent <Text>();
        vflTxt = fatBG.transform.GetChild(3).GetComponent <Text>();

        bmrTxt     = transform.Find("BMRBG_img").transform.Find("BMR_txt").GetComponent <Text>();
        renergyTxt = transform.Find("RenergyBG_img").transform.Find("Renergy_txt").GetComponent <Text>();

        RecomandBG = transform.Find("RecommandBG_img").gameObject;
        twTxt      = RecomandBG.transform.GetChild(0).GetComponent <Text>();
        wcTxt      = RecomandBG.transform.GetChild(1).GetComponent <Text>();
        fcTxt      = RecomandBG.transform.GetChild(2).GetComponent <Text>();
        mcTxt      = RecomandBG.transform.GetChild(3).GetComponent <Text>();

        BFM_btn     = this_imageList.GetButton("BFM_btn");
        Mineral_btn = this_imageList.GetButton("Mineral_btn");
        Protein_btn = this_imageList.GetButton("Protein_btn");

        lv_size  = 3;
        img_size = 9;
        lv_Body  = this_imageList.GetButton("Body_lv_btn_img");
        lvTxt    = transform.Find("GraphBG_img").transform.GetChild(0).GetComponent <Text>();

        // 색상에 따라 1 ~ 3 ;; blue(1), green(2), red(3)
        // arr 순서대로 weight, smm, bfm
        lv_body = new int[3];

        lv_Weight = new UIButton[lv_size];
        lv_SMM    = new UIButton[lv_size];
        lv_BFM    = new UIButton[lv_size];
        lv_BMI    = new UIButton[lv_size];
        lv_PBF    = new UIButton[lv_size];
        lv_WHR    = new UIButton[lv_size];
        lv_VFl    = new UIButton[lv_size];
        img_Body  = new UIButton[img_size];

        for (int i = 0; i < lv_size; i++)
        {
            lv_Weight[i] = this_imageList.GetButton(String.Format("Weight_lv{0}_btn_img", i + 1));
            lv_SMM[i]    = this_imageList.GetButton(String.Format("SMM_lv{0}_btn_img", i + 1));
            lv_BFM[i]    = this_imageList.GetButton(String.Format("BFM_lv{0}_btn_img", i + 1));
            lv_BMI[i]    = this_imageList.GetButton(String.Format("BMI_lv{0}_btn_img", i + 1));
            lv_PBF[i]    = this_imageList.GetButton(String.Format("PBF_lv{0}_btn_img", i + 1));
            lv_WHR[i]    = this_imageList.GetButton(String.Format("WHR_lv{0}_btn_img", i + 1));
            lv_VFl[i]    = this_imageList.GetButton(String.Format("VFL_lv{0}_btn_img", i + 1));
        }
        for (int i = 0; i < img_size; i++)
        {
            img_Body[i] = this_imageList.GetButton(String.Format("Body_type{0}_btn_img", i + 1));
        }

        nState = 0;

        barChart   = transform.Find("Inbody_BarChart").GetComponent <BarChart>();
        graphChart = transform.Find("Inbody_Graph").GetComponent <GraphChart>();
        dayTxt     = new Text[5];
        valueTxt   = new Text[5];
        for (int i = 0; i < dayTxt.Length; i++)
        {
            dayTxt[i]   = graphChart.transform.Find("DateList").transform.GetChild(i).GetComponent <Text>();
            valueTxt[i] = graphChart.transform.Find("ValueList").transform.GetChild(i).GetComponent <Text>();
        }

        // user Change btn
        default_btn = this_imageList.GetButton("User#Default_btn");
        male_btn    = this_imageList.GetButton("User#Male_btn");
        female_btn  = this_imageList.GetButton("User#Female_btn");
        child_btn   = this_imageList.GetButton("User#Child_btn");

        // hover event set
        hoverSize  = 63;
        nonSize    = 51;
        hoverColor = new Color32(255, 0, 0, 255);
        nonColor   = new Color32(255, 255, 255, 255);

        // debug
        Main.Instance.Status_Inbody.SetDatabase(0, "31.4", "11.2", "3.78", "17.3", "2020.07.27");
        Main.Instance.Status_Inbody.SetDatabase(1, "28.1", "10.9", "3.66", "17.5", "2020.07.28");
        Main.Instance.Status_Inbody.SetDatabase(2, "27.9", "10.9", "3.77", "18.3", "2020.07.29");
        Main.Instance.Status_Inbody.SetDatabase(3, "26.5", "10.9", "3.76", "17.8", "2020.07.30");
        Main.Instance.Status_Inbody.SetDatabase(4, "21.4", "10.8", "3.65", "17.8", "2020.07.31");
    }
 protected virtual void Start()
 {
     currentGraph = graphByDate;
     started      = true;
     retrieveData();
 }