Appearance
Charts > Parallel coordinates
A chart displays multivariate data by representing each data point as a polyline connecting points on multiple parallel axes, facilitating visual analysis of relationships and patterns across dimensions.
The Chart
Download example CSV
Copy HTML
Playground
Data
Number of axes
Style
Color of axes
Color of hovered line
Use curved lines
Usage Example
vue
<template>
<ParallelCoordinates
:data="filteredData"
:dimensions="metrics"
:allow-dragging="true"
@drag="reorderMetrics"
/>
</template>
<script setup>
const orderedMetrics = ref([]);
const reorderMetrics = (arr) => {
orderedMetrics.value = [...arr];
};
</script>Component API
This chart is built using SVG and d3. Each data element (e.g. product, country, person) is a line and each axis represents a measurement.
Axes can be brushed to select lines. They can also be dragged (on axis label) to change the order.
Data
js
[
{ id: 'data-1, name: "Data 1", var1: 20, var2: 40, var3: 60 },
{ id: 'data-2, name: "Data 2", var1: 40, var2: 10, var3: 50 },
...
]Props
| Name | Default | Description | Type |
|---|---|---|---|
| data | [] | The dataset | Array |
| margin | { top: 30, right: 35, bottom: 30, left: 35 } | The margins to use on each side in px | Object |
| dimensions | [{ name: 'axis1', dir: 1, domain: [0, 100] }] | The name, direction, and domain of each axis | Array |
| color | #718096 | The color of axes | String |
| colorHover | #dd6b20 | The color of hovered line | String |
| hover | null | The data of hovered line | Object |
| highlight | [] | The lines that are highlighted | Array |
| highlightColors | [] | The colors for highlighted lines | Array |
| colorHighlightedLine | #dd6b20 | The color of highlighted line | String |
| maxNumHighlighted | 5 | The max number of lines that can be highlighted | Number |
| allowDragging | false | Whether or not to allow reordering axes | Boolean |
| curve | false | Whether or not to use curved lines | Boolean |
Events
| Name | Argument | Description |
|---|---|---|
| @hover | id | null | Emitted when line is hovered |
| @click | { data } | Emitted when line is clicked |
| @drag | Array of axes | Emitted when axis is dragged |
| @selected | Array of lines | Emitted when lines are selected with brush |
Dependencies
- d3