Samples: All group footers at end (on anew page)

Stimulsoft Reports.NET discussion
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Samples: All group footers at end (on anew page)

Post by Fabio Pagano »

Now, always in "All group footers at end" demo, after i have added the percentage incidence for each letter, i would like to add a graphical bar showing that percentage. Each bar has a scale of 100 and its value is the percentage itself. I have tried with some graphics but with no result.

In the following image, in the red box i would like to make appear the horizontal bars, one for each letter:

Image

Thanks.
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Samples: All group footers at end (on anew page)

Post by Brendan »

You could simulate the effect of a Progress bar by using a Container and Text Component if it is of any benefit.

Image

Add a Container to the space outlined with all borders set
Add a Text component within the Container with all Borders set and Dock property set to Left. Give text component an appropriate name (txtPercent)
Set some Progress Color properties for the Text Component
For the BeforePrintEvent of the TextComponent call the following:

Code: Select all

C#
DrawPercent( Math.Round(100m/Customers.Count * Totals.Count(GroupHeaderBand2), 2));


VB.NET
DrawPercent( Math.Round(100/Customers.Count * Totals.Count(GroupHeaderBand2), 2))

In your report Code Behind window add the DrawPercent method

Code: Select all

C#
private void DrawPercent(decimal percent)
{
	double labelWidth = (double)Math.Round(Container1.Width / 100 * (double)percent,2);
	txtPercent.Width = labelWidth;
}


VB.NET
Private Sub DrawPercent(ByVal percent As Decimal)
	Dim labelWidth As Double = CType(Math.Round(Container1.Width / 100 * CType(percent,Double),2),Double)
	txtPercent.Width = labelWidth
End Sub

Samples available here:
C# Sample Download

VB.NET Sample Download

User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Samples: All group footers at end (on anew page)

Post by Fabio Pagano »

Thanks Brendan.
Anyway, i don't use code behind because my reports are designed by end users that don't know nothing about programming. That's why i was searching something like a statistical design where i could set a scale (100) and a value (the percentage calculated).
Post Reply