using System; using System.Collections; using System.Collections.Generic; using Stimulsoft.Report; namespace ReportGenerator { internal class Program { [STAThread] private static void Main(string[] args) { var report = new StiReport(); var parts = new[] { CreatePart("part1", 1, 2, 3), CreatePart("part2", 0, 1, 5), CreatePart("part3", 3, 0, 1), CreatePart("part4", 1, 2, 1) }; report.RegData("Parts", parts); //report.Load(@"c:\Users\kalles\tmp\PartsReport.mrt"); report.Design(); } private static PartData CreatePart(string name, int smallCount, int mediumCount, int bigCount) { var histData = new[] { new HistBin("Small", smallCount), new HistBin("Medium", mediumCount), new HistBin("Big", bigCount) }; return new PartData(name, new Histogram(histData)); } } public class PartData { public PartData(string name, Histogram histogram) { Histogram = histogram; Name = name; } public string Name { get; private set; } public Histogram Histogram { get; private set; } } public class HistBin { public HistBin(string name, int count = 0) { Name = name; Count = count; } public int Count { get; private set; } public string Name { get; private set; } } public class Histogram : CollectionBase { public Histogram(IEnumerable bins) { foreach (var bin in bins) { base.InnerList.Add(bin); } } } }