Hi,
I am unable to add the used percentage inside the doughnut chart, please help
Script
function New-FlashArrayReportPiechart() {
Param (
[string]$FileName,
[float]$snapSpaces,
[float]$usedSpace,
[float]$freespace
)
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization")
$chart = New-Object System.Windows.Forms.DataVisualization.charting.chart
$chart.Width = 700
$chart.Height = 500
$chart.Left = 10
$chart.Top = 10
$chartArea = New-Object System.Windows.Forms.DataVisualization.charting.chartArea
$chart.chartAreas.Add($chartArea)
[void]$chart.Series.Add("Data")
$legend = New-Object system.Windows.Forms.DataVisualization.charting.Legend
$legend.Name = "Legend"
$legend.Font = "Proxima Nova"
$legend.Alignment = "Center"
$legend.Docking = "top"
$legend.Bordercolor = "#FE5000"
$legend.Legendstyle = "row"
$chart.Legends.Add($legend)
$datapoint = New-Object System.Windows.Forms.DataVisualization.charting.DataPoint(0, $snapSpaces)
$datapoint.AxisLabel = "SnapShots " + "(" + $snapSpaces + " GB)"
$chart.Series["Data"].Points.Add($datapoint)
$datapoint = New-Object System.Windows.Forms.DataVisualization.charting.DataPoint(0, $usedSpace)
$datapoint.AxisLabel = "Used Capacity " + "(" + $usedSpace + " GB)"
$chart.Series["Data"].Points.Add($datapoint)
$datapoint = New-Object System.Windows.Forms.DataVisualization.charting.DataPoint(0, $freespace)
$datapoint.AxisLabel = "Free Capacity " + "(" + $freespace + " GB)"
$chart.Series["Data"].Points.Add($datapoint)
$chart.Series["Data"].chartType = [System.Windows.Forms.DataVisualization.charting.SerieschartType]::Doughnut
$chart.Series["Data"]["DoughnutLabelStyle"] = "Outside"
$chart.Series["Data"]["DoughnutLineColor"] = "#FE5000"
$Title = New-Object System.Windows.Forms.DataVisualization.charting.Title
$chart.Titles.Add($Title)
$chart.SaveImage($FileName + ".png","png")
$Script:PiechartImgSrc = ConvertTo-Base64 ($FileName + ".png")
Remove-Item -Path ($FileName + ".png")
}
Output :
I would like to get as below, used percentage in center