Set Rectangle Size dynamically

• Question

• Hello there.

The oringin problem is, there is no Gantt chart in ReportingServices. Now I try to solve that with a subreport. I want to send 2 coordinates (Location.Left and Size.Width), but it doesn't work.

Is it possible to solve that problem using this or another alternative? If yes, how?

Friday, January 20, 2006 3:15 PM

• The following approach using rectangles (instead of subreports) as an inline data visualization in a table or other data region may get you close to the desired behavior:

1. Add an embedded image to your report that will serve as the Gantt chart "bar"
2. Add a column to your table, and place an Image report item in the detail row cell.
3. Select the embedded image from step 1 as the source for the Image report item.
4. Set the padding on the Image report item to adjust the size and position of the bar within the cell
5. Create an expression for the right and left padding that divides a field value by some maximum value, clamps it to a given range if necessary using Math.Min/Max, and then multiplies by the total size of the bar.
=((1.0-(Math.Min(Math.Max(Fields!Duration.Value,0),100)/100))*72) & "pt"

-- Robert

Saturday, January 21, 2006 6:28 PM

All replies

• The following approach using rectangles (instead of subreports) as an inline data visualization in a table or other data region may get you close to the desired behavior:

1. Add an embedded image to your report that will serve as the Gantt chart "bar"
2. Add a column to your table, and place an Image report item in the detail row cell.
3. Select the embedded image from step 1 as the source for the Image report item.
4. Set the padding on the Image report item to adjust the size and position of the bar within the cell
5. Create an expression for the right and left padding that divides a field value by some maximum value, clamps it to a given range if necessary using Math.Min/Max, and then multiplies by the total size of the bar.
=((1.0-(Math.Min(Math.Max(Fields!Duration.Value,0),100)/100))*72) & "pt"

-- Robert

Saturday, January 21, 2006 6:28 PM
• Hi Robert,

I'm really interested in your solution. Could you send me a code example?

Thanks,

may

Friday, June 16, 2006 8:22 PM
• Thanks! It's a great help!

Such information should be in the documentation.

Peter

Wednesday, March 21, 2007 9:40 AM
• A related sample report that demonstrates this is covered in the "Table Inline charts" section of the following whitepaper: http://msdn2.microsoft.com/en-us/library/aa964128.aspx

-- Robert

Thursday, March 22, 2007 8:30 PM