user2607223
user2607223

Reputation: 11

how to make Aspose cell cpp chart as a Line chart

Below is aspose cell cpp sample for line chart. but it shows only blue triangle filled with blue how to make this showing line chart?

Aspose::Cells::Startup();
License lic;
lic.SetLicense(u"Aspose.Cells.lic");

Workbook workbook;
Worksheet worksheet = workbook.GetWorksheets().Get(0);
Cells cells = worksheet.GetCells();

for (int i = 0; i < 1024; i++)
{
    cells.Get(i, 0).PutValue(i);               // X축 데이터 (A열, 0~1023)
    cells.Get(i, 1).PutValue(i * 60);  // Y축 데이터 (B열, 랜덤 0~65535)
}

int chartIndex = worksheet.GetCharts().Add(ChartType::Line, 5, 0, 20, 8);
Chart chart = worksheet.GetCharts().Get(chartIndex);

chart.GetNSeries().Add("B1:B1024", true);
chart.GetNSeries().SetCategoryData("A1:A1024");
chart.GetNSeries().Get(0).SetName(u"데이터 그래프");
chart.GetNSeries().Get(0).GetArea().SetTransparency(1.0);

chart.GetChartObject().SetWidth(1000);  // 너비 1200px
chart.GetChartObject().SetHeight(600);  // 높이 800px

chart.ToImage("chart.png");

Line chart result But it shows triangle filled with blue what is the problem?

Upvotes: 1

Views: 26

Answers (0)

Related Questions