Table

Class graphomate.ui.tables.Table


extends sap.ui.core.Control


Quick Start

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

Usage Example
jQuery.sap.require("graphomate/ui/DatatypeDictionary");
jQuery.sap.require("graphomate/ui/tables/Table");
jQuery.sap.require("graphomate/ui/tables/enums/RowOrder");
jQuery.sap.require("graphomate/ui/enums/DeviationType");

var dtd = new graphomate.ui.DatatypeDictionary();

var table = new graphomate.ui.tables.Table({
  width: "500px",
  rowOrder: graphomate.ui.tables.enums.RowOrder.PostOrder,
  showSumBorders: true,
  sumPadding: 1.5,
  rows: [
    new graphomate.ui.tables.Row({
      title: "Monitors",
      hierarchyLevel: 0,
      dataPerColumn: [74800000, 65400000]
    }),
    new graphomate.ui.tables.Row({
      title: "North",
      hierarchyLevel: 1,
      dataPerColumn: [15400000, 15000000]
    }),
    new graphomate.ui.tables.Row({
      title: "South",
      hierarchyLevel: 1,
      dataPerColumn: [59400000, 50400000]
    }),
    new graphomate.ui.tables.Row({
      title: "Tablets",
      hierarchyLevel: 0,
      dataPerColumn: [117900000, 108400000]
    }),
    new graphomate.ui.tables.Row({
      title: "North",
      hierarchyLevel: 1,
      dataPerColumn: [70100000, 53900000]
    }),
    new graphomate.ui.tables.Row({
      title: "South",
      hierarchyLevel: 1,
      dataPerColumn: [47800000, 54500000]
    })
  ],
  columns: [
    new graphomate.ui.tables.DataColumn("column-act",{
      title: "ACT",
      datatype: "AC"
    }),
    new graphomate.ui.tables.DataColumn("column-bud",{
      title: "BUD",
      datatype: "BU"
    }),
    new graphomate.ui.tables.DeviationColumn({
      type: graphomate.ui.enums.DeviationType.Absolute,
      title: "\u0394ACT-BUD",
      measureColumnId: "column-act",
      baseColumnId: "column-bud"
    })
  ]
});



Constructor Details

new graphomate.ui.tables.Table(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:
Display
  • width : sap.ui.core.CSSSize (default: "800px")
  • height : sap.ui.core.CSSSize (default: "300px")
  • rowOrder : graphomate.ui.tables.enums.RowOrder (default: PreOrder)
  • showDatatypesInCells : boolean (default: false)
  • showDatatypesInHeader : boolean (default: true)
  • fixedHeader : boolean (default: false)
  • showFilterHelper : boolean (default: false)
Scaling
Deviations
Dividers
Labels
  • fontSize : graphomate.ui.types.UnsignedInteger (default: 14)
  • fontFamily : string (default: "Arial")
  • fontColor : graphomate.ui.types.HexColor (default: "#000000")
  • rowTitleAlignmentRight : boolean (default: false)
  • dataCellAlignmentRight : boolean (default: true)
  • basicNumberFormat : string (default: "0.0a")
  • basicNumberFormatPercent : string (default: "0.0%")
  • locale : graphomate.ui.enums.Locale (default: EN)
  • labelFormatMode : graphomate.ui.enums.LabelFormatMode (default: Basic)
  • showColumnTitles : boolean (default: true)
  • showRowTitles : boolean (default: true)
  • noWrap : boolean (default: false)
  • zeroValueReplacement : string (default: "")
  • infinityValueReplacement : string (default: "")
Hierarchy
Exceptions


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.

  • 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

width

sap.ui.core.CSSSizeSets the width of the table. Allowed values are CSS sizes like "250px", "10em", "50%" or "auto".
heightsap.ui.core.CSSSizeSets the height of the table. 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.
rowOrdergraphomate.ui.tables.enums.RowOrderControls the position of totals in a table with hierarchical data. The value PreOrder sets totals as preceeding rows and PostOrder sets them as following ones.
showDatatypesInCellsboolean Sets the color of the data column's datatype for all cells of the column and overrules all other color settings.
showDatatypesInHeader booleanIf set to true, the table header of a column is styled according to its assigned datatype.
fixedHeaderbooleanIf the table header (column titles) should be displayed permanently (even when scrolling), this can be done by activating this property.
showFilterHelperbooleanIf this property is activated, a text field appears in the upper left corner of the table. The value of this text field will be used to set a live filter on the row titles.
comparisonGroupstringSetting the comparison group string makes other tables with the same comparison group string to scale identically. Comparison Groups are used globally within the DOM. Also charts with the same comparison group are scaled identically.
manualScaleMaxgraphomate.ui.types.PositiveFloatSets the maximum data value for scaling the absolute deviation columns.
manualScaleMingraphomate.ui.types.NegativeFloatSets the minimum data value for scaling the absolute deviation columns.
manualScalePercentMaxgraphomate.ui.types.PositiveFloatSets the maximum data value for scaling the percent deviation columns.
manualScalePercentMingraphomate.ui.types.NegativeFloatSets the minimum data value for scaling the percent deviation columns.
scaleModegraphomate.ui.enums.ScaleMode

The value Auto scales the table according to the min and max values of all data. The deviation columns of several tables can be scaled identically by using the same comparison group. That way the min and max of the data basis in this group is used. With the scale mode Manual the table will use the assigned manual min and max values for scaling.

semanticAxisbooleanIf set to true, the axis of deviation columns is styled according to the datatype assigned to the data column that serves as base for the deviation calculation.
axisWidthgraphomate.ui.types.UnsignedIntegerSets the width of deviation axes in px.
deviationGoodColorgraphomate.ui.types.HexColorSets the color of positive deviations.
deviationBadColorgraphomate.ui.types.HexColorSets the color of negative deviations.
negativeDeviationIsGoodbooleanIf activated, the colors of negative and positive deviations are swapped.
showDeviationLabelsbooleanSets the visibility of deviation labels.
textualDeviationbooleanIf activated, the deviations are represented only by their labels and no deviation bars or pins are displayed.
outlierModegraphomate.ui.enums.OutlierModeSets the style of outliers. Outliers are values which exceed the range defined by the (manual or automatic) minimum and maximum value of a table's scale.
pinColorgraphomate.ui.types.HexColorSets the color of the pins. Pins are the lines of a percentage deviation column which connect the axis with the pin head and represent the displayed values with their length. To apply, the property applyPinColor must be activated.
applyPinColorbooleanIf activated, the property pinColor will be applied.
pinHeadColorgraphomate.ui.types.HexColorSets the color of the pin heads. A pin head marks the end of a deviation column's pin. To apply, the property applyPinHeadColor must be activated.
applyPinHeadColorbooleanIf activated, the property pinHeadColor will be applied.
deviationLabelSizeFactorgraphomate.ui.types.PositiveFloatAccording to IBCS the text size of the labels in the deviation columns corresponds to the text size of the data columns of the table. The default factor for this is 0.7, that means the table’s text size times 0.7 results in the text size of the deviations. This factor can be changed with this property. Please be aware that a factor lower than 0.3 or higher than 1.2 may result in wrong representations.
noClipbooleanThis option disables clipping for SVGs, a feature used to prevent pin heads to show up behind both sides of a deviation axis. This behaviour is not recommended, but necessary if you plan to deploy your table on iOS: Newer Safari versions contain a bug and therefore do not support clipping, which leads to rendering errors.
showDividersbooleanSets the visibility of the lines which divide the rows from each other.
dividerColorgraphomate.ui.types.HexColorSets the color of the lines which divide the rows from each other.
dividerThicknessgraphomate.ui.types.PositiveFloatSets the thickness of the lines which divide the rows from each other. The value is interpreted as em.
showSumBordersbooleanSets the visibility of sum borders. The sum borders will be displayed above the sum rows.
sumBorderColorgraphomate.ui.types.HexColorSets the color of sum borders.
sumBorderThicknessgraphomate.ui.types.PositiveFloatSets the thickness of sum borders in em.
sumPaddinggraphomate.ui.types.PositiveFloatAdds a padding after sum rows. The padding is interpreted as em. This is useful when rowOrder is set to "PreOrder" to separate rows of the same hierarchy level from each other.
fontSizegraphomate.ui.types.UnsignedIntegerSets the table's font size in px.
fontFamilystringSets name of the table's font family.
fontColorgraphomate.ui.types.HexColorSets the color of the table's font.
rowTitleAlignmentRightbooleanIf activated, the row title texts are aligned at the right side of their cell.
dataCellAlignmentRightbooleanIf activated, the values of data columns are aligned at the right side of their cell.
basicNumberFormatstringSets the format of the absolute values according to the guidelines of numeral.js. e.g. "0.00a" for abbreviated values with two decimal places like 2.69k
basicNumberFormatPercentstringSets the format of the percentage values according to the guidelines of numeral.js. e.g. "0.0%" for percentage values with one decimal place like 10.4%
localegraphomate.ui.enums.LocaleSets the region specific locale. The locale affects decimal and thousand separators of the basic number format as well as abreviations and enumerations.
labelFormatModegraphomate.ui.enums.LabelFormatModeIn basic mode the table uses the number formats defined by the properties "basicNumberFormat" and "basicNumberFormatPercent". In extended mode it applies the definition of aggregation elements "extendedNumberFormat" and "extendedNumberFormatPercent" to all texts.
showColumnTitlesbooleanSets the visibility of the column header titles.
showRowTitlesbooleanSets the visibility of the row titles.
noWrapbooleanIf activated, column titles and row titles are not wrapped when they are wider than their column's width.
zeroValueReplacementstringIf this property contains a value, all zeros (0) will be replaced with that value.
infinityValueReplacementstringIn JavaScript, when you divide any number by 0, the result is Infinity. If this property contains a value, all '∞' values are replaced with that value. Infinity values may be displayed at percentage deviation columns when the base of the deviation contains 0.
hierarchyIndentgraphomate.ui.types.PositiveFloatSets the indent size of the hierarchy levels in em.
collapsibleHierarchybooleanIf activated, the hierarchy nodes are collapsible and expandable and their hierarchy state markers (+,-) are displayed to click on them.
nodeStyleBoldbooleanSets whether the hierarchy node rows' texts should be bold.
nodeStyleItalicbooleanSets whether the hierarchy node rows' texts should be italic.
nodeStyleColorgraphomate.ui.types.HexColorSets the color of the hierarchy node rows' texts.
hierarchyExpansionLevelgraphomate.ui.types.UnsignedIntegerDetermines to which hierarchy level the table is initially expanded when rendering. The hierarchy level index starts with 0 (highest level). When the table contains exactly one row of hierarchy level 0 and an arbitrary amount of rows of other levels, the hierarchy structure is called a tree. A hierarchy with multiple top level nodes is called forest. When having a tree structure, a value of 0 for this property will initially render the top level node as collapsed. A forest will need a value of 1 for this property to display the top level nodes as collapsed due to internal hierarchy logic. In this case, a value of 0 would result in an empty table.
expandOnRowTitleClickbooleanIf activated, the hierarchy nodes can be collapsed and expanded by clicking on them instead of clicking on their hierarchy state marker (+,-) and the + and - won't be displayed.
exceptionPositiongraphomate.ui.tables.enums.ExceptionPositionDetermines whether the exceptions of a RowFormatConfiguration are displayed at the left side of the cell, at the left side of the value or at the right side of the value they get applied to.



Aggregation Details

We decided to use aggregation over association for all managed items of the graphomate table 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 table 1 but can't be part of an aggregation of table 2 while it is still part of table 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

rows

graphomate.ui.tables.Row0...nA list of Row instances which provide information like hierarchy level, row title and the actual data of the row. When using rows of multiple hierarchy levels, the order of rows in this aggregation must be post order or pre order. This is necessary for the table to build a nested hierarchy from the flat aggregation list. For pre order the following order is valid (described schematically, starting at top level node with hierarchy level 0): [0,1,1,0,1,1]. A non valid order would be [1,0,1,1,0,1,1].

columns

graphomate.ui.tables.DataColumn ||

graphomate.ui.tables.DeviationColumn

0...nA list of objects which are based on graphomate.ui.tables.AbstractColumn. Column objects are not essential to render a table, because the actual data is defined by the rows, but they provide information like the title, width, datatype or deviation type of a column. As Column objects do not describe the actual data reordering them will only affect column titles, datatypes and other column attributes. Defining Column objects is recommended because their Ids are used to reference columns in deviation calculations or row format configurations.
extendedNumberFormatgraphomate.ui.ExtendedNumberFormat0...1The item of this aggregation allows you to configure the formatting of absolute values within the table. It gets applied in extended number formatting mode (property "labelFormatMode").
extendedNumberFormatPercentgraphomate.ui.ExtendedNumberFormat0...1The item of this aggregation allows you to configure the formatting of percentage values within the table. It gets applied in extended number formatting mode (property "labelFormatMode").
rowFormatConfigurationsgraphomate.ui.tables.RowFormatConfiguration0...nThe RowFormatConfigurations of this aggregation define dynamic data driven rules which get applied when their condition is met. The rules can apply a special styling, datatype, number format or css statement.



Event Details

The following methods exist for each event "sampleEvent":

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


elementClick(oEvent)

This event is fired when the user clicks a data cell of the table. Cells of deviation columns are not supported. 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:

  • {string} 'id' - The id of the table which fired the event
  • {boolean} 'altKey' - Whether the alt key was pressed
  • {boolean} 'shiftKey' - Whether the shift key was pressed
  • {boolean} 'ctrlKey' - Whether the ctrl key was pressed
  • {graphomate.ui.tables.Row} 'row' - The row the clicked cell belongs to
  • {graphomate.ui.tables.DataColumn} 'column' - The column the clicked cell belongs to.
  • {float} 'value' - The value of the clicked data cell. Conveniently this value is read from the clicked row's property "dataPerColumn"