hello,
I would love to see annotations as a feature in the New-UDChart.
This thread gives some more information about this request:
I tried this on my own but I think as the ChartJS plugin “Chartjs-plugin-annotation” is not installed its not working:
$UDDashboard = New-UDDashboard -Content {
$Data = @(
1..20 | %{
[PSCustomObject]@{
Timestamp = (Get-Date).AddMinutes($_ *-1)
Value = (Get-Random -Minimum 1 -Maximum 10)
}
}
)
$Annotation = "{
drawTime: 'afterDatasetsDraw',
annotations: [{
type: 'line',
mode: 'vertical',
scaleID: 'x-axis-0',
value: '$((Get-Date).AddMinutes(-10))',
borderColor: 'green',
borderWidth: 1,
label: {
enabled: true,
position: 'center',
content: 'test'
}
},{
type: 'line',
mode: 'horizontal',
scaleID: 'y-axis-0',
value: '$((Get-Date).AddMinutes(-10))',
borderColor: 'green',
borderWidth: 1,
label: {
enabled: true,
position: 'center',
content: 'test'
}
}]
}" | ConvertFrom-Json
New-UDChart -Title "Chart" -Type Line -Endpoint {
$Data | Out-UDChartData -LabelProperty "Timestamp" -DataProperty "Value"
} -Options @{legend = @{display = $false}; elements = @{point = @{radius = 0}; annotation = $Annotation}}
}
Start-UDDashboard -Dashboard $UDDashboard -Port 10000
In my opinion a good implementation in New-UDChart would be a optional parameter “Annotations” which expect objects of the command “New-UDChartAnnotation”
New-UDChartAnnotation
-Type (vertical/horizontal)
-Text
-Value (x or y axis depends on Type)
-(optional) Color, Border, …
PS: I love this project