示例#1
0
        public void CreateSeriesSet(CSVObject csvObject)
        {
            csvList.Add (csvObject);

            if (csvList.Count == 1) {
            return;
            }

            //csvObject = SubtractCSVs (csvList [0], csvObject);
            Dictionary<string, int> diffList = csvObject.AverageDifferenceCSVs (csvList [0]);

            string label = seriesSets.Count == 0 ? "Initial" : seriesSets.Count.ToString ();
            SeriesSet seriesSet = new SeriesSet (label, new DynamicRect (0, 0, 0, barWidth));
            int seriesScore = 1;

            foreach (KeyValuePair<string, List<string>> entry in csvObject.csvList) {
            string name = entry.Key;
            // Designate color for Series (only used if no convergeManager)
            if (!colorList.ContainsKey (name)) {
                if (convergeManager == null) {
                    colorList [name] = new Color (
                        Random.Range (0.4f, 0.7f),
                        Random.Range (0.4f, 0.7f),
                        Random.Range (0.4f, 0.7f));
                } else {
                    colorList [name] = convergeManager.seriesColors [name];
                }
            }
            // Convert values from String to Float. -1 to represent empty.
            //List<string> strValues = entry.Value;
            //List<float> values = new List<float> ();
            //for (int i = 0; i < strValues.Count; i++) {
            //	float value = (strValues [i] == "" ? -1f : float.Parse (strValues [i]));
            //	values.Add (value);
            //}
            int score = diffList [name];
            seriesScore += score;

            // Create a Series to store series
            BarSeries series = new BarSeries (
                name,
                score, //values,
                new DynamicRect (0, 0, 0, seriesSet.rect.height),
                colorList [name]);
            seriesSet.Add (series);

            }

            //sort seriesList in seriesSet
            seriesSet.Sort (convergeManager.seriesLabels);
            seriesSets.Add (seriesSet);

            // Adjust Max Y-Range
            //UpdateRange ();
            yRange = Mathf.Max (yRange, seriesScore);
            // Adjust init slider val; exclude initial (default) bar
            maxSliderValue = Mathf.Max (0, seriesSets.Count - perPage);
            sliderValue = maxSliderValue;
        }
示例#2
0
        public void CreateSeriesSet(CSVObject csvObject)
        {
            csvList.Add(csvObject);

            if (csvList.Count == 1)
            {
                return;
            }

            //csvObject = SubtractCSVs (csvList [0], csvObject);
            Dictionary <string, int> diffList = csvObject.AverageDifferenceCSVs(csvList [0]);

            string    label       = seriesSets.Count == 0 ? "Initial" : seriesSets.Count.ToString();
            SeriesSet seriesSet   = new SeriesSet(label, new DynamicRect(0, 0, 0, barWidth));
            int       seriesScore = 1;

            foreach (KeyValuePair <string, List <string> > entry in csvObject.csvList)
            {
                string name = entry.Key;
                // Designate color for Series (only used if no convergeManager)
                if (!colorList.ContainsKey(name))
                {
                    if (convergeManager == null)
                    {
                        colorList [name] = new Color(
                            Random.Range(0.4f, 0.7f),
                            Random.Range(0.4f, 0.7f),
                            Random.Range(0.4f, 0.7f));
                    }
                    else
                    {
                        colorList [name] = convergeManager.seriesColors [name];
                    }
                }
                // Convert values from String to Float. -1 to represent empty.
                //List<string> strValues = entry.Value;
                //List<float> values = new List<float> ();
                //for (int i = 0; i < strValues.Count; i++) {
                //	float value = (strValues [i] == "" ? -1f : float.Parse (strValues [i]));
                //	values.Add (value);
                //}
                int score = diffList [name];
                seriesScore += score;

                // Create a Series to store series
                BarSeries series = new BarSeries(
                    name,
                    score,             //values,
                    new DynamicRect(0, 0, 0, seriesSet.rect.height),
                    colorList [name]);
                seriesSet.Add(series);
            }

            //sort seriesList in seriesSet
            seriesSet.Sort(convergeManager.seriesLabels);
            seriesSets.Add(seriesSet);

            // Adjust Max Y-Range
            //UpdateRange ();
            yRange = Mathf.Max(yRange, seriesScore);
            // Adjust init slider val; exclude initial (default) bar
            maxSliderValue = Mathf.Max(0, seriesSets.Count - perPage);
            sliderValue    = maxSliderValue;
        }