Chart STL Syntax

This document describes a syntax of business graphics and associated data structures used in STL markup.

Users can use stl:chart element for creating an instance of page or inline chart.

Following chart specific attributes are supported:

 <stl:chart w="311.81pt" h="99.54pt" modern="false">
   <scd:scd xmlns:scd="http://developer.opentext.com/schemas/storyteller/chart/definition" style="font-family:Arial;font-size: 7pt;">
      <scd:plot left_offset="28.35pt" right_offset="14.17pt" top_offset="14.17pt" bottom_offset="28.35pt" logical_x_low="0" logical_x_high="100" logical_y_low="0" logical_y_high="1000"/>
      <scd:axis_x logical_position_x ="0" logical_position_y ="0" draw_behind="true"/>
      <scd:axis_y label="kWh" label_alignment="left" label_position_v="top" label_placement="end" logical_position_x ="0" logical_position_y ="0" draw_behind="true"/>
      <scd:support_lines logical_position_x ="0" logical_position_y ="0" logical_step ="100" label_placement="start" label_position_v="center" label_alignment="left" logical_width="2" draw_behind="true" mask="num.integer{}" style="font-family:Arial;font-size: 7pt;stroke-width: 0.57pt"/>
      <scd:layer type="line" xpath="//tabledata[@id='table1']" labels_offset="5" node_type="dot" node_size="2" line="stroke:rgba(0,0,0,1);stroke-width: 0.57pt;">
	    <scd:series y_column="1" x_column="2" label_column="3"/>
      </scd:layer>
   </scd:scd>
</stl:chart>   

Chart definition

Docbuilder definition of chart begins with scd:scd. In future user would use different chart definitions

scd:scd

Chart parts

Users can specify the chart parts elements:

scd:title

Users can specify following attributes

scd:legend

Users can specify following attributes

scd:plot

Users can specify following attributes

scd:axis_x, scd:axis_y

Users can specify following attributes

axis_x specific:

axis_y specific:

If no attribute is specified the axis x/y is created with default settings.

scd:support_lines

Users can specify following attributes

If no attribute is specified the support lines are created with default settings.

scd:layer

Users can specify following attributes

Attributes for a pie chart

Attributes for a line chart

Attributes for a bar chart

Subelement scd:series for data definition

Attributes:

Dynamic definition in script

Selected scd elements can be modified using stl:script :

Title - chart title

Direction - chart texts direction (‘None’, ‘L2R’, ‘R2L’)

BidiAndShaping - chart texts bidi and shaping (‘chars’, ‘forms’, ‘glyphs’)

Plot

LogicalXLow … logical low x value

LogicalXHigh … logical high x value

LogicalYLow … logical low y value

LogicalYHigh … logical high y value

MarginLeft … left margin in points

MarginRight … right margin in points

MarginTop … top margin in points

MarginBottom … bottom margin in points

var plot = require('layout').item().Plot;
plot.LogicalYHigh = 5000;

AxesX - array of X axes (zero based index)

AxesY - array of Y axes (zero based index)

LogicalPositionX … logical x value, where the axis is positioned to

LogicalPositionY … logical y value, where the axis is positioned to

LogicalXLow … logical low x value

LogicalXHigh … logical high x value

LogicalYLow … logical low y value

LogicalYHigh … logical high y value

LogicalWidth … logical width (length) of x axis line

LogicalHeight … logical height (length) of y axis line

var axis_x = require('layout').item().AxesX[0];
axis_x.LogicalPositionY = -2000;				

var axis_y = require('layout').item().AxesY[0];
axis_y.LogicalHeight = 2000;				

SupportLines - array (zero based index) of support lines definitions

LogicalPositionX … logical x value, where the axis is positioned to

LogicalPositionY … logical y value, where the axis is positioned to

LogicalXLow … logical low x value

LogicalXHigh … logical high x value

LogicalYLow … logical low y value

LogicalYHigh … logical high y value

LogicalWidth … logical width (length) of x axis line

LogicalStep … step between lines in logical coordinates

var support_lines = require('layout').item().SupportLines;
var support_line = support_lines[0];
support_line.LogicalStep = 1000;				

Chart definition in data (since 16.4)

The scd:scd structure can be defined in data. This way can be defined values with data transformation. The scd definition from data overrides definition from document. Axes, support lines or layers overrides the ones in the same order or adds new ones. Chart definition in data cannot override layer/xpath attribute and series.

<chartdata id="table1">
	<scd:scd xmlns:scd="http://developer.opentext.com/schemas/storyteller/chart/definition">
		<scd:title text="Bar Chart"/>
      	<scd:plot logical_y_high="2000"/> 
		<scd:axis_x label="year"/>
		<scd:layer type="bar"/>
	</scd:scd>				
</chartdata>
....
<stl:p class="paragraph">
	<stl:chart id="bar" w="400pt" h="320pt" xpath="//chartdata/scd:scd">
		<scd:scd>
			<scd:title text="Title in definition" style="font-size:20pt;font-style:italic"/>
			<scd:legend style="font-size:10pt;font-style:italic"/>
			<scd:axis_x label_alignment="right" label_position_v="center" label_placement="end" label="X" style="font-size:10pt;font-style:italic;stroke:rgb(255,0,0);stroke-width:3pt"/>
			<scd:layer xpath="//chartdata">
				<scd:series col_label="1" col_y="3"/>
			</scd:layer>
		</scd:scd>
	</stl:chart>
</stl:p>

Chart data

Data structure must be defined to use charts.

 <tabledata id="table1" default_style="font-family:Arial">
    <ddi:header>
       <ddi:cell data_type="number" data_style="fill:#ff0000;stroke:#ff0000">Value</ddi:cell>
       <ddi:cell data_type="number">X</ddi:cell>
       <ddi:cell>Description</ddi:cell>
    </ddi:header>
    <ddi:row>
       <ddi:cell data_style="fill:rgb(212,113,28); stroke:rgb(212,113,28); stroke-width:1.42;stroke-dasharray:1, 2">0</ddi:cell>
       <ddi:cell>7.6</ddi:cell>
       <ddi:cell label_rotation="45" label_position_h="center" data_style="font-size: 7pt;">jan-12</ddi:cell>
    </ddi:row>
</tabledata>

Main element of chart data can have default_style attribute that defines default text style for data labels.

Predefined elements use ddi namespace defined already for rigid data of interactive items: xmlns:ddi=”http://developer.opentext.com/schemas/storyteller/layout/ddi/v1”.

Elements:

ddi:header

Users defines column headers for data columns.

ddi:cell

Attributes:

ddi:row

Users defines rows of data

ddi:cell

Attributes:

Chart examples:

Try in STLEditor »

Try in STLEditor »

Try in STLEditor »

Try in STLEditor »

Modern chart that uses javascript NVD3 library and SVG rendering: Try in STLEditor »

All examples are here with results.