CS398 Final Exam Simple Graphing Tool The Simple Graphing Tool

advertisement

CS398 Final Exam

Simple Graphing Tool

The Simple Graphing Tool (SGT) will provide basic graphing capabilities for integer and floating point data. The SGT will read files containing pairs of numbers, where the first number in the pair specifies an x-coordinate, and the second number in the pair specifies the y-coordinate. A typical file might look like this:

2 4

6.8 12

9 18.3

100 200

101 231

Users will specify the data file using the File | Import menu selections. A common dialog box will be used to specify the imported file. By default, the points will be plotted as small black circles, and connected with red lines. The first point will appear on the far left-hand side of the display, and the last point will appear on the far right. If the window is resized, the graph will also resize.

There will be a margin surrounding the graph that will be specified in inches. The default margin will be ½ an inch. The margin will allow room for the x and y axis labels.

As the user moves the mouse over the graph, the mouse’s x and y coordinates (in world coordinates) will be displayed in the status bar. The cursor will be represented using a crosshair (Cursors::Cross).

A popup dialog will provide the user the ability to modify the graph parameters. The user will access the dialog via the View | Properties menu sequence. Specifically, the user will be able to:

Specify labels for the x and y axis.

Specify ranges for the x and y axis.

Specify the background color for the graph area.

Specify the color of the lines plotted.

The following sample dialog boxes show example formats. You own implementations do not need to use tabs. You may place all the fields on one dialog, or if you prefer, split them among several dialog boxes.

“First X to Plot” and “Last X to Plot” specify the range of x-coordinates to be displayed.

The specification of these values determines the logical coordinates of the display. For example, using the data in the example above, the resulting display would have an x-axis that runs from 8 to 100, and a y-axis that runs from 0 to 200.

“Plot graph with” is a radio button control that allows the user to request that the graph consist of “Lines” (which will actually be lines and small circles for the points), or

“Dots,” (which will be just the small circles.)

X and Y axis allows the user to request that the X and/or Y axis be shown or hidden.

The Labels tab allows the user to specify labels that will be written in the margins. The

X-axis label will appear centered below the graph. The Y-axis label will be written vertically in the left margin.

The colors property page provides the user with buttons for selecting a background color and a line color. Pressing either of these buttons will cause a color dialog box (from the common dialog box classes) to be displayed, allowing the user to specify a color.

The user will be able to print the graph using File | Print. The output page should have 1 inch margins. The graph should be 6 inches by 4 inches, and appear at the top left-hand side of the page.

Grading

Use of appropriate logical coordinate systems - 10%

Programming style - 10%

Graphing the data - 10%

Margins for graph - 10%

Labels for graph - 10%

Color selection - 10%

Open a file with File Common Dialog - 10%

Cross hair cursor - 5%

Scale fonts with graph size (5% extra credit)

X and Y coordinates in status bar – 10%

Allows user specified data ranges - 10%

Printing the output 10%

That’s a total of 105% without “extra credit,” and 110% with. So you can leave out something if you really want to (ala “omit”).

Hints:

You can contact me if you have questions or problems. I will be in my office most of the time this week. You can also send questions via email. You can use your book and notes, as well as the Visual Studio Development environment. You may not discuss exam questions with anyone other than me.

Download