question

BrettRobbins-4708 avatar image
0 Votes"
BrettRobbins-4708 asked FinleyMichael-1355 commented

Dynamic control of number of charts in SSRS reports

I have a created a dynamic chart in SSRS. It creates a chart for each of the machines I am tracking in an area. If I have 3 machines I have 3 charts in a row accross the page. If I have 9 machinies I have 9 charts in a row accross the page. Is there away force SSRS to start a new row after 3 or say 4 charts? I found one suggestion with a custom function in the report code but if I have 9 machines I get a report like so:

4 charts then 5 "No Data" charts on the first row
4 "No Data" charts then 3 charts followed by 2 "No Data" charts on the second row
7 "No data" charts then 2 charts.

In tablix I have a ColumnGroup on my machine name and in the Row Details a Group by the value returned from the function. In my function I was trying to count the machines and return a 1 for machines 1 thru 3, 2 for 4 thru 6 , etc...


126192-image.png




sql-server-reporting-services
image.png (62.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Any luck resolving the "No Data Available" issue? I'm running into the same thing.

0 Votes 0 ·

1 Answer

Joyzhao-MSFT avatar image
0 Votes"
Joyzhao-MSFT answered BrettRobbins-4708 commented

Hi @BrettRobbins-4708

I am sorry that I am not clear about your needs. Do you want to use custom code to set the number of dynamically displayed charts per row? You could refer to this article: https://www.bi4all.pt/en/news/en-blog/dynamic-control-of-number-of-charts-in-ssrs-reports/
If I misunderstand what you mean, please feel free to let me know.
Best Regards,
Joy


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Actually that is what I have already done. I followed that article and what I get is what you see. It is now splitting the charts to 3 charts on the page. I have 9 charts and it sets up 9 columns puts four on the first row and 3 offset by four columns on the second row and 2 offest by7 columns on the thrid row. You can see the image I attached correct? What I was hoping for is 3 charts on the first row, 3 on the second and 3 on the third. The custom code does not work as described in the article.

Dim FlagTable As System.Collections.Hashtable

Dim Flag As Integer

Function MyFunc(ByVal NewValue As String) As Integer

  If (FlagTable Is Nothing) Then
     FlagTable = New System.Collections.Hashtable

 End If

 If (NewValue Is Nothing) Then
     NewValue = "-"
 End IF

 If NOT (FlagTable.Contains(NewValue)) Then
     Flag = Flag + 1
     FlagTable.Add(NewValue, nothing)
 End If

 MyFunc = Flag

End Function

With the Details Grouping expression set as: =Ceiling(Code.MyFunc(Fields!Machine.Value)/3)


0 Votes 0 ·