Working with Bar Charts
About Bar Charts
A bar chart displays data by using bars. The height of each bar represents the value.
By default, a bar chart is sorted in descending order by the value of the first measure. If a bar chart is sorted by a measure data item and has a category data item assigned to the group role, then each category data item’s sort value is determined by summing the measure values of the bars for the category (even when the bars themselves represent something other than a sum). For example, suppose that you are evaluating test scores. There is a TestScores measure that has been assigned an aggregation of Max. You have created a bar chart that shows regional TestScores grouped by Gender. Each bar represents the high test score of a particular Gender within a particular Region. However, the TestScores value that is used to sort each Region is determined by summing the male high test score in that Region with the female high test score in that Region.
Data Roles for a Bar Chart
For information about setting data roles, see Working with Data Role Assignments in SAS Visual Analytics: Working with Report Data.
The basic data roles for a bar chart are a category and measures. You can assign one category only, and the category values are plotted on the category axis. You can assign many measures, and the measure values are plotted on the response axis. If a bar chart contains no measures, then the frequency of the category values is plotted on the response axis.
In addition to the basic data roles, you can assign these roles:
- Group
-
groups the data based on the values of the category data item that you assign. Depending on the value that you selected for the Grouping style option, the group values are shown as either individual bars or as segments of each bar.
Note: Grouping is not available if you assign multiple measures to the bar chart. - Lattice columns
-
creates a lattice of charts with a column for each value of the category data item that you assign.
- Lattice rows
-
creates a lattice of charts with a row for each value of the category data item that you assign.
- Data tip values
-
specifies data items whose values are included in the data tips for the object. Data items can be categories, measures, or both. If you change a measure’s aggregation, then the data tip reflects that change. For more information, see About the Data Tip Values Data Role in SAS Visual Analytics: Working with Report Data.
- Animation
-
specifies a datetime data item that is used to animate the chart.
If you assign the Animation data role, then the
icon appears at the bottom left corner of the object. Click
to start the animation.
Note: A graph with the Animation data role assigned can be the source of an action. However, the action is disabled on a mobile device. - Hidden
-
specifies a category or date data item that is included in the data query but that is not displayed. You can use the hidden data item when you map data sources, add color-mapped display rules, or add external links. For more information, see About the Hidden Data Role in SAS Visual Analytics: Working with Report Data.
Options for a Bar Chart
For information about general options, see Using the Options Pane.
In addition to the general options, you can specify the following object-specific options in the Options pane:
- Direction
-
specifies whether the bars are vertical
or horizontal
.
- Y axis
-
specifies whether the Y (vertical) axis is displayed on the left
or right
side of the plot.
- Fixed baseline
-
specifies the baseline value for the bar chart.
- Baseline style
-
specifies the pattern, the width, and the color for the baseline.
- Spacing
-
specifies the percentage of space between the bars. The default is 15%. For example, suppose that you specify a value of 80% for the Spacing option. This increases the space between the bars, and the bars become skinnier.
If a Group data role is assigned, then the Spacing option’s default is 0%.
- Offset
-
specifies the amount of space to offset the bars from category axis values.
- Transparency
-
specifies the amount of transparency for the bars.
- Grouping style
-
specifies how grouped data appears. If you select
, then each value of the grouping variable appears as a separate bar. If you select
, then the values of the grouping variable are displayed as segments of each bar.
- Grouping scale
-
specifies how the data values for a grouped chart are displayed. By default, the chart displays the actual measure values (Actual values). If you select Normalize groups to 100%, then the values for each grouped bar are displayed as percentages of the total.
- The Group scale option is not available for the dual axis bar chart or the dual axis bar-line chart.
- The Normalize groups to 100% selection requires that either the Group role is assigned or that multiple measures are assigned.
- If you select Normalize groups to 100% for a bar chart, then the Fixed baseline option is not available.
- Negative values are ignored in the 100% stacked bar chart.
- Cluster spacing
-
specifies the percentage of space between the clusters for grouped bars. The default is 15%.
- Abbreviate numeric values
-
displays the measure values in an abbreviated form. For example, the value 1,142,571 might be abbreviated as 1.1M. The data tip for the measure always displays the full value. You can set the scale and precision of the abbreviated values.
- Fill color override
-
specifies the color and transparency of the automatic fill color of the bars that you want to override.
- Data labels
-
shows the data values as text beside or above the bar, depending on the direction of the bar. You can specify the text font, text size, emphasis (bold, italic, or both), and color for the labels.
Note: You can always view a data value as a data tip when you hover over a data value. - Segment labels
-
shows the data values of segments inside the bars. You can specify the text font, text size, emphasis (bold, italic, or both), and color for the labels.
- Measure layout
-
specifies whether the measures share a single response axis (Shared axis) or have separate response axes for each measure (Separate axes). If you specify Automatic, then separate axes are automatically assigned if the measure values are dissimilar in format or magnitude.
Note: When Separate axes is specified, options are applied to all individual bar charts.