رسم بياني ثلاثي الأبعاد
Contents
[
Hide
]
تعيين خصائص RotationX و RotationY و DepthPercents للرسم البياني ثلاثي الأبعاد
توفر Aspose.Slides لـ C++ واجهة برمجة تطبيقات بسيطة لتعيين هذه الخصائص. ستساعدك المقالة التالية على كيفية تعيين خصائص مختلفة مثل دوران X و Y و DepthPercents، إلخ. الكود النموذجي يطبق إعداد الخصائص المذكورة أعلاه.
- أنشئ مثيلاً من فئة Presentation.
- الوصول إلى الشريحة الأولى.
- إضافة رسم بياني ببيانات افتراضية.
- تعيين خصائص Rotation3D.
- كتابة العرض المعدل إلى ملف PPTX.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C | |
// The path to the documents directory. | |
const String outPath = u"../out/ManagePropertiesCharts_out.pptx"; | |
//Instantiate Presentation class that represents PPTX file | |
SharedPtr<Presentation> pres = MakeObject<Presentation>(); | |
//Access first slide | |
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0); | |
// Add chart with default data | |
SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::StackedColumn3D, 0, 0, 500, 500); | |
// Setting the index of chart data sheet | |
int defaultWorksheetIndex = 0; | |
// Getting the chart data worksheet | |
SharedPtr<IChartDataWorkbook> fact = chart->get_ChartData()->get_ChartDataWorkbook(); | |
// Now, Adding a new series | |
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 1, ObjectExt::Box<System::String>(u"Series 1")), chart->get_Type()); | |
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 2, ObjectExt::Box<System::String>(u"Series 2")), chart->get_Type()); | |
// Add Catrgories | |
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 1, 0, ObjectExt::Box<System::String>(u"Caetegoty 1"))); | |
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 2, 0, ObjectExt::Box<System::String>(u"Caetegoty 2"))); | |
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 3, 0, ObjectExt::Box<System::String>(u"Caetegoty 3"))); | |
// Set Rotation3D properties | |
chart->get_Rotation3D()->set_RightAngleAxes(true); | |
chart->get_Rotation3D()->set_RotationX ( 40); | |
chart->get_Rotation3D()->set_RotationY ( 270); | |
chart->get_Rotation3D()->set_DepthPercents ( 150); | |
// Take second chart series | |
SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->idx_get(1); | |
// Now populating series data | |
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 1, 1, ObjectExt::Box<double>(20))); | |
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 2, 1, ObjectExt::Box<double>(50))); | |
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 3, 1, ObjectExt::Box<double>(30))); | |
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 1, 2, ObjectExt::Box<double>(30))); | |
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 2, 2, ObjectExt::Box<double>(10))); | |
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 3, 2, ObjectExt::Box<double>(60))); | |
// Set OverLap value | |
series->get_ParentSeriesGroup()->set_Overlap ( 100); | |
// Write the presentation file to disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |