void Start()
    {
        GameObject graphGO = GameObject.Instantiate(graphPrefab) as GameObject;

        graph = graphGO.GetComponent <WMG_Axis_Graph>();
        graph.changeSpriteParent(graphGO, this.gameObject);
        graph.changeSpritePositionTo(graphGO, Vector3.zero);
        graph.graphTitleOffset       = new Vector2(0, 60);
        graph.autoAnimationsDuration = testInterval - 0.1f;

        newSeries = new List <Vector2>();
        counter   = 0;

        waitTime     = new WaitForSeconds(testInterval);
        animDuration = testInterval - 0.1f;         // have animations slightly faster than the test interval
        if (animDuration < 0)
        {
            animDuration = 0;
        }

        WMG_Data_Source dataSource = graph.lineSeries[0].GetComponent <WMG_Series>().pointValuesDataSource;

        if (dataSource != null)
        {
            dataSource.setDataProvider(dataProvider);
        }

        if (performTests)
        {
            StartCoroutine(startTests());
        }
        //gameObject.
    }
Beispiel #2
0
    IEnumerator realTimePlot()
    {
        ds1 = graph.lineSeries[0].AddComponent <WMG_Data_Source>();
        ds1.dataSourceType = WMG_Data_Source.WMG_DataSourceTypes.Single_Object_Single_Variable;
        s1                 = graph.lineSeries[0].GetComponent <WMG_Series>();
        s1.hidePoints      = true;
        s1.hideLines       = false;
        s1.lineColor       = Color.red;
        s1.dataLabelsColor = Color.black;
        ds1.setDataProvider <Component>(HumanControl.GetComponent("PhysioThread"));
        ds1.setVariableName(variables[TopDropdown1index].ToString());
        s1.realTimeDataSource     = ds1;
        s1.seriesName             = dropdownlist[TopDropdown1index].ToString();
        s1.UseXDistBetweenToSpace = false;

        ds2 = graph.lineSeries[1].AddComponent <WMG_Data_Source>();
        ds2.dataSourceType = WMG_Data_Source.WMG_DataSourceTypes.Single_Object_Single_Variable;
        s2                 = graph.lineSeries[1].GetComponent <WMG_Series>();
        s2.hidePoints      = true;
        s2.hideLines       = false;
        s2.lineColor       = Color.blue;
        s2.dataLabelsColor = Color.black;
        ds2.setDataProvider <Component>(HumanControl.GetComponent("PhysioThread"));
        ds2.setVariableName(variables[TopDropdown2index].ToString());
        s2.realTimeDataSource     = ds2;
        s2.seriesName             = dropdownlist[TopDropdown2index].ToString();
        s2.UseXDistBetweenToSpace = false;

        ds3 = graphBottom.lineSeries[0].AddComponent <WMG_Data_Source>();
        ds3.dataSourceType = WMG_Data_Source.WMG_DataSourceTypes.Single_Object_Single_Variable;
        s3                 = graphBottom.lineSeries[0].GetComponent <WMG_Series>();
        s3.hidePoints      = true;
        s3.hideLines       = false;
        s3.lineColor       = Color.red;
        s3.dataLabelsColor = Color.black;
        ds3.setDataProvider <Component>(HumanControl.GetComponent("PhysioThread"));
        ds3.setVariableName(variables[BottomDropdown1index].ToString());
        s3.realTimeDataSource     = ds3;
        s3.seriesName             = dropdownlist[BottomDropdown1index].ToString();
        s3.UseXDistBetweenToSpace = false;

        ds4 = graphBottom.lineSeries[1].AddComponent <WMG_Data_Source>();
        ds4.dataSourceType = WMG_Data_Source.WMG_DataSourceTypes.Single_Object_Single_Variable;
        s4                 = graphBottom.lineSeries[1].GetComponent <WMG_Series>();
        s4.hidePoints      = true;
        s4.hideLines       = false;
        s4.lineColor       = Color.blue;
        s4.dataLabelsColor = Color.black;
        ds4.setDataProvider <Component>(HumanControl.GetComponent("PhysioThread"));
        ds4.setVariableName(variables[BottomDropdown2index].ToString());
        s4.realTimeDataSource     = ds4;
        s4.seriesName             = dropdownlist[BottomDropdown2index].ToString();
        s4.UseXDistBetweenToSpace = false;

        graph.xAxis.AxisMaxValue          = 0;
        graph.xAxis.AxisMaxValue          = 3;
        graph.yAxis.AxisMinValue          = -90;
        graph.yAxis.AxisMaxValue          = 90;
        graph.xAxis.SetLabelsUsingMaxMin  = true;
        graph.xAxis.LabelType             = WMG_Axis.labelTypes.ticks;
        graph.xAxis.hideLabels            = true;
        graph.xAxis.AxisLabelColor        = Color.black;
        graph.yAxis.numDecimalsAxisLabels = 2;
        graph.yAxis.AxisLabelColor        = Color.black;
        graph.yAxis.AxisNumTicks          = 6;
        graph.legend.labelColor           = Color.black;
        graph.paddingLeftRight            = new Vector2(40, 30);

        graphBottom.xAxis.AxisMaxValue          = 0;
        graphBottom.xAxis.AxisMaxValue          = 3;
        graphBottom.yAxis.AxisMinValue          = -90;
        graphBottom.yAxis.AxisMaxValue          = 90;
        graphBottom.xAxis.SetLabelsUsingMaxMin  = true;
        graphBottom.xAxis.LabelType             = WMG_Axis.labelTypes.ticks;
        graphBottom.xAxis.hideLabels            = true;
        graphBottom.xAxis.AxisLabelColor        = Color.black;
        graphBottom.yAxis.numDecimalsAxisLabels = 2;
        graphBottom.yAxis.AxisLabelColor        = Color.black;
        graphBottom.yAxis.AxisNumTicks          = 6;
        graphBottom.legend.labelColor           = Color.black;
        graphBottom.paddingLeftRight            = new Vector2(40, 30);

        s1.StartRealTimeUpdate();
        s2.StartRealTimeUpdate();
        s3.StartRealTimeUpdate();
        s4.StartRealTimeUpdate();

        yield return(null);
    }