${label}
${Math.round(
parseFloat(data.percentValue)
)}%
`;
},
transition: "",
},
theme: {
noData: {
fontFamily: "Inter",
fontWeight: "bold",
},
series: {
colors: data.series.map((sereItem) => sereItem.color),
dataLabels: {
fontFamily: "Inter",
useSeriesColor: false,
color: "#3d3d3d",
callout: {
lineWidth: 3,
useSeriesColor: true,
},
pieSeriesName: {
useSeriesColor: true,
fontFamily: "Inter",
fontSize: 5,
textBubble: {
visible: false,
paddingX: 1,
paddingY: 1,
shadowOffsetX: 0,
shadowOffsetY: 0,
shadowBlur: 0,
},
},
},
},
},
};
window.pieChart = ToastChart.pieChart({
el: rootElement,
data: data,
options: options,
});
window.addEventListener("resize", function () {
window.pieChart.resize({
width: rootElement.parentElement.offsetWidth,
height: rootElement.parentElement.offsetHeight,
});
});
};
window.initLineChart = function (rootElement, title, values, last10Days) {
const categories = values.map((item) => item.label);
const data = {
categories: categories,
series: [
{
data: values.map((item) => item.value),
name: "(sehr) zufriedene Mitarbeiter (Top 2)",
},
{
data: [
{
x: categories[categories.length - 1],
y: last10Days,
},
],
name: "Letzte 10 Tage",
},
],
};
const options = {
lang: {
noData: "Keine Daten",
},
yAxis: {
scale: {
min: 0,
max: 100,
stepSize: 20,
},
},
dashSegments: true,
chart: {
title: title,
width: rootElement.parentElement.offsetWidth,
height: rootElement.parentElement.offsetHeight,
},
series: {
showDot: true,
dataLabels: {
visible: true,
offsetY: -15,
anchor: "center",
formatter: (value) => Math.round(value) + "%",
},
type: "percent",
},
legend: {
align: "bottom",
showCheckbox: false,
visible: true,
},
tooltip: {
offsetX: 0,
offsetY: -30,
template: (model) => {
const data = model.data[0];
const label =
data.label === "Letzte 10 Tage"
? data.label
: data.category;
return `