Format dataseries in excel

Hi,

I want to change the format of dataseries in aspose cells when using the radar chart type. The series are filled now, I would like them to be displayed as just lines. If its possible, how do i do that?

regards,

mikael

Hi Mikael,

Thanks for considering Aspose.

Do you want to create the radar chart like your attached image, Well, you should use ChartType.Radar instead of ChartType.RadarFilled.

Following is a sample example for your requirement and attached is the output chart.

Workbook workbook = new Workbook();
//Set default font
Style style = workbook.DefaultStyle;
style.Font.Name = "Tahoma";
workbook.DefaultStyle = style;

Worksheet sheet = workbook.Worksheets[0];
//Set the name of worksheet
sheet.Name = "Data";
sheet.IsGridlinesVisible = false;

Cells cells = workbook.Worksheets[0].Cells;
//Put a value into a cell
cells["A1"].PutValue("Brand Name");
cells["B1"].PutValue("Vitamin A");
cells["C1"].PutValue("Vitamin B1");
cells["D1"].PutValue("Vitamin B2");
cells["E1"].PutValue("Vitamin C");
cells["F1"].PutValue("Vitamin D");
cells["G1"].PutValue("Vitamin E");

cells["A2"].PutValue("Brand A");
cells["B2"].PutValue(.10);
cells["C2"].PutValue(.10);
cells["D2"].PutValue(.10);
cells["E2"].PutValue(.80);
cells["F2"].PutValue(.10);
cells["G2"].PutValue(.70);

cells["A3"].PutValue("Brand B");
cells["B3"].PutValue(.80);
cells["C3"].PutValue(.75);
cells["D3"].PutValue(.80);
cells["E3"].PutValue(.10);
cells["F3"].PutValue(.50);
cells["G3"].PutValue(.15);

cells["A4"].PutValue("Brand C");
cells["B4"].PutValue(.40);
cells["C4"].PutValue(.25);
cells["D4"].PutValue(.40);
cells["E4"].PutValue(.55);
cells["F4"].PutValue(.30);
cells["G4"].PutValue(.10);

int sheetIndex = workbook.Worksheets.Add();
Worksheet sheet2 = workbook.Worksheets[sheetIndex];
//Set the name of worksheet
sheet2.Name = "Chart";
//Create chart
int chartIndex = sheet2.Charts.Add(ChartType.Radar,1,1,25,10);
Chart chart = sheet2.Charts[chartIndex];
//Set properties of chart
chart.IsRectangularCornered = false;
//Set properties of chart title
chart.Title.Text = "Nutritional Analysis";
chart.Title.TextFont.Color = Color.Black;
chart.Title.TextFont.IsBold = true;
chart.Title.TextFont.Size = 12;
//Set properties of nseries
chart.NSeries.Add("Data!B2:G4",false);
chart.NSeries.CategoryData = "Data!B1:G1";
chart.ValueAxis.TickLabels.NumberFormat = "0.0%";
chart.PlotArea.Area.ForegroundColor = Color.Transparent;

for ( int i = 0; i < chart.NSeries.Count; i ++ )
{
chart.NSeries[i].Name = cells["A"+(i+2).ToString()].Value.ToString();
}

workbook.Save("d:\\test\\recRadarChart.xls");

Should it fullfil your need, if not, kindly create your desired chart in MS Excel and post it her, we will help you how to make it using Aspose.Cells APIs.

Thank you.