0
임이 조금 문제가 있습니다. 다음과 같이 달성하려고합니다. http://www.codeproject.com/Articles/168056/Windows-Charting-Application 페이지의 첫 번째 차트. 여기 내 코드Powershell 그룹 값 Winforms 차트
### Load assemblies
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization")
$Servers = Get-XAWorkerGroup -WorkerGroupName Agresso | select servernames -ExpandProperty servernames
$SessionTable = @()
foreach ($Server in $Servers) {
$ActiveSessions = (Get-XASession -ServerName $Server | ?{$_.State -eq "Active"}).Count
$DisconnectedSessions = (Get-XASession -ServerName $Server | ?{$_.State -eq "Disconnected"}).Count
$ListeningSessions = (Get-XASession -ServerName $Server | ?{$_.State -eq "Listening"}).Count
$LoopArray = "$Server,$ActiveSessions,$DisconnectedSessions,$ListeningSessions"
$SessionTable += $LoopArray
}
### CREATE CHART
$Chart = New-object System.Windows.Forms.DataVisualization.Charting.Chart
$Chart.Width = 1600
$Chart.Height = 400
$Chart.Left = 10
$Chart.Top = 10
# create a chartarea to draw on and add to chart
$ChartArea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea
$Chart.ChartAreas.Add($ChartArea)
foreach ($server in $SessionTable) {
$Splitted = $Server.Split(",")
$Name = $Splitted[0]
$Active = $Splitted[1]
$Disconnected = $Splitted[2]
$Listening = $Splitted[3]
[void]$Chart.Series.Add($Name)
$dp1 = new-object System.Windows.Forms.DataVisualization.Charting.DataPoint(0,$Active)
$dp2 = New-Object System.Windows.Forms.DataVisualization.Charting.DataPoint(0,$Disconnected)
$dp3 = New-Object System.Windows.Forms.DataVisualization.Charting.DataPoint(0,$Listening)
$dp1.Color = "Blue"
$dp2.Color = "Red"
$dp3.Color = "Orange"
$dp1.AxisLabel = $Name + " Active"
$dp2.AxisLabel = $Name + " Disconnected"
$dp3.AxisLabel = $Name + " Listening"
$Chart.Series[$Name].Points.Add($dp1)
$Chart.Series[$Name].Points.Add($dp2)
$Chart.Series[$Name].Points.Add($dp3)
$ChartArea.AxisX.LabelStyle.Angle = "-90"
$ChartArea.AxisX.LabelStyle.Interval = "1"
}
$title = new-object System.Windows.Forms.DataVisualization.Charting.Title
$Chart.Titles.Add($title)
$Chart.Titles[0].Text = "Testing"
$Chart.Titles[0].Font = New-Object System.Drawing.Font("arial",20,[System.Drawing.FontStyle]::Bold)
### Show on form
$Chart.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right -bor
[System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
$Form = New-Object Windows.Forms.Form
$Form.Text = "Testing form"
$Form.Width = 1400
$Form.Height = 820
$Form.controls.add($Chart)
$Form.Add_Shown({$Form.Activate()})
$Form.ShowDialog()
해야하지만 내 출력은 내가 출력이 내 경우에는 그래서, 상단에 링크 된 하나처럼되고 싶어이
과 같습니다 서버 이름 3 개 결합 값 다른 세션. 값이 6, 7, 0 인 Server1 예 : 희망 사항을 달성하기를 희망합니다. : D
내가 내 결과이 같이 밝혀 코드를 사용하는 경우 : https://gofile.me/2q0zW/MofWSb9p 내가 변화하는 유일한 것은 내가 알고 – user2782999
: 전에처럼 사용 내 서버에 입력된다 조금 늦었 어. 그러나 네가 보여 주신 그 사진은 그것이 어떻게 드러나는가입니다. 나는 여러 가지 일을 시도했지만, 당신이 원하는 것에 다가 갈 수있는 방법을 찾지 못했습니다. 또한 코드 프로젝트 샘플과 관련하여 해당 게시물에서 참조한 게시물과 그래프에 링크했습니다. 그래프는 4 개의 다른 계열에 대한 것이지 단일 계열의 데이터에 대한 것이 아닙니다. 시리즈가 구축되는 방식 때문에 그럴 수 있다고 생각합니다. – sqlchow