我有100%堆积条形图。学生根据他们的出勤情况进行绑定,报告只是跟踪乐队人口的变化占学生总人数的百分比。在报表生成器中,这完全正常(除了它突出了我们的垃圾出席当然......)
问题出现在:
在所有情况下,尽管实际图表保持不变,但Legend稍微失去了理智,并将前三项显示为100%:
我想不出有任何理由会发生这种情况......由于基础数据结构(令人遗憾的是基于报告模型,这意味着我无法调整报告),报告特别挑剔使用SQL)我最终必须使用自定义vb代码才能让它做我想做的事情,但我不明白为什么其中任何一个应该在服务器上或导出时改变它的行为。
所以我的问题是;为什么会发生这种情况,我该如何阻止它发生呢?
编辑:按要求:
数据集固有地以下面的格式返回数据。每个“周开始日期”每个学员ID都有一行。
我正在使用的自定义代码粘贴在下面(我不知道 - 不笑!):
Private attendance_table As New System.Collections.Hashtable()
Private last_added_table As New System.Collections.Hashtable()
Public Function band_calc(ByVal attendance As Double) As String
REM Define the bands that I want to track
If attendance = 1 Then
Return "A"
ElseIf attendance >= 0.975 Then
Return "B"
ElseIf attendance >= 0.95 Then
Return "C"
ElseIf attendance >= 0.925 Then
Return "D"
ElseIf attendance >= 0.90 Then
Return "E"
ElseIf attendance >= 0.85 Then
Return "F"
ElseIf attendance >= 0.8 Then
Return "G"
Else
Return "X"
End If
End Function
Public Function get_attendance_band(ByVal week_start_date as String, ByVal learnerID As Integer, ByVal possibles As Integer, ByVal presents As Integer) As String
If attendance_table Is Nothing Then
Dim attendance_table As New System.Collections.Hashtable()
End If
If last_added_table Is Nothing Then
Dim last_added_table As New System.Collections.Hashtable()
End If
REM check if attendance_table has the Learner already
If attendance_table.ContainsKey(learnerID) Then
REM check if we've already added this week's data in
If attendance_table(learnerID).ContainsKey(week_start_date) Then
REM just return the band_calc for those data
Return band_calc(attendance_table(learnerID)(week_start_date)(1) / attendance_table(learnerID)(week_start_date)(0))
Else
REM Add in this week to the hashtable. Add this weeks data to the last weeks data
attendance_table(learnerID).Add(week_start_date, New Object() { possibles + attendance_table(learnerID)(last_added_table(learnerID))(0), presents + attendance_table(learnerID)(last_added_table(learnerID))(1)})
REM record that this is now the last date updated for this learner
last_added_table(learnerID) = week_start_date
REM show the band!
Return band_calc(attendance_table(learnerID)(week_start_date)(1) / attendance_table(learnerID)(week_start_date)(0))
End If
Else
attendance_table.Add(learnerID, New System.Collections.Hashtable())
attendance_table(learnerID).Add(week_start_date, New Object() {possibles, presents})
last_added_table.Add(learnerID, week_start_date)
Return band_calc(attendance_table(learnerID)(week_start_date)(1) / attendance_table(learnerID)(week_start_date)(0))
End If
End Function
对于系列属性;排序,组和标签(显然定义了图例)都设置为: