Chapter 19: Standard Controls

 

Overview

Most programmers enjoy creating plotting routines because they deliver so much bang for the buck. It s one thing to calculate analysis data for a user, and another to plot the data so the user can see the data trends visually. The visual display wins every time.

In this section we take a file from the Keeping Track series, WeeklyNetWorth.dta, and plot it on the screen. The X axis (horizontal) is Weeks of the Year, and the Y axis (vertical) is $$. This plot has some limitations:

  • Only the last 52 weeks of data is plotted. The file WeeklyNetWorth.dta contains data from the 44th week in 2003 to the 11th week in 2005, but it will only plot data from the 11th week of 2004 to the 11th week of 2005 (the latest 52 weeks in the file).

  • The code shown here is a subset of the plotters in the Keeping Track suite; this code plots the net worth of a financial portfolio only; the complete code in Keeping Track plots both the weekly net worth and the weekly net gain (present value “ original cost) as two separate plots.

Most PC graphics cards used in conjunction with Microsoft operating systems allow four pixel settings on the screen:

  • 800 x 600 (coarsest setting)

  • 1024 x 768

  • 1280 x 1024

  • 1600 x 1200 (finest setting)

The programmer must be sure that the plot she creates will fit on the screen, so one assumes that the coarsest setting will be used on the user s PC. We have already mentioned that the Visual Studio C# compiler makes provision in its software to place each window in the center of the screen, but it does not provide for a variable number of pixels in length and height of a window. So as the user moves from the most coarse setting to the finest setting, the window becomes smaller and smaller on the screen.

Some portion of the screen area must be used to list the X and Y coordinates of the plot (below and to the left of the plot). At the coarsest 800 x 600 setting, the maximum plot size is about 600 pixels wide x 450 pixels high; these are the numbers used in this plot.

 


Unlocking Microsoft C# V 2.0 Programming Secrets
Unlocking Microsoft C# V 2.0 Programming Secrets (Wordware Applications Library)
ISBN: 1556220979
EAN: 2147483647
Year: 2005
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net