As the title suggests, I have a business object that has a number of public properties on it, some of which I want to display in a Bar chart, and others I do not. The values of the properties I do want to display should be aggregated from the n series of business objects I hand to the chart's DataSource property, with the sum of each property displayed in a column in the Bar chart. Thus, if each instance of the business object has 3 properties I want to display, the Bar chart should have 3 columns.
The code I'm using is below. The issues I'm experiencing are that each series of data produces a new column in the bar chart, which is not what I want. The DisplayNames I specify for the FieldMaps are being ignored. Lastly, the property I don't want displayed, IrrelevantProperty, is being displayed.
Thanks for your support.
---------------
chart1.Data.Series = 1; chart1.Data.Points = 3; Email[] emails = new Email[3]; emails[0] = new Email(50, 12, 23, 99); emails[1] = new Email(30, 12, 23, 99); emails[2] = new Email(40, 2, 4, 99); chart1.DataSource = emails; chart1.Gallery = Gallery.Bar; chart1.DataSourceSettings.Fields.Clear(); fieldMap = new FieldMap(); fieldMap.Name = "EmailSetSize"; fieldMap.DisplayName = "Emails Sent"; fieldMap.Usage = FieldUsage.XValue; chart1.DataSourceSettings.Fields.Add(fieldMap); fieldMap = new FieldMap(); fieldMap.Name = "OptedOutSetSize"; fieldMap.DisplayName = "Opt Outs"; fieldMap.Usage = FieldUsage.XValue; chart1.DataSourceSettings.Fields.Add(fieldMap); fieldMap = new FieldMap(); fieldMap.Name = "BadSetSize"; fieldMap.DisplayName = "Bounces"; fieldMap.Usage = FieldUsage.XValue; chart1.DataSourceSettings.Fields.Add(fieldMap); fieldMap = new FieldMap(); fieldMap.Name = "IrrelevantProperty"; fieldMap.Usage = FieldUsage.NotUsed; chart1.DataSourceSettings.Fields.Add(fieldMap); class Email { private int emailSetSize; public int EmailSetSize { get { return emailSetSize; } } private int badMailSetSize; public int BadSetSize { get { return badMailSetSize; } } private int optedOutSetSize; public int OptedOutSetSize { get { return optedOutSetSize; } } private int irrelevantProperty; public int IrrelevantProperty { get { return irrelevantProperty; } } public Email(int emailSetSize, int badMailSetSize, int optedOutSetSize, int irrelevantProperty) { this.emailSetSize = emailSetSize; this.badMailSetSize = badMailSetSize; this.optedOutSetSize = optedOutSetSize; this.irrelevantProperty = irrelevantProperty; } }