Esempio n. 1
0
    public void  VisGraph(int minTime, int maxtime)
    {
        float alpha = 0.0f;
        bool  flag  = false;
        int   midP  = (maxtime - minTime) / 2;
        int   mid   = minTime + midP;
        int   d     = 0;

        float[] arr = new float[mid + 1];
        int     l   = 0;



        for (int i = minTime; i < maxtime; i++)
        {
            d++;
            xval = float.Parse(data[i]["xval"].ToString());
            yval = float.Parse(data[i]["yval"].ToString());
            nspk = float.Parse(data[i]["nspk"].ToString());

            if (nspk == 1)
            {
                ntime = float.Parse(data [i] ["ntime"].ToString());
            }
            if (nspk == 2)
            {
                ntime  = float.Parse(data [i] ["ntime"].ToString());
                ntime2 = float.Parse(data [i] ["ntime2"].ToString());
            }
            if (nspk == 3)
            {
                ntime  = float.Parse(data [i] ["ntime"].ToString());
                ntime2 = float.Parse(data [i] ["ntime2"].ToString());
                ntime3 = float.Parse(data [i] ["ntime3"].ToString());
            }


            xval = xval * condensevalue;
            yval = yval * condensevalue;

            Vector3 vect3xy = new Vector3(xval, 0, yval);

            Datapoint.setDataPointColor();

            if (alpha < 1 && flag == false)
            {
                alpha   = (float)d / (float)midP;
                arr [l] = alpha;
                //	Debug.Log (alpha);
                l++;
            }

            else
            {
                flag  = true;
                alpha = arr [l];
                l--;
                //	Debug.Log (alpha);
            }

            Datapoint.setDataPointColor(alpha);

            Instantiate(staticPointPrefab, vect3xy, Quaternion.identity);

            if (nspk == 1)
            {
                noOfSpikes++;
                lowSpikes++;
                timeSec = ntime / 10000;
                timeOfSpikeLow.Add(timeSec);
                nspikeVal = nspk * nspikeCondenseValue;
                Vector3 vect3intensity = new Vector3(xval, nspikeVal, yval);
                Spike.setColor(alpha);
                Instantiate(pointOneSpkiePrefab, vect3intensity, Quaternion.identity);
                CreateSpike(xval, yval, nspikeVal);
            }
            if (nspk == 2)
            {
                noOfSpikes += 2;
                mediumSpikes++;
                timeOfSpikeMedium.Add(((ntime + ntime2) / 2) / 10000);
                nspikeVal = nspk * nspikeCondenseValue;
                Vector3 vect3intensity = new Vector3(xval, nspikeVal, yval);
                Spike.setColor(alpha);
                Instantiate(pointTwoSpkiePrefab, vect3intensity, Quaternion.identity);
                CreateSpike(xval, yval, nspikeVal);
            }

            if (nspk == 3)
            {
                noOfSpikes += 3;
                highSpikes++;
                timeOfSpikeHigh.Add(((ntime + ntime2 + ntime3) / 3) / 10000);
                nspikeVal = nspk * nspikeCondenseValue;
                Vector3 vect3intensity = new Vector3(xval, nspikeVal, yval);
                Spike.setColor(alpha);
                Instantiate(pointThreeSpkiePrefab, vect3intensity, Quaternion.identity);
                CreateSpike(xval, yval, nspikeVal);
            }
        }

        string timesLow    = CreateStringOfTime(timeOfSpikeLow);
        string timesMedium = CreateStringOfTime(timeOfSpikeMedium);
        string timesHigh   = CreateStringOfTime(timeOfSpikeHigh);


        showRange(minTime, maxtime, noOfSpikes, lowSpikes, highSpikes, mediumSpikes, timesLow, timesMedium, timesHigh);



        DestroyTimeList(timeOfSpikeLow);
        DestroyTimeList(timeOfSpikeMedium);
        DestroyTimeList(timeOfSpikeHigh);
        noOfSpikes   = 0;
        lowSpikes    = 0;
        mediumSpikes = 0;
        highSpikes   = 0;
    }
Esempio n. 2
0
    public void  VisGraph(int sliderData)
    {
        for (int i = sliderData; i < sliderData + maxRange; i++)
        {
            startTimeSec = (int)(sliderData * 0.03f);
            endTimeSec   = (int)((sliderData + maxRange) * 0.03f);

            dataStartTimeInSeconds.text = startTimeSec.ToString();
            dataEndTimeInSeconds.text   = endTimeSec.ToString();

            xval = float.Parse(data[i]["xval"].ToString());
            yval = float.Parse(data[i]["yval"].ToString());
            nspk = float.Parse(data[i]["nspk"].ToString());

            if (nspk == 1)
            {
                ntime = float.Parse(data [i] ["ntime"].ToString());
            }
            if (nspk == 2)
            {
                ntime  = float.Parse(data [i] ["ntime"].ToString());
                ntime2 = float.Parse(data [i] ["ntime2"].ToString());
            }
            if (nspk == 3)
            {
                ntime  = float.Parse(data [i] ["ntime"].ToString());
                ntime2 = float.Parse(data [i] ["ntime2"].ToString());
                ntime3 = float.Parse(data [i] ["ntime3"].ToString());
            }

            xval = xval * condensevalue;
            yval = yval * condensevalue;

            Vector3 vect3xy = new Vector3(xval, 0, yval);
            Datapoint.setDataPointColor();
            Instantiate(staticPointPrefab, vect3xy, Quaternion.identity);


            if (nspk == 1)
            {
                noOfSpikes++;
                lowSpikes++;
                timeSec = ntime / 10000;
                timeOfSpikeLow.Add(timeSec);
                nspikeVal = nspk * nspikeCondenseValue;
                Vector3 vect3intensity = new Vector3(xval, nspikeVal, yval);
                Spike.setColor(0.1f);
                Instantiate(pointOneSpkiePrefab, vect3intensity, Quaternion.identity);
                CreateSpike(xval, yval, nspikeVal);
            }
            if (nspk == 2)
            {
                noOfSpikes += 2;
                mediumSpikes++;
                timeOfSpikeMedium.Add(((ntime + ntime2) / 2) / 10000);
                nspikeVal = nspk * nspikeCondenseValue;
                Vector3 vect3intensity = new Vector3(xval, nspikeVal, yval);
                Spike.setColor(0.1f);
                Instantiate(pointTwoSpkiePrefab, vect3intensity, Quaternion.identity);
                CreateSpike(xval, yval, nspikeVal);
            }

            if (nspk == 3)
            {
                noOfSpikes += 3;
                highSpikes++;
                timeOfSpikeHigh.Add(((ntime + ntime2 + ntime3) / 3) / 10000);
                nspikeVal = nspk * nspikeCondenseValue;
                Vector3 vect3intensity = new Vector3(xval, nspikeVal, yval);
                Spike.setColor(0.1f);
                Instantiate(pointThreeSpkiePrefab, vect3intensity, Quaternion.identity);
                CreateSpike(xval, yval, nspikeVal);
            }
        }

        string timesLow    = CreateStringOfTime(timeOfSpikeLow);
        string timesMedium = CreateStringOfTime(timeOfSpikeMedium);
        string timesHigh   = CreateStringOfTime(timeOfSpikeHigh);

        int tillRange = sliderData + maxRange - 1;

        showRange(sliderData, tillRange, noOfSpikes, lowSpikes, highSpikes, mediumSpikes, timesLow, timesMedium, timesHigh);

        DestroyTimeList(timeOfSpikeLow);
        DestroyTimeList(timeOfSpikeMedium);
        DestroyTimeList(timeOfSpikeHigh);
        noOfSpikes   = 0;
        lowSpikes    = 0;
        mediumSpikes = 0;
        highSpikes   = 0;
    }