We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is it possible to add ChartEx to pptx presentation?

Is it possible to directly add ChartEx to pptx presentation?

Something like this:

PresentationEx presColumn = new PresentationEx();
SlideEx sld = presColumn.Slides[0];
ChartEx newChart = sld.Shapes.AddChart(ChartTypeEx.StackedColumn3D, 100, 100, 550, 400);

Pay attention, insert ChartEx directly, and not using Ole object.

In other words I want to get something like in attachment.

There is .NET code, is it possible convert it to JAVA?

using System;
using System.Collections.Generic;
using System.Text;
using Aspose.Slides.Pptx;
using Aspose.Slides.Pptx.Charts;

namespace TestChart
{
class Program
{
static void Main(string[] args)
{
//Instantiate PresentationEx class that represents PPTX file
PresentationEx pres = new PresentationEx();

//Access first slide
SlideEx sld = pres.Slides[0];

// Add chart with default data
ChartEx chart = sld.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 0, 0, 500, 500);

//Setting chart Title
chart.ChartTitle.Text.Text = "Sample Title";
chart.ChartTitle.Text.CenterText = true;
chart.ChartTitle.Height = 20;
chart.HasTitle = true;

//Set first series to Show Values
chart.ChartData.Series[0].Labels.ShowValue = true;

//Setting the index of chart data sheet
int defaultWorksheetIndex = 0;

//Getting the chart data worksheet
ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;

//Delete default generated series and categories
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
int s = chart.ChartData.Series.Count;
s = chart.ChartData.Categories.Count;

//Adding new series
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 1, "Series 1"), chart.Type);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, "Series 2"), chart.Type);

//Adding new categories
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 1, 0, "Caetegoty 1"));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 2, 0, "Caetegoty 2"));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 3, 0, "Caetegoty 3"));

//Take first chart series
ChartSeriesEx series = chart.ChartData.Series[0];

//Now populating series data
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));

//Take second chart series
series = chart.ChartData.Series[1];

//Now populating series data
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 2, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 2, 10));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 2, 60));

//create custom lables for each of categories for new series

//first label will be show Category name
DataLabelEx lbl = new DataLabelEx(series);
lbl.ShowCategoryName = true;
lbl.Id = 0;
series.Labels.Add(lbl);

//Show series name for second label
lbl = new DataLabelEx(series);
lbl.ShowSeriesName = true;
lbl.Id = 1;
series.Labels.Add(lbl);

//show value for third label
lbl = new DataLabelEx(series);
lbl.ShowValue = true;
lbl.ShowSeriesName = true;
lbl.Separator = "/";
lbl.Id = 2;
series.Labels.Add(lbl);

// show value and custom text
// lbl = new DataLabelEx(series);
// lbl.TextFrame.Text = "My text";
// lbl.Id = 3;
// ser.Labels.Add(lbl);

// Save presentation with chart
pres.Write(@"..\..\AsposeChart.pptx");
}
}
}




Hi
Vasiliy,


I regret to share that support for creating charts is currently unavailable in Aspose.Slides for Java and is only available in Aspose.Slides for .NET. As soon as the feature will be ported to Aspose.Slides for Java, we will be happy to share the information with you.

Many Thanks,

Thanks for reply.


Could you approximately estimate, when this
novelty for Java version will be done?

Hi Vasiliy,


I have created an issue with ID SLIDESJAVA-33161 as new feature request in our issue tracking system to further investigate the possibility of implementing and providing the feature support in Aspose.Slides for Java. I will share the further response with you as soon as it is shared by our development team.

Many Thanks,

Hi,


Can you provide us with information about when do you start implement this feature for Java?

Regards,

Hi Leonid,


As I have shared with you earlier in some other forum that we are currently auto porting Aspose.Slides for .NET feature to Aspose.Slides for Java. Since, chart rendering is available in Aspose.Slides for .NET so it will be automatically be available in Aspose.Slides for Java as well. This feature will be available in Aspose.Slides for Java 3.0.0, which is scheduled for delivery on May 22, 2012. I will share the further updates as soon as they will be available.

Many Thanks,