コード例 #1
0
        private HistogramData GetValleysHistogram(string columnId)
        {
            var    histogram       = new HistogramData();
            var    histogramFields = new Dictionary <double, List <int> >();
            double lastValue       = 0;
            bool   increasing      = true;

            foreach (var field in Data.Fields)
            {
                if (field.Invalid)
                {
                    continue;
                }

                double?value = field.GetValue(columnId);
                if (!value.HasValue)
                {
                    continue;
                }

                if (value < lastValue)
                {
                    increasing = false;
                }
                else if (value > lastValue)
                {
                    if (!increasing)
                    {
                        histogram.Add(lastValue);

                        List <int> fields;
                        histogramFields.TryGetValue(lastValue, out fields);
                        if (fields == null)
                        {
                            fields = new List <int>();
                        }
                        fields.Add(field.FieldNumber);
                        histogramFields[lastValue] = fields;
                    }
                    increasing = true;
                }
                lastValue = value.Value;
            }
            return(histogram);
        }
コード例 #2
0
        private HistogramData GetValuesHistogram(string columnId)
        {
            var histogram = new HistogramData();

            foreach (var field in Data.Fields)
            {
                if (field.Invalid)
                {
                    continue;
                }

                double?value = field.GetValue(columnId);
                if (!value.HasValue)
                {
                    continue;
                }

                histogram.Add(value.Value);
            }
            return(histogram);
        }