气泡图
气泡图大小缩放
Aspose.Slides for C++ 支持气泡图大小缩放。在 Aspose.Slides for C++ 中添加了 IChartSeries.BubbleSizeScale 和 IChartSeriesGroup.BubbleSizeScale 属性。下面给出了示例代码。
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/SettingBubbleChartScaling_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::Bubble, 0, 0, 500, 500); | |
chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->set_BubbleSizeScale(150); | |
// Write the presentation file to disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |
将数据表示为气泡图大小
新的 get_BubbleSizeRepresentation() 方法已添加到 IChartSeries 和 ChartSeries 类中。BubbleSizeRepresentation 指定气泡图中气泡大小值的表示方式。可能的值为:BubbleSizeRepresentationType.Area 和 BubbleSizeRepresentationType.Width。因此,添加了 BubbleSizeRepresentationType 枚举以指定将数据表示为气泡图大小的可能方式。示例代码如下。
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(); | |
System::SharedPtr<IChart> chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Bubble, 50.0f, 50.0f, 600.0f, 400.0f, true); | |
chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->set_BubbleSizeRepresentation(Aspose::Slides::Charts::BubbleSizeRepresentationType::Width); | |
pres->Save(u"../out/Presentation.pptx", Aspose::Slides::Export::SaveFormat::Pptx); | |