Product: PowerShell Universal
Version: 5.5.1
Hello all, I’m currently struggling with getting data labels to show up with using New-UDChartJS. Does anyone know of a way to get data labels to display on bar charts?
Here’s my code that I’m working with:
New-UDChartJS -Type 'Bar' -Data $groupedData -Dataset @($currentDataset, $averageDataset) -LabelProperty 'Label' -options @{
plugins = @{
tooltip = @{
mode = 'nearest'
intersect = $true
}
legend = @{
labels = @{
font = @{
weight = 'bold'
}
}
}
}
}
According to the Chart.js documentation, there should be a plugin called datalabels. However, when I add in the plugin there is no change. Here’s what I tried:
New-UDChartJS -Type 'Bar' -Data $groupedData -Dataset @($currentDataset, $averageDataset) -LabelProperty 'Label' -options @{
plugins = @{
tooltip = @{
mode = 'nearest'
intersect = $true
}
legend = @{
labels = @{
font = @{
weight = 'bold'
}
}
}
datalabels = @{
anchor = 'end'
align = 'top'
formatter = [math]::Round
}
}
}
From what I’ve read it looks like that plugin needs to be registered so I’m not sure how that integrates with PS Universal. Has anyone had much luck with this? I understand that the Nivo charts have this in by default, but I don’t like how the graphs look and I haven’t had much luck creating a chart with multiple datasets.