Working Sentiments Radar Chart!!!!!

This commit is contained in:
Artorias 2025-03-20 20:27:24 +01:00
parent a9edbe8477
commit 229e0809fc
2 changed files with 6 additions and 7 deletions

View file

@ -15,8 +15,7 @@
</#if>
<#if s.nlp.sentiment??>
<#assign sentiment = s.nlp.sentiment?first>
<#if sentiment??>
<h3>Sentiments Information (als Radar Chart)</h3>
<#include "sentimentsRadarChart.ftl">
<#else>

View file

@ -1,16 +1,16 @@
<svg id="sentimentsRadarChart" width="500" height="500"></svg>
<svg id="sentimentsRadarChart" width="1000" height="1000"></svg>
<script src="https://d3js.org/d3.v6.min.js"></script>
<script>
// Retrieve sentiment values from the passed attribute "sentiment"
var sentimentData = {
pos: "${sentiment.positive}",
neu: "${sentiment.negative}",
neg: "${sentiment.neutral}"
pos: ${sentiment.positive?number},
neu: ${sentiment.neutral?number},
neg: ${sentiment.negative?number}
};
console.log("Sentiment Data:", sentimentData);
// Set up SVG dimensions and center the chart
var width = 500, height = 500;
var width = 1000, height = 1000;
var svg = d3.select("#sentimentsRadarChart")
.attr("width", width)
.attr("height", height);

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before After
Before After