### The XY Dataset

An XY Dataset plots pairs of values as points on the chart. The XY charts have two numeric axes.

If the dataset is arranged by column, each row is expected to have three columns. Each row is assumed to represent one data point on the chart, ordered by the series name and domain value. The first column's values contain the name of the series. The second column is numeric, containing the domain value of the data point. The third column is numeric, containing the range value of the data point.

If the dataset is arranged by row, each row is expected to contain all the data points for the series. The first column's values contain the name of the series. It is assumed the other columns in the row consist of a collection of x/y data points (i.e. columns 2, 4, 6 etc. will be domain values, and columns 3, 5, 7 etc will be range values).

### A Column-based Dataset Example

Here is a query and dataset from the Pentaho sample data that demonstrates a column-based XY dataset:

Select PRODUCTLINE, MSRP, BUYPRICE FROM PRODUCTS order by PRODUCTLINE

This query results in the following dataset (the data has been truncated to save space):

PRODUCTLINE |
MSRP |
BUYPRICE |
---|---|---|

Classic Cars |
101.15 |
46.53 |

Classic Cars |
80.84 |
32.33 |

Classic Cars |
118.28 |
69.78 |

Classic Cars |
140.43 |
98.3 |

Classic Cars |
107.08 |
62.11 |

... |
||

Motorcycles |
81.36 |
34.17 |

Motorcycles |
102.05 |
56.13 |

Motorcycles |
40.23 |
24.14 |

Motorcycles |
99.89 |
66.92 |

... |
||

Planes |
49.66 |
32.77 |

Planes |
74.03 |
36.27 |

Planes |
80 |
54.4 |

Planes |
118.65 |
59.33 |

Planes |
99.72 |
68.8 |

... |

Handing this dataset to a chart, the chart will plot the data by column by default. Here is a bar chart example:

To plot the data by rows, you must add the by-row property to the action sequence component definition. (You can set this property in the Design Studio by checking the **Chart Row Dimension** checkbox.)

<by-row>true</by-row>

Here is a bar chart example, with the same dataset plotted by rows: