Excel API Library for .NET - Sample Browser | Document Solutions | Bubble chart
[
フレーム]
Refer to the following example code to see how to add a bubble chart in Document Solutions for Excel.
//create a new workbook
var workbook = new GrapeCity.Documents.Excel.Workbook();
IWorksheet worksheet = workbook.Worksheets[0];
GrapeCity.Documents.Excel.Drawing.IShape shape = worksheet.Shapes.AddChart(GrapeCity.Documents.Excel.Drawing.ChartType.Bubble, 250, 20, 360, 230);
worksheet.Range["A1:C10"].Value = new object[,] {
{"Blue", null, null },
{125, 750, 3 },
{25, 625, 7 },
{75, 875, 5 },
{175, 625, 6},
{"Red",null,null },
{125 ,500 , 10 },
{25, 250, 1 },
{75, 125, 5 },
{175, 250, 8 },
};
shape.Chart.SeriesCollection.Add(worksheet.Range["A1:C5"], GrapeCity.Documents.Excel.Drawing.RowCol.Columns);
shape.Chart.SeriesCollection.Add(worksheet.Range["A6:C10"], GrapeCity.Documents.Excel.Drawing.RowCol.Columns);
shape.Chart.ChartTitle.Text = "Bubble Chart";
// Save to an excel file
workbook.Save("BubbleChart.xlsx");
' Create a new Workbook
Dim workbook As New Workbook
Dim worksheet As IWorksheet = workbook.Worksheets(0)
Dim shape As IShape = worksheet.Shapes.AddChart(ChartType.Bubble, 250, 20, 360, 230)
worksheet.Range("A1:C10").Value = New Object(,) {
{"Blue", Nothing, Nothing},
{125, 750, 3},
{25, 625, 7},
{75, 875, 5},
{175, 625, 6},
{"Red", Nothing, Nothing},
{125, 500, 10},
{25, 250, 1},
{75, 125, 5},
{175, 250, 8}
}
shape.Chart.SeriesCollection.Add(worksheet.Range("A1:C5"), RowCol.Columns)
shape.Chart.SeriesCollection.Add(worksheet.Range("A6:C10"), RowCol.Columns)
shape.Chart.ChartTitle.Text = "Bubble Chart"
' save to an excel file
workbook.Save("BubbleChart.xlsx")