Leyenda del Gráfico
Posicionamiento de la Leyenda
Para establecer las propiedades de la leyenda. Por favor, siga los pasos a continuación:
- Cree una instancia de la clase Presentation.
- Obtenga la referencia de la diapositiva.
- Agregue un gráfico a la diapositiva.
- Establezca las propiedades de la leyenda.
- Escriba la presentación como un archivo PPTX.
En el ejemplo dado a continuación, hemos establecido la posición y el tamaño para la leyenda del gráfico.
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 = L"../out/legendCustomOptions_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::ClusteredColumn, 0, 0, 500, 500); | |
// Set Legend Properties | |
chart->get_Legend()->set_X ( 50 / chart->get_Width()); | |
chart->get_Legend()->set_Y ( 50 / chart->get_Height()); | |
chart->get_Legend()->set_Width ( 100 / chart->get_Width()); | |
chart->get_Legend()->set_Height ( 100 / chart->get_Height()); | |
// Write the presentation file to disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |
Establecer el Tamaño de Fuente de la Leyenda
Aspose.Slides para C++ permite a los desarrolladores establecer el tamaño de fuente de la leyenda. Por favor, siga los pasos a continuación:
- Instancie la clase Presentation.
- Cree el gráfico predeterminado.
- Establezca el Tamaño de Fuente.
- Establezca el valor mínimo del eje.
- Establezca el valor máximo del eje.
- Escriba una presentación en el disco.
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/SettingFontSizeOfLegend_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::ClusteredColumn, 0, 0, 500, 500); | |
//Setting legend properties | |
chart->get_Legend()->get_TextFormat()->get_PortionFormat()->set_FontHeight (20); | |
chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMinValue (false); | |
chart->get_Axes()->get_VerticalAxis()->set_MinValue (-5); | |
chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMaxValue (false); | |
chart->get_Axes()->get_VerticalAxis()->set_MaxValue ( 10); | |
// Write the presentation file to disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |
Establecer el Tamaño de Fuente de la Leyenda Individual
Aspose.Slides para C++ permite a los desarrolladores establecer el tamaño de fuente de las entradas de la leyenda individual. Por favor, siga los pasos a continuación:
- Instancie la clase Presentation.
- Cree el gráfico predeterminado.
- Acceda a la entrada de la leyenda.
- Establezca el Tamaño de Fuente.
- Establezca el valor mínimo del eje.
- Establezca el valor máximo del eje.
- Escriba una presentación en el disco.
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/SettingFontSizeOfIndividualLegend_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::ClusteredColumn, 0, 0, 500, 500); | |
//Setting legend properties | |
SharedPtr<IChartTextFormat> tf = chart->get_Legend()->get_Entries()->idx_get(1)->get_TextFormat(); | |
tf->get_PortionFormat()->set_FontBold (NullableBool::True); | |
tf->get_PortionFormat()->set_FontHeight(20); | |
tf->get_PortionFormat()->set_FontItalic(NullableBool::True); | |
tf->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid) ; | |
tf->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Blue()); | |
// Write the presentation file to disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |