- Code: Select all
IChart piechart = presentation.Slides[1].Shapes.AppendChart(ChartType.Pie3D, rect);
piechart.ChartTitle.TextProperties.Text = "Shares of Preference";
piechart.ChartTitle.TextProperties.IsCentered = true;
piechart.ChartTitle.Height = 30;
piechart.HasTitle = true;
String[] products = new String[] { "Product 1", "Product 2", "None" };
Int32[] shares = new Int32[] { 50, 30, 20 };
piechart.ChartData[0, 0].Text = "Product";
piechart.ChartData[0, 1].Text = "Share";
for (Int32 i = 0; i < products.Length; ++i)
{
// the rows must start at 1
piechart.ChartData[i + 1, 0].Value = products[i];
piechart.ChartData[i + 1, 1].Value = shares[i];
}
When the document is generated, the data include another row which I didn't have:
- Code: Select all
Product Share
Product 1 50
Product 2 30
None 20
4th Qtr 1.2
Is this left over from some debugging code, or how did this get into my chart?