Skip to content
On this page

Semicircle chart ​

A chart that visually represents data as proportional segments of a half-circle, ideal for comparing values within a limited range.

Featured on:

Find

The Chart ​

Rank:

Download example CSV
Copy HTML

Playground ​

Data

Number of indicators
Number of categories

Style

Colors for areas
Color of border between areas
Stroke width of line between areas

Component API ​

The semicircle chart, built using SVG and D3, highlights a selected category (chosen at random), with its values emphasized. Hovering over other categories reveals their positions across each indicator.

Usage Example (with tooltip) ​

vue
<template>
  <SemiCircleChart
    v-if="data?.length"
    :selected-item="selectedCategory"
    @hover="setTooltip"
    :data="data"
  />

  <OTTooltip :info="tooltip">
    <div class="">
      <p class=" my-0">
        <span class="font-semibold">Rank: </span>{{ tooltip?.data?.rank }}
      </p>
    </div>
  </OTTooltip>
</template>

<script setup>
import useTooltip from "@/functions/useTooltip.js";

const [tooltip, setTooltip] = useTooltip();
const selectedCategory = ref({});
</script>

Data ​

js
[
        {
          id: "data-1",
          name: "Data 1",
          values: {
            val1: {
              id: "val1",
              name: "val 1",
              value: 100,
            },
            val2: {
              id: "val2",
              name: "val 2",
              value: 47.22838137,
            },
            val3: {
              id: "val3",
              name: "val 3",
              value: 47.00665188,
            },
            val4: {
              id: "val4",
              name: "val 4",
              value: 9.090909091,
            },
          },
        },
        ...
]

Props ​

NameDefaultTypeDescription
dataArray of indicators and categories with valuesArrayThe dataset
cornerRadius3NumberRadius of the corners for chart arcs
padAngle0.01NumberPadding angle between arcs
innerRadiusCircles6NumberInner radius of the semi-circle chart
minAngle0.3NumberMinimum angle for the arcs
duration500NumberTransition duration in milliseconds
bgColornullStringBackground color for the chart
title""StringTitle of the chart
id""StringUnique ID for the chart
indicatorsObject mapping indicator names to IDsObjectIndicator mapping object
format(d) => d.toFixed(1) + "%" FunctionFormatting function for display values
selectedItem{ id: "category_1", name: "Category 1", longName: "Category 1" }ObjectSelected category details
innerRadius0.67NumberInner radius as a proportion of outer radius
showAxestrueBooleanDisplays axes in the chart
hasHighlighttrueBooleanHighlights selected category
indexRanking1NumberRanking index to display
colorsscaleColorsArrayArray of colors for chart elements
highlightColor"#491E5D"StringColor used for highlighting
highlightWidth1NumberWidth of the highlight border

Events ​

EventArgumentDescription
@hover{ target, data }Emitted when an arc section is hovered

Dependencies ​

  • d3