From 1699852eda023b8f8811c7c79efd5f92c5614af2 Mon Sep 17 00:00:00 2001 From: Lorenz Padberg Date: Mon, 4 Jul 2022 18:29:59 +0200 Subject: [PATCH] fixed topic line position --- .../components/circle/LearningPathDiagram.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/client/src/components/circle/LearningPathDiagram.vue b/client/src/components/circle/LearningPathDiagram.vue index 2771af7c..27fc6919 100644 --- a/client/src/components/circle/LearningPathDiagram.vue +++ b/client/src/components/circle/LearningPathDiagram.vue @@ -63,7 +63,6 @@ export default { circles() { if (this.learningPathStore.learningPath) { let internalCircles = this.learningPathStore.learningPath.circles; - // console.log(internalCircles); internalCircles.forEach((circle) => { let pieWeights = new Array(Math.max(circle.learningSequences.length, 1)).fill(1) let pieGenerator = d3.pie() @@ -101,7 +100,6 @@ export default { sky500 = '#41B5FA' let vueRouter = this.$router - console.log('this.learningpath', this.learningPathStore.learningPath) // Create append pie charts to the main svg const circle_groups = this.svg @@ -148,7 +146,7 @@ export default { const arcs = this.svg .selectAll('g') .selectAll('.learningSegmentArc') - .data((d) => {console.log('DDDD', d) + .data((d) => { return d.pieData }) .enter() @@ -178,14 +176,22 @@ export default { .call(wrap, circleWidth - 20) + function getTopicPosition(i, d, topics){ + let x =0 + for (let index=0; index < i; index++){ + x += circleWidth * topics[index].circles.length + } + return x + 30 + } + + const topicGroups = this.svg .selectAll('.topic') .data(this.learningPathStore.learningPath.topics) .enter() .append('g') .attr('transform', (d, i) => { - console.log(d) - return "translate(" + (i * circleWidth * d.circles.length + 30) + ",0)" + return "translate(" + getTopicPosition(i, d, this.learningPathStore.learningPath.topics) + ",0)" }) .style("visibility", d => d.is_visible ? "visible" : "hidden") .attr('class', 'topic')