If you haven't already, take a look at Example 1 before you move forward!
Let's continuing with our charting example. At this point we have created a simple bar chart. Let's make a couple of modifications. The first thing we will do is to remove the legend.
All we need to do is set the Legend.IsVisible property:
$zgc.GraphPane.Legend.IsVisible = $False
Next, let's apply some color. We will set the pane background and the Axis background with a gradient:
$zgc.GraphPane.Fill = New-Object ZedGraph.Fill([System.Drawing.Color]::WhiteSmoke,[System.Drawing.Color]::Lavender,0)
$zgc.GraphPane.Chart.Fill = New-Object ZedGraph.Fill([System.Drawing.Color]::FromArgb(255,255,245), [System.Drawing.Color]::FromArgb(255,255,190),90)
Lastly, lets add some text to the graph:
$text = New-Object ZedGraph.TextObj("Supply`nDepleted",5,30)
$zgc.GraphPane.GraphObjList.Add($text)
$arrow = New-Object ZedGraph.ArrowObj([System.Drawing.Color]::Black,10,5,26,5,15)
$zgc.GraphPane.GraphObjList.Add($arrow)
So our end result should look something like this:
#Load the zedgraph dll
$ZedGraphDll = "C:\zedgraph_dll_v5.1.5\ZedGraph.dll"
[System.Reflection.Assembly]::LoadFrom($ZedGraphDll) | out-null
# Create a WinForm to serve as a container
$global:form = new-object Windows.Forms.form
$form.Size = new-object System.Drawing.Size @(500,400)
# Create a ZedGraphControl
$zgc = new-object -typename ZedGraph.ZedGraphControl
$zgc.GraphPane.Title.Text = "Yuengling Consumption"
$zgc.GraphPane.XAxis.Title.Text = "Month"
$zgc.GraphPane.YAxis.Title.Text = "Bottles"
$xLabels = "April", "May", "June","July", "August"
$yLabels = 60, 60, 75, 70, 15
$zgc.GraphPane.AddBar("Ying",$null,$yLabels,[System.Drawing.Color]::Red)
$zgc.GraphPane.XAxis.Type = 'Text'
$zgc.GraphPane.XAxis.Scale.TextLabels = $xLabels
# Hide the legend
$zgc.GraphPane.Legend.IsVisible = $False
# Fill the pane background with a gradient
$zgc.GraphPane.Fill = New-Object ZedGraph.Fill([System.Drawing.Color]::WhiteSmoke,[System.Drawing.Color]::Lavender,0)
# Fill the Axis Background with a gradient
$zgc.GraphPane.Chart.Fill = New-Object ZedGraph.Fill([System.Drawing.Color]::FromArgb(255,255,245), [System.Drawing.Color]::FromArgb(255,255,190),90)
# Add text item to decorate the graph
$text = New-Object ZedGraph.TextObj("Supply`nDepleted",5,30)
$zgc.GraphPane.GraphObjList.Add($text)
# Add an arrow pointer for the above text line
$arrow = New-Object ZedGraph.ArrowObj([System.Drawing.Color]::Black,10,5,26,5,15)
$zgc.GraphPane.GraphObjList.Add($arrow)
# Calculate the Axis Scale Ranges
$zgc.AxisChange()
# Add our graph to the form
$Form.Controls.Add($zgc)
$zgc.dock = [System.Windows.Forms.DockStyle]::Fill
# Show the form
$Form.Add_Shown({$form.Activate()})
[void]$form.showdialog()
Till next time - Enjoy!
2 comments:
I have some spare Chesterfield I can drive out there.
Thank you so much for this post, it was very insightful! I have found a direct conversion software
Blu-ray dvd ripper helps you create Blu-ray discs from various videos for playback on any Blu-ray players. With this software, you can easily burn your videos to Blu-ray discs and AVCHD DVDs .
More info you can visit: http://besthdsoft.com/besthdsoft.com/best-hd-blu-ray-dvd-ripper.htmlMore Related Products : * blu-ray dvd ripper * blu-ray ripper * blu-ray to avi * blu-ray to mpeg * blu-ray dvd converter
Post a Comment