I’m messing around with building some charts and can’t seem to get this to work no matter what I do…
$LeadData = @('99','52','45','43','43','41','38','31','2')
$EmpData = @('81','44','30','41','24','34','21','25','19')
$LabelName = @("Total Advantage", "A reduction in manual errors", "Better quality work product", "An increase in speed", "Greater levels of productivity across experience levels","Increased utilization and productivity level", "Decrease labor costs","No advantages")
$Data = @()
for ($i = 0; $i -lt $LabelName.Count; $i++) {
$Data += New-Object -TypeName psobject -Property @{lable=$LabelName[$i];lead=$LeadData[$i];emp=$EmpData[$i]}
}
$BusinessLeaders = New-UDChartJSDataset -DataProperty $Data.lead -Label 'Business Leader' -BackgroundColor yellow
$Employees = New-UDChartJSDataset -DataProperty $Data.emp -Label 'Employee' -BackgroundColor blue
$Options = @{
Type = 'horizontalbar'
Data = $Data
Dataset = @($BusinessLeaders, $Employees)
LabelProperty = $Data.lable
}
New-UDChartJS @Options
With the current code I get an error stating can’t convert -DataProperty
to System.String. Which is weird because all of the values of the $Data
array should be a string. Adding .ToString()
will load the chart but none of the data is displayed.
Does anyone have any experience building the new Charts? And could lend a stump friend a hand?