WorkbookToGraph
(
Single workbookX,
Single workbookY
)
{
AssertValid();
// The WPF y-axis increases from top to bottom, but the NodeXL y-axis
// increases from bottom to top. Hide this from the user by flipping
// y-axis values here and in GraphToWorkbook().
workbookY = MaximumXYWorkbook - workbookY;
Single fGraphX =
m_oGraphRectangle.Left + (workbookX - MinimumXYWorkbook) *
m_oGraphRectangle.Width / WorkbookRange
;
fGraphX = Math.Max(fGraphX, m_oGraphRectangle.Left);
fGraphX = Math.Min(fGraphX, m_oGraphRectangle.Right);
Single fGraphY =
m_oGraphRectangle.Top + (workbookY - MinimumXYWorkbook) *
m_oGraphRectangle.Height / WorkbookRange
;
fGraphY = Math.Max(fGraphY, m_oGraphRectangle.Top);
fGraphY = Math.Min(fGraphY, m_oGraphRectangle.Bottom);
return ( new PointF(fGraphX, fGraphY) );
}