Free Support Forum - aspose.com

Problem with labels

Dear support<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I can’t find out how to add 4 labels to my chart:

Attached is my result chart.xls file and the goal "Goal with labels to the right.xls" i am trying to accomplish.

What am i missing?

Regards

Claus

private void CreateStaticReport(Workbook workbook, int antal)
{
Worksheet sheet = workbook.Worksheets[0];
//Set the name of worksheet
sheet.Name = "Cylinder Column";
sheet.IsGridlinesVisible = false;

//Create chart
int chartIndex = sheet.Charts.Add(ChartType.Cylinder, 1, 3, 50, 24);
Chart chart = sheet.Charts[chartIndex];

//Set properties of chart
chart.Floor.ForegroundColor = Color.White;
chart.Walls.ForegroundColor = Color.White;
chart.Elevation = 15;
chart.Rotation = 20;
chart.PlotArea.Border.IsVisible = false;
chart.IsLegendShown = false;
chart.GapWidth = 10;
chart.DepthPercent = 280;

//Set properties of nseries
chart.NSeries.Add("B2:E" + antal, true);
chart.NSeries.CategoryData = "A2:A" + antal;

//Set Series Names to be used in the Legend and there respective colors
chart.NSeries[0].Name = "Adviseret";
chart.NSeries[0].Area.ForegroundColor = System.Drawing.Color.Black;
chart.NSeries[1].Name = "Besogt";
chart.NSeries[1].Area.ForegroundColor = System.Drawing.Color.Yellow;
chart.NSeries[2].Name = "Toemt";
chart.NSeries[2].Area.ForegroundColor = System.Drawing.Color.Green;
chart.NSeries[3].Name = "Forgaeves";
chart.NSeries[3].Area.ForegroundColor = System.Drawing.Color.Red;
chart.Legend.Position = Aspose.Cells.LegendPositionType.Bottom;

//Set properties of chart title
chart.Title.Text = "Tømninger og adviseringer";
chart.Title.TextFont.Color = Color.Black;
chart.Title.TextFont.IsBold = true;
chart.Title.TextFont.Size = 11;

//Set properties of categoryaxis title
chart.CategoryAxis.Title.TextFont.Color = Color.Black;
chart.CategoryAxis.Title.TextFont.Size = 10;
chart.CategoryAxis.Title.TextFont.Name = "Arial";
chart.CategoryAxis.MajorTickMark = TickMarkType.Outside;
chart.CategoryAxis.MinorTickMark = TickMarkType.None;
chart.CategoryAxis.TickLabelPosition = TickLabelPositionType.Low;
chart.CategoryAxis.TickLabelSpacing = 2;
chart.CategoryAxis.TickMarkSpacing = 1;
chart.CategoryAxis.Title.Text = "Uger";

//Set properties of valueaxis
chart.ValueAxis.Title.TextFont.Color = Color.Black;
chart.ValueAxis.Title.TextFont.Size = 10;
chart.ValueAxis.Title.TextFont.Name = "Arial";
chart.ValueAxis.MajorTickMark = TickMarkType.Outside;
chart.ValueAxis.MinorTickMark = TickMarkType.None;
chart.ValueAxis.TickLabelPosition = TickLabelPositionType.NextToAxis;
chart.ValueAxis.Title.Text = "Tømninger";

}

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

You may use chart.IsLegendShown = true; to show the Chart legends.

Thank You & Best Regards,

So Easy!

Thanks a lot!

Regards

Claus