Rectangle
Rectangle[{xmin_, ymin_}, {xmax_, ymax_}]
represents a basic rectangle
Graphics[{Red, Rectangle[{0, 0}], Blue, Rectangle[{0.5, 0.5}]}]
Parameters
RGBColor
filling color
EdgeForm
stroke color
Opacity
global opacity of an object
Methods
Area
Calculates total area (symbolically as well)
Area[Rectangle[{x1, y1}, {x2, y2}]]
RegionCentroid
RegionCentroid[Rectangle[{x1, y1}, {x2, y2}]]
EventHandler
One can listen to a several events produced by this primitive using EventHandler
EventHandler[t_Rectangle, {event_ -> handler_, ...}]
where event
can be
"mousemove"
detects and sends coordinates of a mouse, when it is over this element"drag"
makes primitive draggable and emits coordinates"zoom"
detects zoom / mouse-wheel"click"
detects mouse clicks
tip
See more in Mouse and keyboard
Dynamics
It fully supports dynamics. Use Offload on coordinates.
Example
A simple bar chart
data = RandomReal[{3, 10}, {10, 2}];
Graphics[{
EdgeForm[Black], Blue,
Table[{Blue, Rectangle[{i - .4, 0}, {i, data[[i, 1]]}],
Red, Rectangle[{i + .4, 0}, {i, data[[i, 2]]}]}, {i, 10}]
}, Frame -> True]