Creating Numeric Ranges With Binning
In WebFOCUS Designer, bins are used to group numeric values by the increment you specify. This allows you to view large amounts of data across measures or calculated measures, enabling you to analyze trends and identify outliers. Data binning also allows you view your data as part of a larger group, displaying ranges of that data in manageable, visible bins.
For example, you might want to analyze Cost of Goods Sold against Discount to understand how discounts impact the cost of goods. First, you add the Discount measure to the Vertical field container. These values will be used as a guide for the comparative, grouped content in the bin. If you apply a bin width value of 250 to the Cost of Goods measure, your data values will be grouped into ranges of 250 (for example, 0 - 250, 250 - 500, 500 - 750). Finally, you add the new binned dimension field (generated by the bin process) to your chart. Your chart now displays the binned values against the Discount measure, as shown in the following image.
As you can see in this example, there is a direct correlation between Cost of Goods and Discount, with the smaller cost records values (0 - 250) constituting more of the discount amount. From this example, it is evident that a large portion of total discounts are given for lower cost items. In this case, binning has given you insight into the frequency distribution of values in your data.
Bins are created on a numeric measure field (for example, Gross Profit), as shown in the following image.
Examples of numeric measure fields include Gross Profit or Discount. Once you create a bin, a new dimension field is automatically created, allowing you to plot values based on your bin specifications.
You can create or edit bins using the same options. On the Resources panel, right-click a field and click Bin values, or right-click a binned field and click Edit bin values. This opens a shortcut menu with the following options:
- Bin width. A standard text box that accepts any number greater than 0.
- Show as. Identifies the bin label type.
- Value. Displays the alphanumeric representation of the numeric value containing the minimum value (FLOOR) of each bin. The format should be set to the data format of the source field.
- Range. Displays the alphanumeric string representing the minimum and maximum range for each bin. The format should be set to the data format of the source field.
- OK. Creates a new dimension field based on the bin options that you selected. This dimension field is automatically added under your dimensions in the Fields tab.
- Cancel. Closes the shortcut menu and cancels the changes.
The following image displays bin values and bin ranges for the DEALER_COST field, using a bin width of 1000. It also shows how the data falls into the value and range properties.
Note: Bin fields that display ranges, using the Show as Range option, use a character field format, while bin fields that display floor values, using the Show as Value option, use a numeric field format. As a result, when displaying ranges, bins with negative numbers display after bins with positive values. This is due to the sort sequence used for character fields. On the other hand, when displaying floor values, bins are sorted into numeric order, so negative value bins display before bins with positive values.
Therefore, if the measure field that you are binning includes negative values, it is recommended to select Value as the Show as option. Alternatively, you can display ranges in numeric order by using a bin with values as a hidden, higher-level sort field and adding the bin with ranges below it on the same axis. For example, if creating a vertical bar chart, create a value bin field and a range bin field, both with the same width. Add the value bin field and then the range bin field to the Horizontal bucket, then hide the value bin field. The ranges are now in the correct order, as shown in the following image.
Procedure: How to Create a Histogram Using Bins
A histogram is a chart, usually in a bar chart format, that displays the frequency distribution of values in your data by displaying the count of values in different ranges. The count aggregation and bins should be applied to the same field to show the frequency distribution effectively.
- Open WebFOCUS Designer. On the WebFOCUS start page, click the plus menu and then click Create Visualizations, or, on the WebFOCUS Home Page, click Visualize Data.
WebFOCUS Designer opens in a new browser tab.
- Select a workspace and a data source available from that workspace.
Once you select a data source, WebFOCUS Designer loads with options to create a single content item.
- If the default content type is not a bar chart, select a vertical bar chart option from the Content picker.
- With the Fields tab selected on the sidebar, on the Resources panel, under Measures, select a numeric measure field and place it in the Vertical bucket. You can also double-click the field, or right-click it and select Add to chart.
- Right-click the measure field in the Vertical bucket, point to Aggregate, and click Count.
The prefix CNT. is added to the front of the field name. The vertical axis now represents the frequency of values of the selected measure field, rather than summed values.
- On the Resources panel, under Measures, right-click the same measure field and point to Bin values.
- Specify a numeric value in the Bin width field. For example, using the numeric value 500 creates bins that group values of 500 together.
Keep in mind the overall range of values in the field that you are binning. Fields with smaller variance work best with smaller bins, while fields with large variance work best with larger bins.
- Optionally, select a Show as option. Range, which is the default, shows the minimum and maximum value for each range, while Value shows only the minimum value.
- Click OK to generate the bins for the selected measure field.
Note: The binned measure is added to the Resources panel as a new dimension field that you can use in your chart.
- From the list of dimension fields, locate the field that is suffixed by _BIN_1 (for example, REVENUE_US_BIN_1).
Note: The binned field is placed under Dimensions on the Resources panel. If you are viewing these fields using the Folder view, it will be available under a folder with the same name used under Measures. You can also use the search feature to locate the new dimension field if needed.
- Add this new dimension field to the Horizontal field container.
The bins display in your chart. Each bar represents a range of values, and the height of each bar represents the number of records that fall into each range, as shown in the following image.
From the image above, we can see that sales falling into the first two bins, up to $500 in revenue, were the most frequent.
- Optionally, to edit the bin width to produce more or fewer bins, or to change the bin label type between ranges and values, right-click the bin field in the Horizontal bucket and point to Edit bin values. You can then change the bin settings and click OK to apply them.
- Release: 8207
- Category: Visualizing Data
- Product: WebFOCUS Designer
- Tags: How-to's