How to Use the Bar Chart


To apply coloring:

  1. On the authoring bar, click to open the Data in analysis flyout.

  2. In the flyout, drag the column you want to color by to the center of the visualization.

    Response: Drop targets are shown in the middle of the visualization.

  3. Drop the column on the Color target.

    Response: The bars are colored with one color for each category in the selected column.

Coloring is also available in the Visualization Properties dialog. To learn more about coloring in Spotfire, see Coloring Overview.

The color of marked items is changed under File > Document Properties.

To sort the bars by value:

You can sort the bars according to their heights.

  1. Right-click the bar chart to display the pop-up menu.

  2. Select Sort bars by value.

    Response: The bars are sorted according to the summarized value for each bar. The highest bar is displayed furthest to the left and the lowest bar furthest to the right.

    Comment: Go to the Category Axis page in the Visualization Properties dialog and select Reverse scale if you want the reversed order of the bars.

To sort the bar segments by value:

You can sort the bar segments within the stacked bars according to their heights.

  1. Right-click the bar chart to display the pop-up menu.

  2. Select Properties.

  3. Go to the Appearance page.

  4. Select the Sort bar segments by value check box.

    Response: The bar segments in each bar are sorted by height. The highest segment is placed at the base of the bar, and the lowest segment at the top.

To reverse the order of bar segments:

  1. Right-click the bar chart to display the pop-up menu.

  2. Select Reverse Bar Segment Order.

    Response: The current order of the bar segments in each bar is reversed. That is, the bar segment previously placed at the top will be placed at the bottom of the bar, the bar segment next to top will be placed second-bottom, and so on.

To change orientation of the bars:

  1. Right-click the bar chart to display the pop-up menu.

  2. Select Vertical Bars or Horizontal Bars depending on the current orientation of the bars.

    Response: The orientation of the bars is now changed according to your selection.

To change the aggregation type:

  1. Click the axis selector on the value axis. This is where it says Sum([Column Name]), Count(...), or similarly.

  2. Select a new aggregation measure from the drop-down list.

    Comment: You can also right-click the axis selector and select Custom Expression... from the menu to create your own expression.

    Response: The bar chart is updated to show the new information.

To auto-bin a continuous category axis:

If you have a column containing values that can be interpreted as continuous values, such as an "Age" column, but you want to display bars for a number of age groups instead, you can use the auto-binning function.

  1. Put the desired continuous column on the category axis.

  2. Right-click the column selector and select Auto-bin Column from the pop-up menu.

    Response: Spotfire automatically creates a number of bins in which the values are placed.

  3. If desired, use the binning slider to change the number of bins used in the visualization.

    Comment: You can also right-click the column selector and select Number of Bins... to enter an exact number of bins on the category axis.

To use multiple columns on the value axis:

This is an example of how to use two columns on the value axis. Each column will be represented by a bar.

  1. On the value axis, click the plus sign (Add one more column) next to the column selector.

  2. Select a new column from the menu.
    Comment: A column can also be dragged from the Data in analysis flyout or the Filters panel.
    Response: (Column Names) is automatically added to the color axis.
    Comment: For more information on (Column Names), see the Non-Column Selections page.

To split stacked bars:

This is an example of how you can split the bars in a visualization to display side-by-side bars instead of stacked bars.

  1. Create a bar chart with one numerical column on the value axis (e.g., Sales), one categorical column on the category axis (e.g., Year), and one categorical column to color by (e.g., Category).

    Response: A stacked bar chart with the sum of the numerical column (Sales) per category axis category (Year) is displayed.

  2. Right-click and select Side-by-Side Bars from the pop-up menu.

  3. Response: Each color category is now presented as a separate bar.
    Comment: You could also have kept the Stacked bars option and added the color category column to the category axis instead, in order to produce a similar result.

To show each bar segment as a percentage of the total bar:

This is an example of how you can present all stacked bars as 100% high and show the segments in each bar as a percentage of the entire bar.

  1. Create a bar chart with one numerical column on the value axis (e.g., Sales), one categorical column on the category axis (e.g., Year), and one categorical column to color by (e.g., Category).

    Response: A stacked bar chart with the sum of the numerical column (Sales) per category axis category (Year) is displayed.

  2. Right-click and select 100% Stacked Bars from the pop-up menu.

    Response: All bars are now 100% and the percentage of each segment can be shown in a tooltip by hovering with the mouse pointer over the segment.
    Comment: You can also display the segment values or percentage by adjusting the Labels settings in the Visualization Properties dialog.

To mark bars or bar segments:

To add a reference line to the bar chart:

  1. Right-click the bar chart to display the pop-up menu.

  2. Select Properties.

  3. Go to the Lines & Curves page.

  4. Select the check box for any of the default lines or click Add to define a new horizontal or vertical line.

    Comment: You can only add lines to the category axis when it is in continuous mode. Right-click the scale labels and select Continuous Scale from the pop-up menu.

To add a curve fit to the bar chart:

  1. Right-click the bar chart to display the pop-up menu.

  2. Select Properties.

  3. Go to the Lines & Curves page.

  4. Click Add and select a suitable curve fit from the drop-down menu.

    Comment: You can select from a number of predefined curve fits, or define your own curve using Curve Draw. See Curve Fit Models for more information about the different options.

  5. Once the curve has been created, you can change its settings on the Lines & Curves page. Some of the curve settings are also available from the pop-up menu in the visualization.

To add more than one scale to the value axis:

When the measures on the value axis are of  completely different magnitudes, you might benefit from using more than one scale on the axis.

  1. Right-click the value axis and select Dual Scales or Multiple Scales from the pop-up menu.

    You can also go to the Value Axis page in the Visualization Properties dialog and click the Dual scales or Multiple scales radio button. This is also where you can change the settings for the different scales as well as define which side of the bar chart a certain scale should be located.

  2. Comment: If you are using values from different columns on the various scales, you can drag columns from one side to another.

To add error bars to the bar chart:

  1. Right-click the bar chart to display the pop-up menu.

  2. Select Properties.

  3. Go to the Error Bars page.

  4. In the Visible error bars list, select the column or measure to use, and select the check box next to it.

    Response: The settings for the selected column or measure will be displayed in the lower part of the dialog.

    Comment: Only columns and measures with numerical values are listed.

  5. To define an upper error, choose a column or measure in the Upper error column selector. To define a lower error, choose a column or measure in the Lower error column selector.

    Response: The defined error bars are shown in the visualization. See the Error Bars page in the Bar Chart Properties for more information about the settings. To learn more about error bars in general, see Error Bars.

    Note: Make sure the bar chart is displayed using the layout option Side-by-side bars. Error bars cannot be displayed in bar charts with percentage scaling, that is, with Stacked bars and 100% stacked bars. Open the Appearance page in the Bar Chart Properties dialog if you need to change the bar chart layout.

To create a new bar chart:

  1. On the authoring bar, click    to open the Visualization types flyout.

  2. Drag the Bar chart visualization to the wanted position on the analysis page.

    Response: A first attempt to set up a suitable bar chart is made.

  3. Adjust the bar chart to display the categories and measures of your choice.

    Comment: For more information about how to change what to show on the two axes, see Column Selectors.

See also:

Bar Chart Properties

What is a Bar Chart?