Doughnut Chart

[include]/var/local/wordpress/uploads/reogrid.net/2015/10/pro-info.html[/include]

To add a doughnut chart, add a data source on worksheet:

using unvell.ReoGrid;
// ...

var worksheet = this.grid.CurrentWorksheet;

worksheet["A2"] = new object[,] {
 { null, 2008, 2009, 2010, 2011, 2012 },
 { "City A", 3, 2, 4, 2, 6 },
};

Define 2 ranges, data source range and title range, add these ranges into highlight ranges collection:

var dataRange = worksheet.Ranges["B3:F3"];
var titleRange = worksheet.Ranges["B2:F2"];

worksheet.AddHighlightRange(dataRange);
worksheet.AddHighlightRange(titleRange);

Result:

429

Create the doughnut chart instance:

Chart.Chart c1 = new Chart.DoughnutChart
{
  Location = new Graphics.Point(30, 90),
  Size = new Graphics.Size(400, 260),

  Title = "Doughnut Chart Sample",
  DataSource = new Chart.WorksheetChartDataSource(worksheet, 
    titleRange, dataRange, RowOrColumn.Column),
};

Add the chart instance into worksheet, the chart will be displayed instantly:

worksheet.FloatingObjects.Add(c1);

Result:

428

See Also


Return to Chart