public DendrogramFormat(DendrogramData data, IEnumerable <KeyValuePair <double, double> > leafLocations, IEnumerable <IEnumerable <Color> > colors) { Data = data; LeafLocations = ImmutableList.ValueOf(leafLocations); if (colors != null) { Colors = ImmutableList.ValueOf(colors.Select(ImmutableList.ValueOf)); if (Colors.Count != LeafLocations.Count) { throw new ArgumentException(@"Wrong number of colors", nameof(colors)); } if (Colors.Count > 0) { ColorLevelCount = Colors[0].Count; if (Colors.Any(c => c.Count != ColorLevelCount)) { throw new ArgumentException(@"Inconsistent number of colors", nameof(colors)); } } } else { Colors = ImmutableList <ImmutableList <Color> > .EMPTY; } }
public ColumnGroup(DendrogramData dendrogramData, IEnumerable <Header> headers) { DendrogramData = dendrogramData; Headers = ImmutableList.ValueOf(headers); if (DendrogramData.LeafCount != Headers.Count) { throw new ArgumentException(@"Wrong number of headers", nameof(headers)); } }
public ClusterGraphResults(DendrogramData rowDendrogramData, IEnumerable <Header> rowHeaders, IEnumerable <ColumnGroup> columnGroups, IEnumerable <Point> points) { RowDendrogramData = rowDendrogramData; RowHeaders = ImmutableList.ValueOf(rowHeaders); ColumnGroups = ImmutableList.ValueOf(columnGroups); Points = ImmutableList.ValueOf(points); }
public CaptionedDendrogramData(DendrogramData dendrogramData, IEnumerable <CaptionedValues> captionLevels) { DendrogramData = dendrogramData; CaptionLevels = ImmutableList.ValueOf(captionLevels); foreach (var captionLevel in CaptionLevels) { if (captionLevel.Values.Count != dendrogramData.LeafCount) { throw new ArgumentException(@"Wrong number of captions", nameof(captionLevels)); } } }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (DesignMode) { double availableSpace = IsTreeVertical ? Width : Height; var leafLocations = Enumerable.Range(0, 3).Select(i => new KeyValuePair <double, double>(i * availableSpace / 4, (i + 1) * availableSpace / 4)).ToList(); var dendrogramData = new DendrogramData(new [, ] { { 0, 1 }, { 2, 3 } }, Enumerable.Repeat(1.0, 2).ToArray()); var colors = new[] { Color.Red, Color.Green, Color.Blue }.Select(color => new[] { color }); DrawDendrogram(e.Graphics, new DendrogramFormat(dendrogramData, leafLocations, colors)); return; } foreach (var data in _dendrogramFormats) { DrawDendrogram(e.Graphics, data); } }