ReoGrid
DOCUMENT
Doughnut Chart

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

using unvell.ReoGrid;
// ...

var worksheet = this.grid.CurrentWorksheet;

worksheet["A2"= new object[,] {
null20082009201020112012 },
"City A"32426 },
};

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(3090),
  Size = new Graphics.Size(400260),

  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


Was the content of the page helpful?

© 2012-2024UNVELL Inc.