Updating existing chart in Powerpoint slide

Last post 05-07-2012, 2:27 AM by aspose.notifier. 9 replies.
Sort Posts: Previous Next
  •  01-23-2012, 9:13 AM 356738

    Updating existing chart in Powerpoint slide .NET

    Hello Everybody,

    I have a problem when I update a chart only by changing its underlying data in the embedded excel worksheet.. 

    Basically, I create a template consisting of an empty chart and update the values by code. However, after manipulating the data points I can see them but the format changes. For example, I have a label for evey data point. 

    I also tried to disable the label manually but this does not work. My series variabel seems to contain 0 labels, what I find confusing, because each point shows its value, name and so on. Maybe I am missing something. Best solution would be to maintain the chart template unchanged. However, disabling all labels manually would also be fine. Can anybody help?

    Best regards
    Alex

    PresentationEx srcPres = new PresentationEx"myPres.pptx" ); SlideEx fstSlide = srcPres.Slides[ 0 ];
          //The alternative text of the source is set as oleobject 
          //to get its reference quickly
          ShapeExCollection sc =  fstSlide.Shapes;
          ShapeEx srcShape = fstSlide.FindShapeByAltText( "myShape" );
     
          //Setting the index of chart data sheet
          int defaultWorksheetIndex = 0;
     
          if( srcShape is ChartEx )
          {
            ChartEx chart = (ChartEx)srcShape;
            
            if( chart != null )
            {
              //Getting the chart data worksheet
              ChartDataCellFactory chartFact = chart.ChartData.ChartDataCellFactory;
     
              //Take first chart series. Disable data labels (not working).
              ChartSeriesEx series = chart.ChartData.Series[ 0 ];
              series.Labels.ShowLegendKey = false;
              series.Labels.ShowSeriesName = false;
              series.Labels.ShowValue = false;
              series.Labels.ShowCategoryName = false;
     
              chartFact.GetCell( defaultWorksheetIndex, 1, 0 ).Value = "Sep'10";
              chartFact.GetCell( defaultWorksheetIndex, 1, 1 ).Value = 5810;
     
              chartFact.GetCell( defaultWorksheetIndex, 2, 0 ).Value = "Oct'10";
              chartFact.GetCell( defaultWorksheetIndex, 2, 1 ).Value = 6376;
     
              chartFact.GetCell( defaultWorksheetIndex, 3, 0 ).Value = "Nov'10";
              chartFact.GetCell( defaultWorksheetIndex, 3, 1 ).Value = 6061;
     
              chartFact.GetCell( defaultWorksheetIndex, 4, 0 ).Value = "Dec'10";
              chartFact.GetCell( defaultWorksheetIndex, 4, 1 ).Value = 7385;
     
              chartFact.GetCell( defaultWorksheetIndex, 5, 0 ).Value = "Jan'10";
              chartFact.GetCell( defaultWorksheetIndex, 5, 1 ).Value = 5608;
     
              chartFact.GetCell( defaultWorksheetIndex, 6, 0 ).Value = "Feb'10";
              chartFact.GetCell( defaultWorksheetIndex, 6, 1 ).Value = 5028;
     
              chartFact.GetCell( defaultWorksheetIndex, 7, 0 ).Value = "Mar'10";
              chartFact.GetCell( defaultWorksheetIndex, 7, 1 ).Value = 6631;
     
              chartFact.GetCell( defaultWorksheetIndex, 8, 0 ).Value = "Apr'10";
              chartFact.GetCell( defaultWorksheetIndex, 8, 1 ).Value = 5756;
            }
     
            //Write the presentation on disk
            srcPres.Write( "out.pptx" );
    Filed under: chart;chartex;data;label
     
  •  01-23-2012, 11:22 AM 356767 in reply to 356738

    Re: Updating existing chart in Powerpoint slide

    Hi Alex,
    Thanks for using Aspose.Slides.

    Can you please share the input .pptx file for further investigation of this issue.
    Best Regards

    Hassan Farrukh
    Support Developer
    Aspose Sialkot Team

    Aspose - The .NET and Java Component Publisher
     
  •  01-24-2012, 3:15 AM 356874 in reply to 356767

    Re: Updating existing chart in Powerpoint slide

    Attachment: Present (inaccessible)
    Hello Hassan,

    thank you for your fast reply.
    I attached the sources with the template file for you.

    Thank you for your help.

    Best regards 
    Alex

     
  •  01-24-2012, 1:34 PM 357027 in reply to 356874

    Re: Updating existing chart in Powerpoint slide .NET

    Attachment: Present (inaccessible)
    Hi Alex,

    Thanks for sharing source and template presentation.

    Here I have two questions.
    1) I tried to differentiate between "outCD - How it should look.pptx" & "outCD.pptx". Are these files are not same?
    2) Please check the attached pptx file. I have created this file by code sample shared by you in latest Aspose.Slides for NET. Is this fulfill your requirement?

    If you are expecting other than this, please share us what it should like in a demo presentation.

    We apologize for your inconvenience.

    Thanks and Best Regards.



    Best Regards

    Hassan Farrukh
    Support Developer
    Aspose Sialkot Team

    Aspose - The .NET and Java Component Publisher
     
  •  01-25-2012, 3:42 AM 357135 in reply to 357027

    Re: Updating existing chart in Powerpoint slide

    Hello Hassan,

    I am sorry that I confused you with my pptx slides.
    The input file is "myTemplate.pptx", what you also used for your output.
    The file "outCD - How it should look.pptx" shows what I want as output result, but I cannot achieve it.
    However, the file "outCD.pptx" is what I get when I run my code.
    Therefore, the file you generated looks similar to my "outCD.pptx".

    How is it possible to remove the data point labels with Aspose? For example, the first point should not display "Overall_units; Sep'10; 5810".
    Furthermore, I don't understand why the generated slide shows those labels at all. The template file itself is not displaying them. You can check this by editing the "myTemplate.pptx" chart data manually.

    Best regards
    Alex
     
  •  01-26-2012, 2:04 AM 357355 in reply to 357135

    Re: Updating existing chart in Powerpoint slide

    Hi Alex,
    I am working on presentation and template files shared by you. I will let you know about my findings after a short time.
    Thanks for your patience.
    Kind Regards


    Best Regards

    Hassan Farrukh
    Support Developer
    Aspose Sialkot Team

    Aspose - The .NET and Java Component Publisher
     
  •  01-26-2012, 3:35 PM 357505 in reply to 357355

    Re: Updating existing chart in Powerpoint slide

    Hi Alex,

    For hiding x-axis you have to call following command.

    chart.CategoryAxis.IsVisible = false;


    Hope I could help you.

    Thanks for your patience,

    Best Regards


    Best Regards

    Hassan Farrukh
    Support Developer
    Aspose Sialkot Team

    Aspose - The .NET and Java Component Publisher
     
  •  01-27-2012, 3:08 AM 357586 in reply to 357505

    Re: Updating existing chart in Powerpoint slide

    Attachment: Present (inaccessible)
    Hello Hassan,

    unfortunately, I don't want to remove the axis itself.
    Just the data point labels within the chart.
    Hopefully, the attached screenshot shows the problem clearly.

    Best Regards
    Alex
     
  •  01-30-2012, 10:18 AM 357933 in reply to 357586

    Re: Updating existing chart in Powerpoint slide .NET

    Hi Alex,

    Thanks for your patience.

    I found the basic cause of confusion between our understandings.


    I am opening .pptx file in MS PowerPoint 2007 and not able to see any data point label (snaps attached). Now I opened generated .pptx in MS PowerPoint 2010 and able to look aforementioned issue.

     

    I am floating a request for investigation to developer with ID SLIDESNET-33184.This thread has been associated with this investigation request, so that you can be automatically notified as soon as this issue is resolved.

    We apologize for your inconvenience

    Thanks and Regards,


    Best Regards

    Hassan Farrukh
    Support Developer
    Aspose Sialkot Team

    Aspose - The .NET and Java Component Publisher
     
  •  05-07-2012, 2:27 AM 380740 in reply to 356738

    Re: Updating existing chart in Powerpoint slide

    The issues you have found earlier (filed as SLIDESNET-33184) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
    (10)
     
View as RSS news feed in XML