-
using
(ZedGraphControl zedGraph
=
new ZedGraphControl
(
)
)
-
{
-
//create the report
-
-
GraphPane graphPane
= zedGraph
.
GraphPane
;
-
graphPane
.
CurveList
.
Clear
(
)
;
-
-
// Set the titles and axis labels and get data
-
graphPane
.
Title
.
Text
=
"Load Heights"
;
-
graphPane
.
XAxis
.
Title
.
Text
=
" "
;
-
if
(PPLGridModel
.
Attribute
.
UnitsConvention
== PPLGridModel
.
Attribute
.
UNITS_CONVENTION
.
METRIC
)
-
{
-
graphPane
.
YAxis
.
Title
.
Text
=
"Height Meters"
;
-
}
-
else
-
{
-
graphPane
.
YAxis
.
Title
.
Text
=
"Height Feet"
;
-
}
-
-
-
zedGraph
.
RestoreScale
(graphPane
)
;
-
graphPane
.
YAxis
.
Type
= AxisType
.
Linear
;
-
graphPane
.
YAxis
.
Scale
.
Mag
=
0
;
-
graphPane
.
YAxis
.
Scale
.
MagAuto
=
false
;
-
graphPane
.
YAxis
.
Scale
.
IsUseTenPower
=
false
;
-
graphPane
.
XAxis
.
Type
= AxisType
.
Linear
;
-
graphPane
.
XAxis
.
Scale
.
Mag
=
0
;
-
graphPane
.
XAxis
.
Scale
.
MagAuto
=
false
;
-
graphPane
.
XAxis
.
Scale
.
IsUseTenPower
=
false
;
-
graphPane
.
XAxis
.
MinorGrid
.
IsVisible
=
false
;
-
graphPane
.
YAxis
.
MinorGrid
.
IsVisible
=
false
;
-
-
PointPairList points
=
new PointPairList
(
)
;
-
-
foreach
(ForceSummary fs
in loads
)
-
{
-
PointPair pp
;
-
if
(PPLGridModel
.
Attribute
.
UnitsConvention
== PPLGridModel
.
Attribute
.
UNITS_CONVENTION
.
METRIC
)
-
{
-
pp
=
new PointPair
(
0, PPLGridModel
.
Attribute
.
InchesToMeters
(fs
.
cHeightOfForceApplicationAboveGLinInches
)
)
;
-
}
-
else
-
{
-
pp
=
new PointPair
(
0, PPLGridModel
.
Attribute
.
InchesToFeet
(fs
.
cHeightOfForceApplicationAboveGLinInches
)
)
;
-
}
-
points
.
Add
(pp
)
;
-
}
-
//add the groundline
-
points
.
Add
(
0,
0
)
;
-
-
LineItem curve
= graphPane
.
AddCurve
(
"Attachment Points", points, Color
.
Blue, SymbolType
.
Star
)
;
-
curve
.
Line
.
Width
=
2
;
-
-
-
//Add the chart to the report
-
zedGraph
.
Width
=
640
;
-
zedGraph
.
Height
=
500
;
-
// signal we are done and rendering can begin
-
zedGraph
.
AxisChange
(
)
;
-
-
//get the resulting chart as a bitmap
-
Image img
= zedGraph
.
ImageRender
(
)
;
-
-
//save the bitmap to a temp file
-
String fname
=
System.IO
.
Path
.
GetTempFileName
(
)
+
".jpg"
;
-
img
.
Save
(fname
)
;
-
-
try
-
{
-
int imgWidth
=
0
;
-
int imgHeight
=
0
;
-
-
using
(
System.Drawing
.
Image bimage
= PPL_CorvusImageViewer
.
CorvusBitmap
.
FromFile
(fname
)
)
-
{
-
imgWidth
= bimage
.
Width
;
-
imgHeight
= bimage
.
Height
;
-
bimage
.
Dispose
(
)
;
-
}
-
-
MigraDoc
.
DocumentObjectModel
.
Section section
= cDocument
.
LastSection
;
-
MigraDoc
.
DocumentObjectModel
.
Paragraph paragraph
= section
.
LastParagraph
;
-
-
double printableAreaWidth
= ReportFont
.
cPageWidth
;
-
double printableAreaHeight
= printableAreaWidth
*
3.0
/
4.0
;
-
-
MigraDoc
.
DocumentObjectModel
.
Shapes
.
Image image
= paragraph
.
AddImage
(fname
)
;
-
paragraph
.
Format
.
Alignment
= MigraDoc
.
DocumentObjectModel
.
ParagraphAlignment
.
Center
;
-
double scaleWidth
= printableAreaWidth
/
(
(
double
)imgWidth
)
;
-
double scaleHeight
= printableAreaHeight
/
(
(
double
)imgHeight
)
;
-
image
.
Height
=
new MigraDoc
.
DocumentObjectModel
.
Unit
(printableAreaHeight, MigraDoc
.
DocumentObjectModel
.
UnitType
.
Inch
)
;
-
}
-
catch
{
}
-
}