From 00f11fad578712f4071846c6977790ae226a3d74 Mon Sep 17 00:00:00 2001 From: "Wonko T. Sane" <42@wonko.de> Date: Fri, 6 Mar 2020 20:17:43 +0100 Subject: [PATCH] use text from data as label --- index.html | 4 ++-- src/cyclicarrow.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 0ebf93b..03597b7 100644 --- a/index.html +++ b/index.html @@ -60,9 +60,9 @@ .append('text') .append("textPath") .attr("xlink:href", "#path905") //place the ID of the path here - .style("text-anchor", "middle") //place the text halfway on the arc + .style("text-anchor", "middle") .attr("startOffset", function (d) { return arrgen.center(d) }) - .text('blah') + .text(function (d) { return d.value }) .attr("font-family", "sans-serif") .attr("font-size", "10") .attr("fill", "black"); diff --git a/src/cyclicarrow.js b/src/cyclicarrow.js index a258aaf..e0dd9f4 100644 --- a/src/cyclicarrow.js +++ b/src/cyclicarrow.js @@ -14,6 +14,7 @@ export default function () { for (var i = 0; i < fractions; i++) { segments[i] = { index: i, + value: data[i], start: i * seg, end: (i + 1) * seg } -- GitLab