Please enable JavaScript to view this site.

Altova MobileTogether Designer

This topic contains simple examples to illustrate how chart data selection works.

 

 

Chart data selection with four XPath expressions

The screenshot below shows the Chart Configuration dialog, at the bottom of which is the Chart Data Selector pane with fields for entering the four XPath expressions for data selection.

ChartsSimpleChartsXPaths

The four XPath expressions in the Chart Data Selector pane work together and do the following:

 

XPath

Description

For-Each

Sets the context for the other three XPath expressions

Sets the number of items in the returned sequence as the number of ticks on the X-Axis.

In the case of the screenshot above, the Region[1]/Year expression returns six node items; so there will be six ticks on the X-Axis (see screenshot below).

X-Axis

The items in the returned sequence provide the label text for the corresponding ticks on the X-Axis.

In the example shown above, the @id expression returns the id attribute value of each Year element. These values become the labels of the corresponding ticks (see screenshot below).

Since we have specified that this will be a bar chart, bars are drawn at the ticks.

Y-Axis

The Y-Axis can display multiple series, each of which is defined in one row of the Y-Axis table.

Each series is defined by two XPath expressions: one for the series value, the other for the series name.

In our example, the self::node() XPath expression (indicated by its abbreviated form of a period) selects the current node, which is the Year element that is the context node. So, for each Year element (represented by a bar on the X-Axis), the Year element's content will be read as the Y-Axis value of that year, and therefore plotted as the height of the bar (see screenshot below). The screenshot further below shows a chart with multiple series on the Y-Axis.

Series name

This expression provides the legend text for the series. In our example, the legend text (which appears at the bottom of the chart, screenshot below) is obtained from an XPath expression that is a text string (see screenshot above).

 

A bar chart that is generated for the data selection shown in the screenshot above and the XML data in YearlySales.xml looks like the chart in the screenshot below.

ChartsSimple01

The screenshot above shows a bar chart with a single series, while that below is of a stacked bar chart with multiple series. In the latter example, the value of each series is stacked on to the bar.

ChartsSimple02

The XPath expressions of this chart are shown in the screenshot below.

ChartsSimpleChartsXPaths02

Note:Pie charts and gauge charts have a single nominal series, which requires no name. So if a series name is entered in the data selection, it is ignored. For ungrouped bar charts, however, the name of the single series, if present, is used for the legend. For gauge charts, in addition to any Series Name entry being ignored, the X-Axis data selection is also ignored; only the Y-Axis selection is used for gauge charts.

 

© 2019 Altova GmbH