Histograms visualize statistics collected by one or more Histogram Data objects. The X-axis scales to fit all data ranges. Each histogram is scaled vertically so its highest bar reaches the full chart height. You can optionally display PDF bars, the CDF line, and the mean value.
Histogram
The PDF (probability density function) is displayed as vertical bars, each representing an interval. Bar height is proportional to the density (or count) of data samples within that interval. Bars can be displayed as solid blocks or distinct separated bars.
The CDF (cumulative distribution function) is displayed as a polyline on top of PDF, and the mean value is a vertical line at the corresponding value axis position.
If percentiles are calculated and both low and high confidence levels are specified, bars corresponding to the confidence bounds are highlighted with the specified colors. Bars containing the exact "values at risk" (where CDF(value) = low confidence level or CDF(value) = 100 − high confidence level) are drawn in intermediate colors.
To create a histogram
- Drag the
Histogram element from the
Analysis palette into the graphical editor.
- Go to the Properties view and set up the histogram properties.
- Add statistical data objects to display on the histogram. Add data objects successively by clicking the
button in the Data section of the properties and configuring just added object in the property section below. Enter the Histogram Data object name in the Histogram field and optionally modify presentation settings using the controls below.
- In the Title box, enter the data item name for the chart legend.
- If you want the PDF bars to be shown, select the Show PDF check box and adjust the PDF color for histogram data objects in the Style menu of the Data property section if needed.
- If you want the CDF to be shown, select the Show CDF check box and adjust the CDF color for histogram data objects in the Style menu of the Data property section if needed.
- If you want the mean line to be shown, select the Show Mean check box and adjust the Mean color for histogram data objects in the Style menu of the Data property section if needed.
- If some histogram data objects displayed on this histogram calculate percentiles, you can adjust the color of the PDF to the left of the low confidence value in the Low % color box and the color of the PDF to the right of the high confidence value in the High % color box in the Style menu of the Data property section.
- General
-
Name — The name of the chart. The name is used to identify and access the chart from code.
Show name — If selected, the name of the chart is displayed in the presentation diagram.
Lock — If selected, the element is locked; it will not respond to any mouse actions during the model development time. To select the element, click its icon in the Elements view.
Ignore — If selected, the chart is excluded from the model.
Data representation — Specifies how the data is shown on the histogram:
Show PDF — If selected, PDF is shown on the histogram.
Show CDF — If selected, CDF is shown on the histogram.
Show mean — If selected, the mean value is shown with a line. - Data
-
Title — The data item name to be shown in the plot legend.
Data — The name of the Histogram Data object that will be displayed on this histogram.
Style — Click to access extra appearance options:
PDF color — [Enabled if Show PDF is selected] The color that will be used for the PDF of the histogram data. Click the control to adjust it using the color picker. CDF color — [Enabled if Show CDF is selected] The color that will be used for the CDF of this histogram data.
Mean color — [Enabled if Show mean is selected] The color of the mean value line for this histogram data.
CDF & Mean line width — [Enabled if Show CDF and/or Show mean is selected] Width of the CDF and/or the mean line. You can either select a button or enter the value in pixels in the box to the right.
Low % color — [Enabled if percentiles are collected for the histogram data] The color which will be used to display the PDF to the left from the low percentile.
High % color — [Enabled if percentiles are collected for the histogram data] The color which will be used to display the PDF to the right from the high percentile.The
and
arrows — Allow you to rearrange the data items.
The
button — Allows you to remove data items from the chart.
The
Add button — Creates a section for a new data item.
- Data update
-
Update data automatically — If selected, new data samples will be added automatically.
Use model time — [Visible if Update data automatically is selected] If selected, the event will occur at the specified model time.
Use calendar date — [Visible if Update data automatically is selected] If selected, the event will occur at the specified calendar date.
First update time — [Visible if Update data automatically and Use model time are selected] The time of the first update defined as a number of model time units that must pass from the model start.
Update date — [Visible if Update data automatically and Use calendar dates are selected] The calendar date and time of the event.
Recurrence time — [Visible if Update data automatically is selected] The time that must pass between recurring updates.
- Legend
-
Show legend — If selected, the chart legend is displayed.
Position — [Enabled if Show legend is selected] Controls the legend position relative to the chart.
Area size — [Enabled if Show legend is selected] Controls the size of the legend area (between the element border and the divider): width for North/South legend position or height for West/East position.
Text color — [Enabled if Show legend is selected] The color that will be used to display the legend. Click the control to adjust the settings using the color picker.
- Appearance
-
Bars relative width — Specifies the bar size as a ratio of the desired bar size to the maximum possible width of a bar in this chart (1 stands for 1:1, 0.5 stands for 1:2, and so on).
Vertical axis labels — Specifies the position of the vertical axis labels relative to the chart:
None — No labels will be displayed
Left
RightStyle — Click to access extra appearance settings and then click each control to adjust them using the color picker.
Background color — The background color for the entire area allocated for the element. The background color for the chart area can be adjusted later in the Chart area section.
Border color — The color of the element border.
Labels color — The color of the chart labels.
Grid color — The color of the chart grid. Select no color if you do not want the grid to be displayed. - Position and size
-
Level — The level this chart belongs to.
X — The X-coordinate of the element’s upper left corner.
Y — The Y-coordinate of the element’s upper left corner.
Width — The width of the element (in pixels).
Height — The height of the element (in pixels).
- Chart area
-
This section defines the visual properties of the chart area.
X Offset — The horizontal offset of the chart area from the left edge of the element.
Y Offset — The vertical offset of the chart area from the left edge of the element.
Width — The width of the chart area (in pixels).
Height — The height of the chart area (in pixels).
Style — Click to access extra appearance settings and then click each control to adjust them using the color picker.
Background color — The chart area background color.
Axis color — The chart area axis color. - Actions
-
On selection change — The code executed when the user selects particular data items. This code is executed either when the user changes the selection by clicking on items in the chart legend, or when the selection is changed programmatically by selectItem().
You can use the following variables:
- int[] selectedIndices — returns the indices of currently selected data items
- boolean programmatically — defines whether items were selected programmatically (true) or not (false)
- Visibility
-
Visible — Toggles the visibility of the element. The chart is visible when the box is checked or when the specified expression evaluates to true, and not visible otherwise.
Agent presentation — If selected, the chart is included in the agent presentation. This means that if the agent hosting this control is embedded in another agent, the control will remain visible.
- Expert
-
Replication — The replication factor of the chart. Here you can specify how many copies of the chart will be created. If you leave this box empty, only one chart will be created.
- Data items
-
Function Description void addHistogram(HistogramData hist, String title, Color colorLowPercent, Color colorHighPercent, Color colorPDF, Color colorCDF, float lineWidthCDF, Color colorMean) Adds a histogram data object to the chart with the specified visual appearance.
hist — the histogram data object to add.
title — the histogram data title.
colorLowPercent — the color to draw the PDF bars of the low percentile.
colorHighPercent — the color to draw the PDF bars of the high percentile.
colorPDF — the color to draw the PDF bars.
colorCDF — the color to draw the CDF line.
lineWidthCDF — the CDF line width, 0 for thinnest possible.
colorMean — the color to draw the mean line.int getCount() Returns the number of data items currently displayed by this chart. HistogramData get(int i) Returns the chart’s HistogramData item with the given index.
i — The index of the data element.String getTitle(int i) Returns the title of chart’s HistogramData item with the given index.
i — The index of the data element.Color getColor(int i) Returns the PDF color of the histogram item with the given index.
i — index of the item.void setColor(int i, Color c) Sets the new PDF color of the histogram item with the given index.
i — the index of the item.
c — the new color of the item.void remove(int i) Removes the HistogramData item with the given index from the chart.
i — the index of the item.int remove(ChartItem ci) Removes the given HistogramData item from the chart.
ci — The chart item to remove.void removeAll() Removes all items from the chart. - Selecting data items
-
Function Description void selectItem(int itemIndex, boolean selected) Selects or deselects (depending on the selected value) the chart item with the given index.
itemIndex — The index of the data element.
select — sets whether to select or deselect the element.void setSelectedItemIndices(int[] selectedIndices) Selects only chart items with the given indices.
selectedIndices — an array with indices of chart items to be selected (other chart items will be deselected), may be null — this clears selection.int[] getSelectedItemIndices() Returns the number of chart items (data items or data sets) currently displayed by this chart. - Updating chart data manually
-
Function Description void updateData() Updates all data items displayed by this chart. - Location
-
Function Description double getX() Returns the X-coordinate of the element (upper left corner). double getY() Returns the Y-coordinate of the element (upper left corner). void setX(double x) Sets the X-coordinate of the element.
x — the new value of the X-coordinate.void setY(double y) Sets the Y-coordinate of the element.
y — the new value of the Y-coordinate.void setPos(double x, double y) Sets new coordinates for the element.
x — the new value of the X-coordinate.
y — the new value of the Y-coordinate. - Size
-
Function Description double getWidth() Returns the width of the element. double getHeight() Returns the height of the element. void setWidth(double width) Sets the new width for the chart shape.
width — the new value of the chart width.void setHeight(double h) Sets the new height for the chart shape.
h — the new value of the chart height. - Visibility
-
Function Description boolean isVisible() Checks the visibility of the element. Returns true if the element is visible, and false otherwise. void setVisible(boolean v) Sets the visibility of the element.
v — visibility: if true — the chart is set to be visible, if false — not visible.
-
How can we improve this article?
-