Changeset 14826 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/DensityChart.cs
- Timestamp:
- 04/04/17 17:52:44 (7 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Views (added) merged: 14240-14241,14248,14251,14277,14330,14351,14421,14449,14497-14499,14542,14591-14592,14762,14825
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/DensityChart.cs
r14099 r14826 30 30 } 31 31 32 public void UpdateChart(IList<string> data, double minimumHeight = 0.1) { 33 if (data == null || !data.Any()) 34 return; 35 UpdateChartWithBuckets(CalculateBuckets(data)); 36 } 37 38 32 39 public void UpdateChart(IList<double> data, double min, double max, int numBuckets, double minimumHeight = 0.1) { 33 40 if (data == null || numBuckets < 0 || min > max || max < min) 34 41 return; 35 42 36 var buckets = CalculateBuckets(data, numBuckets, min, max); 43 UpdateChartWithBuckets(CalculateBuckets(data, numBuckets, min, max)); 44 } 37 45 46 47 private void UpdateChartWithBuckets(double[] buckets) { 38 48 // set minimum height of all non-zero buckets on 10% of maximum 39 49 double minHeight = buckets.Max() * 0.1; … … 69 79 return buckets; 70 80 } 81 private double[] CalculateBuckets(IList<string> data) { 82 return data.GroupBy(val => val).OrderBy(g => g.Key).Select(g => (double)g.Count()).Concat(new double[] { 0.0 }).ToArray(); 83 } 71 84 } 72 85 }
Note: See TracChangeset
for help on using the changeset viewer.