Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Structure

{mainTitle}

{subTitle}

importance secondary

importance primary

Chart Legend

importance primary

importance primary

Behavior

It is possible to produce a bar chart inside a table by adding a column, marking it with the text “Chart Legend” and adding a DimensionGroup of type bars.

...

Usage

  • Add a new “Chart Legend” column in a table style to allow for horizontal bar charts to be inserted

...

  • Chart Legendtext should be on the level of the column groups. The chart legend is then produced by merging the column group and column cells together.

    • If any chart column does not have a name set or is set to empty string (““), the chart legend will not be generated

The bars themselves are generated by placing in the chart column for each row a table which consists of two cells. One cell is the filled out bar and the other is basically the padding.

The bars start with the height defined in the configuration file setting tablechart.barheightInPt and shrink proportionally until tablechart.minimumbarheightInPt is reached.

The axis can be styled by setting tablechart.axisbordercolor and tablechart.axisborderwidth in the configuration file.

The colors are chosen from the theme specified in VerticalTableNode.theme or the configuration file. They are applied in the order they are defined in the themes section of the word template. If there are more bars than colors, the cycle continues from the beginning.

  • Bar coloring follows the defined theme. Once all colors are used, they start cycling.

  • The column width can be set by setting tableChart.chartColumnWidth in the metadata (see below on how to set metadata) or the DimensionGroup.width property

  • The last column width need to be set in percent

Table Style Metadata

Table Style Metadata Parameter

Explanation

Default

Visualization

tableChart.axisBorderColor

Defines the color of the border line between negative and positive bar chart.

This value is set in Hex.

#000000

(Black)

tableChart.axisBorderWidth

Defines the width of the border line between negative and positive bar chart.

This value is set in pt.

0.5 pt

tableChart.barHeightInPt

Defines the desired bar height in the chart. This value is only effective if no resizing (proportional shrinking) of the chart is required.

This value is set in pt.

8.50394pt

(0.3 cm)

tableChart.minimumAxisWidthInMM

Defines the minimal width of the negative and positive bar chart side.

This value is set in mm.

4 mm

Image Added

tableChart.minimumBarHeightInPt

Defines the minimum bar height in the chart. This value is guaranteed and will force the cell height to grow if necessary.

This value is set in pt.

4.25197 pt

(0.15 cm)

tableChart.minimumChartPaddingInPt

(new)

Defines the minimal vertical padding for the bar chart.

Notes:

  • Padding is achieved by adding additional row on top and bottom of the chart

  • Effect of parameter only visible if:

#bars*minimumBarHeightInPt + 2*minimumChartPaddingInPt > highest_cell_in_row

  • Bar Chart placement follows alignment settings of word channel (should ideally be set to centered). Important for cases where the effect is not visible.

  • If minimumChartPaddingInPt is set to 0 or the row’s height is set to Exactly, this parameter will have no effect

This value is set in pt.

Depends

Image AddedImage Added

chartColumnWidth

Defines string aliases to be used for the otherwise numeric chartWidth BB parameter.

This value of chartColumnWidth is an object from string to number, where the number is in % (from 2-100).

ex.:

Code Block
chartColumnWidth: {
  "narrow": 20,
  "standard": 48,
  "wide": 60
}

Note: Many table-chart BBs support the parameter chartWidth, albeit only via JSON code-view.

Behavior

The axis is positioned based on the data in the abstract report. There are four positions with a distance of 25% of the column width of eachother. If there are no negative values, the axis is placed at position 0 (i.e. to the left). If there are only negative values smaller than 25% of the total, the axis is positioned at position 1 (which is at 25% of the column width) and so forth. Please see the the examples section for concrete applications of this principle.

The formatting of the cell with the text “Chart Legend” is copied and used for formatting the produced chart legend. It is also possible to specify left and right margins in each cell beneath the “Chart Legend” cell.

ExamplesExamples

Example 1: Showing a simple case with a one bar chart

View file
nameoutput-chart_simple_case.docx
View file
nametemplate-chart_simple_case.docx
View file
nameabstract-report-chart_simple_case.json

Example 2: Showing how the values determine the axis position

View file
nameoutput-chart_axis_position.docx
View file
nametemplate-chart_axis_position.docx
View file
nameabstract-report-chart_axis_position.json

Example 3: Showing how bar colors are repeated

View file
nametemplate-chart_repeating_colors.docx
View file
nameabstract-report-chart_repeating_colors.json
View file
nameoutput-chart_repeating_colors.docx

Example 4: Showing how to change the left and right margin

View file
nameabstract-report-chart_margins.json
View file
nametemplate-chart_margins.docx
View file
nameoutput-chart_margins.docx

Example 5: Showing how to set the column width using a chartColumnWidths mapping in the metadata (JSON comment)

View file
nameabstract-report-chart_metadata_width.json
View file
nametemplate-chart_metadata_width.docx
View file
nameoutput-chart_metadata_width.docx

Example 6: Showing how to set the column width in the abstract report

View file
nametemplate-chart_abstractreport_width.docx
View file
nameabstract-report-chart_abstractreport_width.json
View file
nameoutput-chart_abstractreport_width.docx

Example 7: Various minimumChartPaddingInPt set with table bar charts with 3 and 4 charts

View file
nametemplate-word_standard.docx
View file
namebar_chart_samples.pdf
View file
namesample_ngr-3355.json