를 통해 차트 작업 Shape.Chart 개체

Contents
[ ]

차트가 삽입되고 데이터로 채워지면 모양을 변경할 수 있습니다. Shape.Chart 속성은 공개를 통해 사용할 수있는 모든 차트 관련 옵션이 포함되어 있습니다 API.

예를 들어 차트 제목 또는 범례 동작을 변경해 보겠습니다:

For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C
// The path to the documents directory.
System::String outputDataDir = GetOutputDataDir_WorkingWithCharts();
System::SharedPtr<Document> doc = System::MakeObject<Document>();
System::SharedPtr<DocumentBuilder> builder = System::MakeObject<DocumentBuilder>(doc);
System::SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 432, 252);
System::SharedPtr<Chart> chart = shape->get_Chart();
// Determines whether the title shall be shown for this chart. Default is true.
chart->get_Title()->set_Show(true);
// Setting chart Title.
chart->get_Title()->set_Text(u"Sample Line Chart Title");
// Determines whether other chart elements shall be allowed to overlap title.
chart->get_Title()->set_Overlay(false);
// Please note if null or empty value is specified as title text, auto generated title will be shown.
// Determines how legend shall be shown for this chart.
chart->get_Legend()->set_Position(LegendPosition::Left);
chart->get_Legend()->set_Overlay(true);
System::String outputPath = outputDataDir + u"CreateChartUsingShape.docx";
doc->Save(outputPath);

코드는 다음 결과를 생성합니다:

line-chart-aspose-words-cpp