Question: Assignment 4 In this assignment, we are going to display charts in a form and do some tricks with them: adding values from different sources,

Assignment 4

In this assignment, we are going to display charts in a form and do some tricks with them: adding values from different sources, changing the chart type, etc.

What to do

Your form should include at least the following:

two charts (initially bar charts, preloaded each with 3 values you invent)

a textbox in which the user can supply a number

a set of at least 4 labeled radio buttons (in a groupbox) for selecting any of four kinds of charts: bar, column, pie and at least one you choose for yourself)

a button for clearing the DataPointCollection, named "Clear"

a button for closing the form, named "Exit" or "Done"

a button named "Switch" for indicating which chart is the active one at the moment (change the value of a boolean variable to indicate Left or Right)

a button named "Value from File"

a button named "Value at Random"

a button named "Value from User"

You may also want some labels.

When the form is loaded, we should have two bar charts with 3 bars each. Read a file called Numbers.txt and store its contents in an array or List of doubles.

If one of the radio buttons is selected, the ChartType should be changed accordingly. Reset the radio button involved, as in

 RB.Checked = false; 

If the Clear button is clicked, the DataPointCollection of the Series in the chart should be cleared, as in:

 MyChart.Series["MySeries"].Point.Clear(); 

If the Switch button is clicked, the focus should shift from one chart to the other. Whatever we do affects only one chart at a time.

If the "Value from File" button is clicked, a number from the array of doubles is added as a Point. If the end of the array is reached, do nothing.

If the "Value at Random" button is clicked, generate a double value between 0.0 and 10.0 and add it as a Point. You will need the Random class and its Next method.

If the "Value from User" button is clicked, read whatever is in the textbox, convert it to a double and add it as a Point. After that, clear the textbox. (If the value in the textbox is not in the right format, you need to put up a MessageBox prompting the user to supply a double. You should handle this occurrence without the entire program crashing. (You may want to use the TryParse method.)

If the Exit button is clicked, the form should be closed.

Notes

Try to make your form look presentable. You can make the form and the charts larger or smaller. Line up the radio buttons neatly. Line up the other buttons neatly.

Decide on a color scheme and a font.

Make a copy of the file, "Numbers.txt" and put it in the bin/debug subdirectory of the directory containing your project.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!