ActiveReports 8 > ActiveReports User Guide > Concepts > Page Report Concepts > Data Visualizers > Range Bar |
The Range Bar data visualization displays a 96 by 96 dpi bar image. The colored bar renders as half the height of the image, centered vertically. The amount of colored bar to render to the right of the Start argument (or to the left in the case of a negative value) is based on the Length argument. If the Length argument is zero, a diamond renders.
The Minimum and Maximum arguments determine the range of data. The area between the Length argument and the Maximum argument is transparent (or between the Length and the Minimum in the case of a negative value).
You can use static values or aggregate functions (e.g. Min or Max) to set the parameters. For more information on these and other aggregate functions, see the Common Functions topic.
=RangeBar(Minimum, Maximum, Color, Start, Length)
Use an expression with this syntax in the BackgroundImage Value property of a TextBox or the Value property of an Image. This renders a bar in the color specified, the length of which changes depending on the number returned by the Length parameter, in the case of the simple example, GrossProfit. If your data contains only positive values, Start corresponds with Minimum at the left edge of the DataBar. The area between the Length and the Maximum is transparent.
Simple Example
Set the Length parameter to the value of a field in your dataset to display the field values visually.
Paste into a TextBox BackgroundImage property |
Copy Code
|
---|---|
=RangeBar(0,15000,"BlueViolet",0,Fields!GrossProfit.Value)
|
Example Using Negative Values
When your data contains negative as well as positive values, you can use an Immediate If expression for the Color parameter. In this example, if the Projected Stock value is negative, it renders in Crimson, while positive values render in BlueViolet. You can also see that negative values render to the left of Zero and positive values render to the right. A Length value of exactly zero renders as a diamond.
Paste into a TextBox BackgroundImage property |
Copy Code
|
---|---|
=RangeBar(-5,20,IIf((Fields!InStock.Value - 5) < 0, "Crimson", "BlueViolet"),0,Fields!InStock.Value-5) |
Default Behavior
The function returns null (i.e. no image is rendered) in the following cases:
The Start value changes in the following cases:
The Length value changes in the following cases:
If the argument for any of the parameters cannot be converted to the required data type, the default value is used instead.
Parameter | Default Value |
---|---|
Minimum | 0 |
Maximum | 0 |
Color | Green |
Start | 0 |
Length | 0 |
Dialog
When you select a TextBox control on your report, in the Properties window or Properties dialog, you can drop down the BackGroundImage Value property and select <Data Visualizer...> to launch the dialog. The same is true if you select an Image control and drop down the Value property. To build the data visualizer expression, select the appropriate values for each of the options in the dialog.