CellBorder


New to Analytica 5.0

CellBorder( type, weight, side, I, J, color)

Specifies the border style for a side (or sides) of a table cell. This function can be used from within the Cell Format Expression attribute. Please see Computed cell formats for details.

Parameters:

  • «type»: The line type used for the border, one of: 'None', 'Solid', 'Dot', 'Dash', 'DashDot', 'DashDotDot', 'Double'.
  • «weight»: The thickness of the border, either 1, 2 or 3. No effect for «type» of 'Double' or 'None'.
  • «side»: The cell side (along index «I» or «I» and «J»), one of 'Near', 'Far, 'Both', 'Outer', 'Inner', 'OuterOnly', 'ForwardDiagonal', 'ReverseDiagonal', 'Diagonals'.
  • «I» and «J»: The index(es) that «side» is relative to
  • «color»: The border color, an ARGB-integer, or a textual color name. See CellFill for a description of ARGB-integers and color names.


Analytica tables and array views can be pivoted in arbitrary ways, and cell formats are (usually) associated with the index. So instead of saying it is the right side, we would say it is the far side along index «I», where «I» is the horizontal index of the table view. If the table is pivoted so that «I» becomes the vertical index of the table, then that far border becomes the bottom border of the cell.

These screenshots show the same array pivoted, with index I as the row index on the left, and with I as the column index on the right. The yellow cell has the 'Far' border set in both cases.

If I='b' and J=2 Then CellBorder('Solid', 3, 'Far', I, color:'Red)

:CellBorder Bottom.pngCellBorder Right.png

The special identifiers VertIndex and HorizIndex can be used for the current vertical or horizontal index, so the CellBorder('Solid', 3, side:'Far', VertIndex) is always the bottom edge, even when pivoted. However, use is not common.

Borders along no-index

The row and column pivot selector can be set to none (a blank selection), in which case there is no row index or column index. This presents a problem when trying to specify the near or far border along index «I», since there is no index «I». To specify the border along the dimension that has no index, omit «I» entirely.

CellBorder('DashDotDot', 3, 'Both', color:'Blue' )

:CellBorder BlankIndex.png

This CellBorder statement will have no effect when there is a row and column index.

Specifying two indexes

For the non-diagonal «side» options, two indexes can be specified, which has the same effect as having two CellBorders, one for each index. For example,

CellFormats( CellBorder( 'Dash', 2, 'Both', I ), CellBorder( 'Dash', 2, 'Both', J ) )

is equivalent to

CellBorder( 'Dash', 2, 'Both', I, J )

:CellBorder TwoIndexes.png

Outer and Inner sides

When «side» is 'Outer', 'Inner' or 'OuterOnly', the block of cells that are in the "selected scope" interact together to determine which cells are on the outer edges of the group of cells. For example:

If 2<=J<=4 Then CellBorder('Double',,'OuterOnly',J, color:'Red')

:CellBorder OuterOnly.png

The outermost edges of the cells in the range 2<=J<=6 have the border, and the interior borders along J in that range have no borders.

The following example draws an outer border around the numbers that are divisible by 3, which creates a nice visual clustering effect.

If Mod(Self,3)=0 Then CellFormats(
      CellBorder('Solid',2,'Outer',I,J,color:0xFF00CC),
      CellFill('green',0.3),
      CellAlignment('Center')
)

:ComputedCellFormat divisibleBy3.png

Diagonals

For 'ForwardDiagonal', 'ReverseDiagonal or 'Diagonal', both indexes are required to identify the opposite corner coordinates. For example,

If @I=@J Then CellBorder('Dash', 1, 'ForwardDiagonal', I, J )

:CellBorder ForwardDiagonal.png

But in the case where the Row index or Column index is blank, then that non-index dimension is identified by omitting «J» or both.

If Self<20 Then CellBorder('Dot', 1, 'Diagonals')

:CellBorder NoIndexDiagonal.png

See Also

Comments


You are not allowed to post comments.