Stacked Bar Chart - The linked file is not available

I just upgraded to the latest version of Aspose, and my user is now unable to edit the Stacked Bar Charts. They are able to edit all other slides. Please advise.
image.png (50.7 KB)
image.png (52.0 KB)

@carolmaley,

I have observed the information shared by you and request you to please share the source presentation, generated presentation and sample project reproducing the issue. We will investigate the issue further on our end to help you out.

Thanks Mudassir! I have sent you an email with the attachments.

@carolmaley,

I have not been able to receive any attachment. Can you please share the requested information on some FTP server and share the download link. You can also share the information in this thread as well.

Documents.zip (100.5 KB)

Public Enum GptwChartType
    <Description("Bar")> BAR = 0
    <Description("Stacked_Bar")> STACKED_BAR = 1
    <Description("Fuel_Gage")> FUEL_GAGE = 2
    <Description("Over_Under")> OVER_UNDER = 3
    <Description("Pie")> PIE = 4
    <Description("Spreadsheet")> SPREADSHEET = 5
    <Description("Radar")> RADAR = 6
End Enum

Imports AtlasClasses.GptwPresEnums

Public Class GptwPresChart
Property Label As String = “”
Property Type As GptwChartType
Property Series As List(Of GptwPresChartSeries)
Property GroupNames As List(Of String) = New List(Of String)
Property ShortenedGroupNames As List(Of String) = New List(Of String)
End Class

Public Class GptwPresChartSeries
Property Label As String = “”
Property Scores As List(Of Integer) = New List(Of Integer)
Property ScoresNR As List(Of Double) = New List(Of Double)
Property DottedLineRange As List(Of GptwPresRange) = New List(Of GptwPresRange)
Property Callouts As List(Of Boolean) = New List(Of Boolean)
End Class

Public Class GptwPresRange
Property Min As Integer
Property Max As Integer
Property Label As String
End Class

Private Function GetStackedBarChartsSlideData(presType As GptwPresentationType, index As Integer, sourceSlideIndex As Integer, companyName As String, surveyYear As Integer, gptwLogger As GptwLog) As List(Of IGptwSlide)

    Dim slides = New List(Of IGptwSlide)

    Try
        'Get the demographic that describes what the bars are representing.  
        Dim DemographicTitle As String = ""


        Dim chart = New GptwPresChart() With {.Type = GptwChartType.STACKED_BAR,
                            .GroupNames = New List(Of String),
                            .ShortenedGroupNames = New List(Of String),
                            .Series = New List(Of GptwPresChartSeries) From {
                                New GptwPresChartSeries With {.Label = "Flight Risk", .Scores = New List(Of Integer)},
                                New GptwPresChartSeries With {.Label = "Not Attached", .Scores = New List(Of Integer)},
                                New GptwPresChartSeries With {.Label = "Presenteeism", .Scores = New List(Of Integer)},
                                New GptwPresChartSeries With {.Label = "Trust Fuels Retention", .Scores = New List(Of Integer)}}
                            }

        Dim showNote As Boolean = False
        Dim hideSlide As Boolean = False

        'For i As Integer = 0 To SurveyInfo.ExecutiveTeamEffectiveness.Count - 1
        '    Dim item As ExecutiveTeamEffectivenessData = SurveyInfo.ExecutiveTeamEffectiveness.Item(i)
        '    chart.GroupNames.Add(item.LabelName)
        '    chart.Series.Item(0).Scores.Add(item.CompanyScore)
        '    chart.Series.Item(1).Scores.Add(item.BenchmarkScore)
        '    For Each demographicData As DemographicData In SurveyInfo.Demographics
        '        If demographicData.Demographic = item.LabelName Then
        '            Dim demogSect As gptwDataDemographicSection = New gptwDataDemographicSection(SurveyInfo.ClientId, SurveyInfo.Svid, "", demographicData.Demographic)
        '            Dim numResp As Integer = 0
        '            For Each answerOption In demographicData.AnswerOptions
        '                numResp = numResp + demogSect.NumRespondents(answerOption)
        '            Next

        '            ExecutiveTeamN.Add(demogSect.NumRespondents(numResp.ToString()))
        '        End If
        '    Next
        'Next

        If (sourceSlideIndex = INTENT_OF_RETENTION_BY_WORKTYPE) Then
            Dim demogSect As gptwDataDemographicSection = New gptwDataDemographicSection(zConfigVar, SurveyInfo.ClientId, SurveyInfo.Svid, "", SurveyInfo.RetentionRisk.DemographicName)
            Dim numResp As String
            For i = 0 To SurveyInfo.RetentionRisk.AnswerOptions.Count - 1
                numResp = String.Format("{0:#,##0}", demogSect.NumRespondents(SurveyInfo.RetentionRisk.AnswerOptions(i)))
                Dim astrk As String = ""
                If SurveyInfo.RetentionRisk.ShowNote(i) = True Then
                    astrk = "*"
                    showNote = True
                End If
                chart.GroupNames.Add(String.Format("{0} (n={1}){2}", SurveyInfo.RetentionRisk.AnswerOptions(i), numResp, astrk))
            Next
            DemographicTitle = SurveyInfo.RetentionRisk.DemographicName

            chart.Series.Item(0).Scores = SurveyInfo.RetentionRisk.FlightRisk
            chart.Series.Item(1).Scores = SurveyInfo.RetentionRisk.NotAttached
            chart.Series.Item(2).Scores = SurveyInfo.RetentionRisk.Presenteeism
            chart.Series.Item(3).Scores = SurveyInfo.RetentionRisk.TrustFuelsRetention

            If SurveyInfo.RetentionRisk.AnswerOptions.Count < 2 Then
                hideSlide = True
            End If


        Else
            DemographicTitle = SurveyInfo.ExtraEffort.DemographicName
            Dim demogSect As gptwDataDemographicSection = New gptwDataDemographicSection(zConfigVar, SurveyInfo.ClientId, SurveyInfo.Svid, "", DemographicTitle)

            Dim numResp As String
            For i = 0 To SurveyInfo.ExtraEffort.AnswerOptions.Count - 1
                numResp = String.Format("{0:#,##0}", demogSect.NumRespondents(SurveyInfo.ExtraEffort.AnswerOptions(i)))
                Dim astrk As String = ""
                If SurveyInfo.ExtraEffort.ShowNote(i) = True Then
                    astrk = "*"
                    showNote = True
                End If

                chart.GroupNames.Add(String.Format("{0} (n={1}){2}", SurveyInfo.ExtraEffort.AnswerOptions(i), numResp, astrk))
            Next
            chart.Series.Item(0).Scores = SurveyInfo.ExtraEffort.FlightRisk
            chart.Series.Item(1).Scores = SurveyInfo.ExtraEffort.NotAttached
            chart.Series.Item(2).Scores = SurveyInfo.ExtraEffort.Presenteeism
            chart.Series.Item(3).Scores = SurveyInfo.ExtraEffort.TrustFuelsRetention
            chart.Series.Item(0).Label = "At Risk"
            chart.Series.Item(1).Label = "Culture of Comfort"
            chart.Series.Item(2).Label = "Culture of Burnout"
            chart.Series.Item(3).Label = "Trust Fuels Effort"

            If SurveyInfo.ExtraEffort.AnswerOptions.Count < 2 Then
                hideSlide = True
            End If
        End If


        If Not hideSlide Then
            slides.Add(New GptwSlideStackedBarCharts(presType, sourceSlideIndex, companyName, surveyYear, chart, showNote, DemographicTitle))
        End If
    Catch ex As Exception
        gptwLogger.LogError(String.Format("CertifyGrowReport:GetData:GetStackedBarChartsSlideData exception- slide index:{0} failed with exception:{1}", index, ExceptionHelper.GetDetailedExceptionString(ex)))
    End Try

    Return slides

End Function

Private Function RenderStackedBarChartsSlide(ByVal WorkingSlide As ISlide, ByVal SlideDef As GptwSlideStackedBarCharts) As List(Of String)
Dim SlideErrors As New List(Of String)

    Try
        'Add the company name and perspective label to the slide title.
        AddCompanyNameInTitle(WorkingSlide, SlideDef.CompanyName)
        AddCategoryLabelInTitle(WorkingSlide, SlideDef.CategoryLabel)

        'Add category label in the description.
        AddCategoryLabelInDescription(WorkingSlide, SlideDef.CategoryLabel)

        'Render the stacked bar chart.
        Dim SeriesLabels As New Dictionary(Of Integer, String)
        For i = 0 To SlideDef.Chart.Series.Count - 1
            SeriesLabels.Add(i, SlideDef.Chart.Series(i).Label)
        Next

        Dim RenderingInfo As New BarChartRenderingInfo()
        RenderingInfo.ShapeName = "StackedBarChart1"
        RenderingInfo.IncludeCategoryLabels = True
        RenderingInfo.GroupCount = SlideDef.Chart.GroupNames.Count
        'Don't show the percent label for values < 5.
        RenderingInfo.LabelThreshold = 5
        'Reverse the order of the series, controls the colors.
        RenderingInfo.ReverseSeries = True

        'Perspectives handling.
        Dim PerspectiveInfo As New PerspectiveRenderingInfo()
        PerspectiveInfo.SinglePerspectiveToRender = "ORG"
        RenderingInfo.PerspectiveInfo = PerspectiveInfo

        'Render the stacked bar chart.
        RenderStackedMultiBarChart(WorkingSlide, SlideDef.Chart, SeriesLabels, RenderingInfo)

        'Show or hide the chart note, as specified.
        If PowerpointHelpers.IsShapeOnSlide(WorkingSlide, "Note1") Then
            PowerpointHelpers.ShowShape(WorkingSlide, "Note1", Not SlideDef.ShowNote)
        End If

        'Check if there are any series that don't add up to 100% exactly.
        Dim IsRoundingError As Boolean = CheckGroupsForRoundingError(SlideDef.Chart.Series)
        If IsRoundingError Then
            'Add slide note.
            Dim Notes As New List(Of String) From {"Note: the percentages in the chart do not equal 100% because we rounded to the nearest whole number."}
            PowerpointHelpers.AddSlideNotes(WorkingSlide, Notes)
        End If

    Catch ex As Exception
        AddErrorEntry(SlideErrors, BuildFriendlyExceptionMessage(SlideDef, ex.Message))
    End Try

    Return SlideErrors

End Function

Public Sub RenderStackedMultiBarChart(ByVal WorkingSlide As ISlide, ByVal ChartData As GptwPresChart, ByVal SeriesLabels As Dictionary(Of Integer, String), ByVal RenderingInfo As BarChartRenderingInfo)

    'Find the named bar chart on the slide.
    Dim SlideBarChart As Aspose.Slides.Charts.IChart = PowerpointHelpers.GetChart(WorkingSlide, RenderingInfo.ShapeName)

    'Set the chart title, if there is one.
    AddChartTitle(SlideBarChart, RenderingInfo)

    'Change the slide's series names to the ones provided (e.g. Presenteeism, Flight Risk, etc.).
    'Series are represented in rows.
    Dim SeriesMappings As List(Of String) = BuildSeriesMapping(SeriesLabels)
    AddChartLabels(SlideBarChart, SeriesMappings, RenderingInfo.SeriesOrientation, RenderingInfo.ReverseSeries)

    'Set the group count (number of stacked bars) if necessary.
    If RenderingInfo.GroupCount = 0 Then
        'Use the number of values passed for the first series as a hint how many groups there are.
        RenderingInfo.GroupCount = ChartData.Series(0).Scores.Count
    End If

    'Fill in the values for each series (e.g. job types)
    FillChartValues(SlideBarChart, ChartData, RenderingInfo, True, RenderingInfo.SeriesOrientation)

    'Add category names.
    AddChartCategoryNames(SlideBarChart, ChartData, RenderingInfo)

End Sub

Public Sub AddChartLabels(ByVal SlideBarChart As Aspose.Slides.Charts.IChart, Labels As List(Of String), ByVal DatasheetOrientation As DataSheetSeriesOrientation, ByVal ReverseSeries As Boolean)

    'Change the chart's label names to the ones provided.
    Dim fact As Aspose.Slides.Charts.IChartDataWorkbook = SlideBarChart.ChartData.ChartDataWorkbook
    For i As Integer = 0 To Labels.Count - 1
        Dim Cell As DataSheetCell = CalculateChartCell(i, -1, Labels.Count, DatasheetOrientation, ReverseSeries)
        fact.GetCell(0, Cell.Row, Cell.Column, Labels(i))
    Next

End Sub

''' <summary>
''' Calculate a cell position in a chart datasheet for a given series and data item
''' </summary>
''' <param name="SeriesIndex">Index of the series in the collection</param>
''' <param name="SeriesCount">Total number of series in the collection</param>
''' <param name="DataSheetOrientation">Orientation of the series in the data sheet, by row or by column</param>
''' <param name="ReverseSeries">If true, the series should go in the data sheet in reverse order</param>
''' <returns>Cell row, column pair</returns>
''' <remarks></remarks>
Public Function CalculateChartCell(ByVal SeriesIndex As Integer, ByVal DataItemIndex As Integer, ByVal SeriesCount As Integer, ByVal DatasheetOrientation As DataSheetSeriesOrientation, ByVal ReverseSeries As Boolean) As DataSheetCell

    Dim Cell As New DataSheetCell

    If ReverseSeries Then
        'Reverse the order that the series go on the datasheet.
        'This controls the color that each will appear in based on the slide color schema.
        If DatasheetOrientation = DataSheetSeriesOrientation.Row Then
            'The series data items go across in a row.
            Cell.Row = SeriesCount - SeriesIndex
            Cell.Column = DataItemIndex + 1
        Else
            'The series data items go down in a column.
            Cell.Row = DataItemIndex + 1
            Cell.Column = SeriesCount - SeriesIndex
        End If
    Else
        'Put the series on the datasheet in the same order given.
        If DatasheetOrientation = DataSheetSeriesOrientation.Row Then
            'The series data items go across in a row.
            Cell.Row = SeriesIndex + 1
            Cell.Column = DataItemIndex + 1
        Else
            'The series data items go down in a column.
            Cell.Row = DataItemIndex + 1
            Cell.Column = SeriesIndex + 1
        End If
    End If

    Return Cell

End Function

Public Sub AddChartCategoryNames(ByVal SlideBarChart As Aspose.Slides.Charts.IChart, ByVal ChartData As GptwPresChart, ByVal RenderingInfo As BarChartRenderingInfo)

    If RenderingInfo.IncludeCategoryLabels Then
        'Add the category names (e.g. dimensions).  Category names identify individual clusters.
        SlideBarChart.ChartData.Categories.Clear()
        For i As Integer = RenderingInfo.StartingGroup To (RenderingInfo.StartingGroup + RenderingInfo.GroupCount) - 1
            SlideBarChart.ChartData.Categories.Add(ChartData.GroupNames(i))
        Next
    End If

End Sub

@carolmaley,

I have observed the presentation files and sample code shared by you. Unfortunately, I am unable to develop complete understanding of provided sample code as it involves many things that have not been provided. In order to reproduce the issue on our end, I humbly request you to please share a working Visual Studio project reproducing issue on your end that we may refer and use on our end without any issue to help you further.