Appearance
Charts > Arrow Plot
The arrow plot shows a change in value with the arrow pointing right to show an increase and left for a decrease.
The Chart
Other compatible charts
Change: +NaN%
Download example CSV
Copy HTML
Playground
Animation
Duration of animation in ms
Style
Color of positive arrow
Color of negative arrow
Show grid
Show value labels next to dots
Usage Example (with tooltip)
vue
<template>
<ArrowPlot :data="data" @hover="setTooltip" />
<OTTooltip :info="tooltip">
<div>
<span class="font-semibold">Change</span>:
{{ tooltip.data.x1 > tooltip.data.x2 ? "-" : "+"
}}{{ Math.abs(tooltip.data.x1 - tooltip.data.x2) }}%
</div>
</OTTooltip>
</template>
<script setup>
import useTooltip from "@/functions/useTooltip.js";
const [tooltip, setTooltip] = useTooltip();
</script>Component API
The arrow plot is built with SVG and d3.
Data
js
[
{ id: "cat-1", name: "Category 1", x1: 20, x2: 40 },
{ id: "cat-2", name: "Category 2", x1: 80, x2: 30 },
];Props
| Name | Default | Type | Description |
|---|---|---|---|
data | [] | Array | The dataset |
colorArrowPositive | #3B82F6 | String | The color for arrows pointing right |
colorArrowNegative | #F59E0B | String | The color for arrows pointing left |
showLabels | true | Boolean | Whether or not to show value labels |
showLegend | true | Boolean | Whether or not to show legend labels |
xAxisDomain | [0, 100] | Array | The min and max value for x axis |
legendLabels | ['Pre', 'Post'] | Array | Labels for legend |
labelWidth | 100 | Number | The space for category labels on the left |
duration | 300 | Number | The total time of the animation in ms |
Dependencies
- d3