Chart

Class graphomate.ui.charts.Chart


extends sap.ui.core.Control


Quick Start

Creates a chart that can be used in layouts and other container components. The graphomate chart is highly customizable due to its large amount of properties and aggregations.

Usage Example
var chart = new graphomate.ui.charts.Chart({
   chartType: graphomate.ui.charts.enums.ChartType.OffsetBar,
   series1: [5, 16, 17, 20],
   series2: [-2, 12, 15, 19]
});





Constructor Details

new graphomate.ui.charts.Chart(id?:string, settings?:object)

Accepts an id and a settings object or one or none of them. The settings object defines initial property values as well as aggregated and associated objects. Every setting can also be set using the related setter method. The supported settings are:

Properties:
General
Data
  • series1 : float[] (default: [])
  • series2 : float[] (default: [])
  • series3 : float[] (default: [])
  • series4 : float[] (default: [])
  • series5 : float[] (default: [])
  • series6 : float[] (default: [])
  • series7 : float[] (default: [])
  • series8 : float[] (default: [])
  • series9 : float[] (default: [])
  • series10 : float[] (default: [])
  • datatypes1 : string[] (default: [])
  • datatypes2 : string[] (default: [])
  • datatypes3 : string[] (default: []),
  • datatypes4 : string[] (default: [])
  • datatypes5 : string[] (default: [])
  • datatypes6 : string[] (default: [])
  • datatypes7 : string[] (default: [])
  • datatypes8 : string[] (default: [])
  • datatypes9 : string[] (default: [])
  • datatypes10 : string[] (default: [])
  • seriesLabels : string[] (default: ["Series1","Series2","Series3","Series4","Series5","Series6","Series7","Series8","Series9","Series10"])
  • categoryLabels : string[][] (default: [])
  • axisLabels : string[] (default: [])
  • visibleSeries : int[] (default: [])
Labels
Axes
  • showCategoryAxis : boolean (default: true)
  • axisThickness : int, (default: 3)
  • fixedCategoryWidth : boolean (default: false)
  • categoryWidth : int (default: 50)
  • showValueAxis : boolean (default: false)
  • flipValueAxis : boolean (default: false)
  • valueAxisTickDistance : float (default: 50.0)
  • categoryCount : graphomate.ui.types.UnsignedInteger (default: 0)
Synchronization
  • comparisonGroup : string (default: null)
Deviations
  • negativeDeviationIsGood : boolean (default: false)
  • deviationGoodColor : graphomate.ui.types.HexColor (default: "#8CB400")
  • deviationBadColor : graphomate.ui.types.HexColor (default: "#FF0000")
  • spaceFactorDeviationChart : float (default: 0.25)
  • spaceFactorBaseChart : float (default: 0.5)
  • deviationPinLineBlack : boolean (default: false)
Highlight
Scaling
Outliers
Separators
Scaling Helper
Offset Bar Chart
  • showOffsetsOnLeft : boolean (default: false)
  • offsetBarDeviationLabelsOnTop : boolean (default: false)
Stacked Bar Chart
Waterfall Chart
Appearance
Aggregations:
Events:
  • elementClick : fnListenerFunction(oEvent)




Property Details

Each property "sampleProperty" can be set using the related setter "setSampleProperty". Each setter expects a valid value for the related property as input parameter and throws an exception for invalid values. It returns the "this context" for method chaining. Each property "sampleProperty" can also be gotten using the related getter method "getSampleProperty". It expects no input parameters and returns the current value of the related property. Each property that represents or partially contains indices excepts a 0 based index. Even to specify a data series that is named with "series1" for example the index 0 is expected.

  • setSampleProperty(value) - Sets the property to the passed value if valid and returns this for method chaining.
  • getSampleProperty() - Returns the current value of the property.



The Following Properties are available:

Property NameTypeDescription

chartType

graphomate.ui.charts.enums.ChartTypeSets the Chart Type of the chart.
rotatedboolean

Sets the orientation of the chart. With the value false the chart will be horizontally oriented (default orientation for temporal data) while the value true will make the chart vertically oriented (rotated orientation for structural data).

series1float[]Sets the data for the first data series as an array of floating point numbers.
series2float[]Sets the data for the second data series as an array of floating point numbers.
series3float[]Sets the data for the third data series as an array of floating point numbers.
series4float[]Sets the data for the fourth data series as an array of floating point numbers.
series5float[]Sets the data for the fifth data series as an array of floating point numbers.
series6float[]Sets the data for the sixth data series as an array of floating point numbers.
series7float[]Sets the data for the seventh data series as an array of floating point numbers.
series8float[]Sets the data for the eighth data series as an array of floating point numbers.
series9float[]Sets the data for the ninth data series as an array of floating point numbers.
series10float[]Sets the data for the tenth data series as an array of floating point numbers.
datatypes1string[]Array of strings with the same length as the first data series. Each string represents the name of the datatype matched to the related value of data series one. A datatype describes the appearance of a value in the chart and has to be defined using the global DatatypeDictionary.
datatypes2string[]Array of strings with the same length as the second data series. Each string represents the name of the datatype matched to the related value of data series one.
datatypes3string[]Array of strings with the same length as the third data series. Each string represents the name of the datatype matched to the related value of data series two.
datatypes4string[]Array of strings with the same length as the fourth data series. Each string represents the name of the datatype matched to the related value of data series three.
datatypes5string[]Array of strings with the same length as the fifth data series. Each string represents the name of the datatype matched to the related value of data series four.
datatypes6string[]Array of strings with the same length as the sixth data series. Each string represents the name of the datatype matched to the related value of data series five.
datatypes7string[]Array of strings with the same length as the seventh data series. Each string represents the name of the datatype matched to the related value of data series six.
datatypes8string[]Array of strings with the same length as the eighth data series. Each string represents the name of the datatype matched to the related value of data series seven.
datatypes9string[]Array of strings with the same length as the ninth data series. Each string represents the name of the datatype matched to the related value of data series eight.
datatypes10string[]Array of strings with the same length as the tenth data series. Each string represents the name of the datatype matched to the related value of data series nine.
seriesLabelsstring[]Array of strings, where the index refers to a data series (first string relates to data series 1, second to series 2...) and the string describes the related series. Use empty string to skip a series that should not be labeled with a description. The visibility of series labels can be adjusted using the properties "showSeriesLabelsLeft" and "showSeriesLabelsRight".
categoryLabelsstring[][]Two dimensional array of strings, where the sub arrays are different levels of category labels to realize a hierarchy. The length of the sub arrays corresponds to the number of values per data series and the length of the main array defines the number of hierarchy levels. So a value of [["A","B","A","B"],["2009","2009","2010","2010"]] defines a hierarchy with two levels, where the first level labels the data series' values wth "A" or "B" and the second level labels them with a year.
axisLabelsstring[]Array of strings, where the first string will be displayed at the left and the second one at the right side of the axis (top / bottom of the axis in vertical orientation). The visibility of axis labels can be adjusted using the properties "showAxisLabelsLeft" and "showAxisLabelsRight"
visibleSeriesint[]Array of indices refering to the data series. An empty array will result in all series being displayed. An array with the elements 0 and 2 will hide all series but the first and the third. Useful for hiding series which are only used to calculate deviations from.
showCategoryLabelsbooleanSets the visibility of all category labels.
fontSizeintSets the font size in px.
fontFamilystringSets the font family by its name (e.g.: "Arial").
fontColorgraphomate.ui.types.HexColorSets the font color of the chart's text.
labelPositioningModegraphomate.ui.charts.enums.LabelPositioningModeAdjusts the behavior of the element labels.
collisionAdjustmentgraphomate.ui.types.UnsignedIntegerSpecifies the number of pixels two element labels are allowed to overlap until one of them gets hidden when property "labelPositioningMode" is set to automatic.
basicNumberFormatstringSets the number format string of absolute numbers according to numeral.js. For example a basic number format string of "0.00a" will format the number labels to have two decimal places and to be shortened using an abbreviation.
basicNumberFormatPercentstringSets the number format string of relative numbers according to numeral.js. For example a basic number format string of "0.00%" will format the number labels to have two decimal places and to end with the percent sign as a suffix.
showSeriesLabelsLeftbooleanSets the visibility of the series labels on the left side (top for a vertical oriented chart).
showSeriesLabelsRightbooleanSets the visibility of the series labels on the right side (bottom for a vertical oriented chart).
labelFormatModegraphomate.ui.enums.LabelFormatModeSets whether the basic or the extended label format will be used for formatting the number labels.
suppressZeroLabelsbooleanSets whether the element labels of 0 values should be hidden.
suppressRepeatingCategoryLabelsboolean[]Defines in which level of the category label hierarchy repeating labels should be suppressed. Expects the following format [true,false,true] and alike, where the first boolean value relates to the first level of category labels.
showAxisLabelsLeftbooleanSets the visibility of the left axis label (top axis label in a vertical oriented chart).
showAxisLabelsRightbooleanSets the visibility of the right axis label (bottom axis label in a vertical oriented chart).
splitSignForCategoryLabelsstringSets the string that will be replaced with a new line when found in any category label.
splitSignForAxisLabelsstringSets the string that will be replaced with a new line when found in any axis label.
localegraphomate.ui.enums.LocaleSets the locale used for the formatting of number values when property "labelFormatMode" is set to basic.
categoryLabelRotationgraphomate.ui.types.RotationAngleRotates the category labels by an angle between 0 and 90 degree.
showCategoryAxisbooleanSets the visibility of the category axis.
axisThicknessintSets the thickness of the category axis in px.
fixedCategoryWidthbooleanSets whether the fixed category width set by property "categoryWidth" will be used. If set to false, the width will be calculated automatically to use the available space.
categoryWidthintSets the manual category width in px. It will only be applied, if property "fixedCategoryWidth" is enabled.
showValueAxisbooleanSets the visibility of the value axis.
flipValueAxisbooleanWhen set to true, the value axis will be displayed at the right side (at the bottom in a vertical oriented chart) instead of the default left position.
valueAxisTickDistancefloatSets the interval size of the value axis. This is an approximate value. The actual value used by the rendering logic may differ.
categoryCountgraphomate.ui.types.UnsignedIntegerSets the number of displayed categories. If a data series has more values than the specified number of categories, the remaining categories won't be displayed.
comparisonGroupstringSets a string for the global comparison group. All charts in the same Document Object Model Tree which have been assigned the same comparison group string will be scaled the same.
negativeDeviationIsGoodbooleanSwitches the usage of the colors "deviationGoodColor" and "deviationBadColor".
deviationGoodColorgraphomate.ui.types.HexColorColor used for displaying positive deviations.
deviationBadColorgraphomate.ui.types.HexColorColor used for displaying negative deviations.
spaceFactorDeviationChartfloatSets the space factor for each deviation chart. It affects the share of the available height a deviation chart will use to render (share of available width for vertical orientation). The formular for calculating the used space of a deviation chart is the following, where n is the number of deviation charts in the chart: spaceFactorDeviationChart / (n*spaceFactorDeviationChart + spaceFactorBaseChart)
spaceFactorBaseChartfloatSets the space factor for the base chart. It affects the share of the available height the base chart will use to render (share of available width for vertical orientation). The formular for calculating the used space of the base chart is the following, where n is the number of deviation charts in the chart: spaceFactorDeviationChart / (n*spaceFactorDeviationChart + spaceFactorBaseChart)
deviationPinLineBlackbooleanIf set to true, the pin line of percentage deviation charts will be displayed black according to the IBCS standard.
highlightModegraphomate.ui.charts.enums.HighlightModeSets the chart's highlight mode. Highlights are emphasized deviations between two values of special interest.
showHighlightLabelPercentagebooleanSets the visibility of percentage deviations in a highlight. If set to true, the highlight labels will include information about percentage deviation.
showHighlightLabelAbsolutebooleanSets the visibility of absolute deviations in a highlight. If set to true, the highlight labels will include information about absolute deviation.
scaleModegraphomate.ui.enums.ScaleModeSets the scale mode. In case of manual scaling the values of the properties "manualScaleMax", "manualScaleMin", "manualScalePercentMin" and "manualScalePercentMax" will apply.
manualScaleMaxgraphomate.ui.types.PositiveFloatSets the maximum value of the chart's absolute scale. Will be applied to absolute values when the property "scaleMode" causes a manual scaling.
manualScaleMingraphomate.ui.types.NegativeFloatSets the minimum value of the chart's absolute scale. Will be applied to absolute values when the property "scaleMode" causes a manual scaling.
manualScalePercentMingraphomate.ui.types.NegativeFloatSets the minimum value of the chart's percentage scale. Will be applied to percentage values when the property "scaleMode" causes a manual scaling.
manualScalePercentMaxgraphomate.ui.types.PositiveFloatSets the maximum value of the chart's percentage scale. Will be applied to percentage values when the property "scaleMode" causes a manual scaling.
outlierSizegraphomate.ui.types.UnsignedIntegerSets the outlier triangle's size in px. Outliers are chart elements representing values which exceed the chart's scale (e.g. because the chart's scale gets manipulated by the comparison group) or are forced to be displayed by specific thresholds.
useOutlierThresholdbooleanSets whether the properties "positiveOutlierThreshold" and "negativeOutlierThreshold" get applied. If set to true each value that exceeds the thresholds will be displayed as an outlier.
positiveOutlierThresholdgraphomate.ui.types.PositiveFloatPositive floating point number. Each value that exceeds the threshold will be displayed as an outlier, if the property "useOutlierThreshold" is set to true.
negativeOutlierThresholdgraphomate.ui.types.NegativeFloatNegative floating point number. Each value that exceeds the threshold will be displayed as an outlier, if the property "useOutlierThreshold" is set to true.
outlierModegraphomate.ui.enums.OutlierModeSets the outliers' style.
separatorModegraphomate.ui.charts.enums.SeparatorModeSets the mode that affects the position of separators. Separators are small vertical divider lines (horizontal divider lines in vertical chart orientation) which are displayed at the category axis to separate semantic groups of values.
separatorSourceRowIndexgraphomate.ui.types.UnsignedIntegerSpecifies the datatype series that will be used to display separators, when property "separatorMode" is set to datatypes. If it's set to categories the sourceRowIndex describes the level of category labels used for the separator positioning.
separatorPositionsgraphomate.ui.types.UnsignedInteger[]Array of indices on the category axis. An index of 0 refers to the left side of the first category, 1 refers to left side of the second category (between first and second bar in a bar chart) and so on. The indices are used to display separators, when property "separatorMode" is set to manual.
separatorLengthgraphomate.ui.types.UnsignedIntegerSets the length of separator lines in px.
separatorColorgraphomate.ui.types.HexColorSets the color of the separator lines.
separatorThicknessgraphomate.ui.types.UnsignedIntegerSets the thicknes of separator lines in px.
separatorsInFrontbooleanIf set to true, separators will have a higher z-index than the category axis.
scalingHelperModegraphomate.ui.charts.enums.ScalingHelperModeSpecifies the appearance of the scaling helper. The scaling Helper displays a value range from zero to the value defined by property "scalingHelperValue". It may help to get a feeling for the scale of two differently scaled charts when displayed in both ones or could be used to mark a threshold.
scalingHelperValuefloatThe value that will be displayed by the scaling helper.
scalingHelperAreaColorgraphomate.ui.types.HexColorSets the color of the scaling helper area (between the category axis and the scaling helper value) in scaling helper mode graphomate.ui.charts.enums.ScalingHelperMode.Area.
scalingHelperLineColorgraphomate.ui.types.HexColorSets the color of the scaling helper line, when the property "ScalingHelperMode" is set to line.
scalingHelperLineWidthgraphomate.ui.types.UnsignedIntegerSets the width of the scaling helper line in px, when the property "ScalingHelperMode" is set to line.
showOffsetsOnLeftbooleanIf set to true, the offsets in a offset bar chart will be displayed at the left side of the bars (at the top in vertical oriented charts).
offsetBarDeviationLabelsOnTopbooleanIf set to true, labels of the offsets in a offset bar chart will be placed on top of the bars (at right side in vertical oriented charts).
stackedBarSumsVisiblebooleanSets the visibility of calculated sums in a stackedbar chart.
stackedBarNegativeValuesbooleanConfigures the interpretation of negative values in a stackedbar chart. If set to true, negative values will be displayed as a negative stack under the category axis. If set to false, they will be interpreted as positive values.
stackedBarLabelPositiongraphomate.ui.charts.enums.StackedBarLabelPositionSets the position of labels in a stackedbar chart.
calcPathstring[]By defining the waterfall calculation path the appearance and the sign of each waterfall element can be controlled independently. The calcPath is an array of strings. Possible values are "+", "-", "0", "=", "s+" and "s-". Further information on the waterfall calculation path can be found in the documentation of our graphomate charts for other platforms.
waterfallPlusColorgraphomate.ui.types.HexColorSets the color of inflow values in a waterfall chart.
waterfallMinusColorgraphomate.ui.types.HexColorSets the color of outflow values in a waterfall chart.
waterfallSumColorgraphomate.ui.types.HexColorSets the color of sum values in a waterfall chart.
waterfallSpanPlusColorgraphomate.ui.types.HexColorSets the color of span inflow values in a waterfall chart.
waterfallSpanMinusColorgraphomate.ui.types.HexColorSets the color of span outflow values in a waterfall chart.
waterfallNeutralColorgraphomate.ui.types.HexColorSets the color of neutral values in a waterfall chart.
widthsap.ui.core.CSSSizeSets the width of the chart. Allowed values are CSS sizes like "250px", "10em", "50%" or "auto".
heightsap.ui.core.CSSSizeSets the height of the chart. Allowed values are CSS sizes like "250px", "10em", "50%" or "auto". Note that when a percentage value is given, the height of any of the surrounding containers must be defined. This is due to the characteristic of the html elements' height attribute which differs from the behavior of the width attribute for percentage values.
paddingintSets an inner padding for the chart in px.
spacingintSets the spacing between the base chart and the deviation chart in px.
drawBoundariesbooleanDebugging property to display internal layout borders of the chart.
barWidthgraphomate.ui.types.PositiveFloatSets the width of a chart's bars. If the value is greater than 1, it will be interpreted as px. Floating point numbers between 0 and 1 will be interpreted as relative values. The resulting width will then be a share of the category width.
pinWidthgraphomate.ui.types.PositiveFloatSets the width of pins in a pin chart. If the value is greater than 1, it will be interpreted as px. Floating point numbers between 0 and 1 will be interpreted as relative values. The resulting width will then be a share of the category width.
elementsOffsetfloatSets the offset of the data series' elements (e.g. bars) to the elements of other data series. If the value is greater than 1, it will be interpreted as px. Floating point numbers between 0 and 1 will be interpreted as percentage values relative to the category width.
pinHeadRadiusXgraphomate.ui.types.PositiveFloatSets the pixel based radius of all pin heads in x-direction.
pinHeadRadiusYgraphomate.ui.types.PositiveFloatSets the pixel based radius of all pin heads in y-direction.
lineDotRadiusXgraphomate.ui.types.PositiveFloatSets the pixel based radius of all dots of a line chart in x-direction.
lineDotRadiusYgraphomate.ui.types.PositiveFloatSets the pixel based radius of all dots of a line chart in y-direction.



Aggregation Details

We decided to use aggregation over association for all managed items of the graphomate chart because they can be bound to a model and associations can't. The disadvantage of using an aggregation is that a managed item can only be part of one aggregation. So the instance of an extendedNumberFormat for example can be part of an aggregation of chart 1 but can't be part of an aggregation of chart 2 while it is still part of chart 1.

Items of an aggregation named "sampleThings" that has a cardinality of 0...n (and a multiplicity of 1:n) can be accessed by using one of the following methods:

  • indexOfSampeThing(object) - Searches for the provided object in the aggregation and returns its 0-based index if found, or -1 otherwise.
  • getSampleThings() - Returns an array with the objects contained in the aggregation or an empty array.
  • addSampleThing(object) - Adds the provided object as last element in the aggregation. Returns this for method chaining.
  • insertSampleThing(object, index) - Inserts the provided object into the aggregation at position i. Returns this for method chaining.
  • removeSampleThing(object) - Removes the provided object from the aggregation. Returns the removed object.
  • removeAllSampleThings() - Removes all objects from the aggregation. Returns an array of all removed objects.
  • destroySampleThings() - Destroys all currently aggregated objects and clears the aggregation. Returns this for method chaining.

The Item of an aggregation named "sampleThing" that has a cardinality of 0...1 (and a multiplicity of 1:1) can be accessed by using one of the following methods:

  • getSampleThing() - Returns the current aggregated object or null.
  • setSampleThing(object) - Sets the provided object as the new aggregated object. Returns this for method chaining.
  • destroySampleThing() - Destroys the current aggregated object and clears the aggregation. Returns this for method chaining.



The following aggregations are available:

Aggregation NameAggregated Object TypeCardinalityDescription

deviations

graphomate.ui.charts.Deviation0...nThe graphomate charts enables you to set additional axes above the base chart of all chart types (next to the base chart in vertical orientation), which display the percentage or absolute deviations between two data series. Of course you can set the data series which should be used to calculate the deviation values.

highlights

graphomate.ui.charts.Highlight0...nThe highlight feature enables you to highlight the absolute or percentage difference between two elements (specific values of a defined data series). A highlight instance refers to the elements where the highlighting should start and end. Choose between a single highlighting on the side and the highlighting of multiple elements above the graph by using the property "highlightMode" of a chart. If you select single highlighting, the first element of this aggregation is displayed and all other elements are ignored.

seriesStyles

graphomate.ui.Datatype0...n

This aggregation determines the appearance of data series, as long as you do not use datatypes as they have a higher priority than series styles. The handling is similar to the definition of datatypes for the DatatypeDictionary. The name property of an datatype in this aggregation will be ignored due to internal naming.

extendedNumberFormat

graphomate.ui.ExtendedNumberFormat0...1The item of this aggregation allows you to configure the formatting of absolute number labels.
extendedNumberFormatPercentgraphomate.ui.ExtendedNumberFormat0...1The item of this aggregation allows you to configure the formatting of percentage number labels.



Event Details

The following methods exist for each event "sampleEvent":

  • attachSampleEvent(function) - Registers a listener function for the event at the Chart.
  • detachSampleEvent(function) - Deregisters the passed listener function for the event from the Chart.


elementClick(oEvent)

This event is fired when the user clicks an element of the chart - for example a bar. By using oEvent.getParameter(parameterName) you can access the event's parameters. oEvent.getParameters() returns an object containing all available event parameters.

The following parameter names are available for this event:

  • {int} 'elementIdx' - The index of the clicked element within the series
  • {int} 'seriesIdx' - The index of the series the clicked element belongs to
  • {string} 'id' - The id of the chart which fired the event