Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization")
- $outputpath=$env:USERPROFILE
- # chart object
- $chart1 = New-object System.Windows.Forms.DataVisualization.Charting.Chart
- $chart1.Width = 1024*2
- $chart1.Height = 1024
- $chart1.BackColor = [System.Drawing.Color]::White
- # title
- [void]$chart1.Titles.Add("User logon times")
- $chart1.Titles[0].Font = "Arial,13pt"
- $chart1.Titles[0].Alignment = "topLeft"
- # chart area
- $chartarea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea
- $chartarea.Name = "ChartArea1"
- $chartarea.AxisY.Title = "Seconds"
- $chartarea.AxisX.Title = "Date"
- $chartarea.AxisY.Interval = 10
- $chartarea.AxisX.Interval = 7
- $chart1.ChartAreas.Add($chartarea)
- # legend
- $legend = New-Object system.Windows.Forms.DataVisualization.Charting.Legend
- $legend.name = "Legenda"
- $chart1.Legends.Add($legend)
- <#
- # data source
- $datasource = Get-Process | sort PrivateMemorySize -Descending | Select-Object -First 5
- # data series
- [void]$chart1.Series.Add("VirtualMem")
- $chart1.Series["VirtualMem"].ChartType = "Column"
- $chart1.Series["VirtualMem"].BorderWidth = 3
- $chart1.Series["VirtualMem"].IsVisibleInLegend = $true
- $chart1.Series["VirtualMem"].chartarea = "ChartArea1"
- $chart1.Series["VirtualMem"].Legend = "Legend1"
- $chart1.Series["VirtualMem"].color = "#62B5CC"
- $datasource | ForEach-Object {$chart1.Series["VirtualMem"].Points.addxy( $_.Name , ($_.VirtualMemorySize / 1000000)) }
- # data series
- [void]$chart1.Series.Add("PrivateMem")
- $chart1.Series["PrivateMem"].ChartType = "Column"
- $chart1.Series["PrivateMem"].IsVisibleInLegend = $true
- $chart1.Series["PrivateMem"].BorderWidth = 3
- $chart1.Series["PrivateMem"].chartarea = "ChartArea1"
- $chart1.Series["PrivateMem"].Legend = "Legend1"
- $chart1.Series["PrivateMem"].color = "#E3B64C"
- $datasource | ForEach-Object {$chart1.Series["PrivateMem"].Points.addxy( $_.Name , ($_.PrivateMemorySize / 1000000)) }
- #>
- [void]$chart1.Series.Add("LogonTime")
- $chart1.Series["LogonTime"].ChartType = "Column"
- $chart1.Series["LogonTime"].BorderWidth = 3
- $chart1.Series["LogonTime"].IsVisibleInLegend = $true
- $chart1.Series["LogonTime"].chartarea = "ChartArea1"
- $chart1.Series["LogonTime"].Legend = "Legenda"
- $chart1.Series["LogonTime"].color = "#62B5CC"
- $DataSet.Tables[0] | ForEach-Object {$chart1.Series["LogonTime"].Points.addxy( $_.EasyDate , $_.InteractiveDesktop) }
- # save chart
- $chart1.SaveImage("$outputpath\SplineArea.png","png")
- Start-Process "C:\Program Files\Internet Explorer\iexplore.exe" -ArgumentList "$outputpath\SplineArea.png"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement