Free Support Forum - aspose.com

How to select data range that covering all the data of data soure for box and whisker chart?

Hi Aspose Team,

I am generating box and whisker chart using latest version of aspose.slide but it not generate chart as per expection due to select data issue. when i open it in powerpoint and select all data by right click on chart and selecting select data option it is changing output of chart which is actual output. so how can i select all the data from chart data workbook using C# coding. Please suggest.

@sdtechsupport.sirius,

I have observed your requirements and suggest you to please try using following sample code to set the chart data range by loading data from another file.

public static void TestChartData() 
{
    String path="C:\\Aspose Data\\";
    Presentation pres = new Presentation();

    IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.BoxAndWhisker, 50, 50, 500, 400);
    var msln =chart.ChartData.ReadWorkbookStream();
    chart.ChartData.ChartDataWorkbook.Clear(0);
    chart.ChartData.Series.Clear();
    chart.ChartData.Categories.Clear();

    MemoryStream memStream1 = new MemoryStream();
    Workbook worbook = new Workbook(path + "ChartData.xlsx");

    MemoryStream memStream = new System.IO.MemoryStream();
    worbook.Save(memStream, Aspose.Cells.SaveFormat.Xlsx);
        
    memStream.Position = 0;
    chart.ChartData.WriteWorkbookStream(memStream);
    chart.ChartData.SetRange("Sheet1!$A$1:$D$23");
         
    pres.Save(path+"data.pptx",Aspose.Slides.Export.SaveFormat.Pptx);
}

ChartData.zip (6.4 KB)

Thanks for giving sample code.
Using following line i can set range dynamically. If i don’t know last cell address having data, then how can i proceed further. For example in below line my last cell address is D23 but I am generating chart data sheet dynamically using coding so i don’t know last cell address so what if i don’t know last cell address. Please suggest.

chart.ChartData.SetRange(“Sheet1!$A$1:$D$23”);

@sdtechsupport.sirius,

I have observed your requirement and like to share that you have to figure this out on your end that what range you need to set for chart. As far as Aspose.Slides is concerned, it allows you to set the range for the chart and will generate the chart in accordance to set chart range.

Hi mudassir

I have attached same ChartData file which was given by you and just blank some of cell value in it. After doing this if i run following code it will giving me error of “overflow”. So If i given range by SetRange method if one of the cell value is blank which fall in range given in SetRange method it’s givning me error.
Please suggest.

public static void TestChartData()
{
String path=“C:\Aspose Data\”;
Presentation pres = new Presentation();

IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.BoxAndWhisker, 50, 50, 500, 400);
var msln =chart.ChartData.ReadWorkbookStream();
chart.ChartData.ChartDataWorkbook.Clear(0);
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();

MemoryStream memStream1 = new MemoryStream();
Workbook worbook = new Workbook(path + "ChartData.xlsx");

MemoryStream memStream = new System.IO.MemoryStream();
worbook.Save(memStream, Aspose.Cells.SaveFormat.Xlsx);
    
memStream.Position = 0;
chart.ChartData.WriteWorkbookStream(memStream);
chart.ChartData.SetRange("Sheet1!$A$1:$D$23");
     
pres.Save(path+"data.pptx",Aspose.Slides.Export.SaveFormat.Pptx);

}

ChartData.zip (6.8 KB)

@sdtechsupport.sirius,

I have observed your requirement and like to share in order to cater this issue, following statement is to be used in your sample code.

chart.DisplayBlanksAs = DisplayBlanksAsType.Zero;

However, even after use of this statement, there is still an issue for BoxAndWhisker chart. An issue with ID SLIDESNET-40172 has been created in our issue tracking to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

Hi Aspose Team,

Thank you for taking this into consideration for your issue tracking, however we would request if you could consider this on priority as we have a planned release of our application and we cannot proceed ahead with this issue not being resolved. Just to elaborate the issue, attaching both the raw data and the sample PPT again here for your reference.

Our main issue is that raw data will be in this format only (attached sample) including the blanks and the charts are not being generated properly in this case due to data range selection. We tried fixing it using set range function provided by your end but it is throwing error in case of blank cell vales ( which is a requirement) in specific cell ranges. Aspose.zip (2.2 MB)

Looking forward to your response on this asap.

@sdtechsupport.sirius,

I hope when the concerned issue will be resolved the issue related to setting range including blank cells will also get resolved. We will be able to share any good news with you as soon as the issue will be scheduled for investigation on its due turns and gets resolved.

@mudassir.fayyaz Thanks for taking this into consideration. If you could provide us with some timeline when it would be resolved , As It would be affecting our planning and user experience both, so we really need to have this resolved. However based on the estimated timeline you provide we can plan things accordingly.

@sdtechsupport.sirius,

I have observed your comments. I like to share that issue is recently added in our issue tracking system, Issue is still under detail investigation. I have requested our product team to share further updates regarding this issue. We will share good news with you soon.

I see that the status of the issue has been marked as resolved whereas we did not get any resolution yet. Can you please help with this?

We are waiting for this issue to be resolved to plan our release accordingly. Hope you understand the priority at our end and consider the same first.

@sdtechsupport.sirius,

I have observed your comments. I like to share that this issue is going to be resolved tentatively in Aspose.Slides 18.6 and that will be released in end of June or start of July. I request for your patience.

Hi,

Just wanted to check if this release you mentioned is on track? please let us know as we are planning our release according to your resolution to the said issues.

Thanks!

@sdtechsupport.sirius,

The concerned issue has been marked as resolved in upcoming Aspose.Slides 18.6 and we request for your patience till the time the product is shared online.

Hi,

Do we have any specific date for 18.6 Slides release? We would like to have a notification if possible for the same. It was communicated for June end possibly earlier.

Thanks!

@sdtechsupport.sirius,

The concerned release is likely to be available in coming week. We will share the good news with you as soon as the product will be shared online.

The issues you have found earlier (filed as SLIDESNET-40172) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz