Question: It is also required to use a MenuStrip control with the following menu items: - Output/Chart, to display the bar graph - Output/Table, to display

It is also required to use a MenuStrip control with the following menu items:    - Output/Chart, to display the bar graph    - Output/Table, to display all individual agents' data    - Output/Results, to display the results of all required calculations for the agency    - Exit, to terminate the program     If you send the rest for the code let me know. I just need help now on how to make a chart and table and show the results.
Total Sales Report Output Exit $2500000.00 $2000000.00 $1500000.00 $1000000.00 $500000.00 $0.00 TotalSales Report $2.300 000.00 $1,810 000.00 Joe Seneca $1,550,000.00 Ana Seneca Yo

using the update data btn.

private void chartMenuItem_Click(object sender, EventArgs e)
        {
            // create the chart
            Chart chart1 = new Chart();

            // Set the chart type to column
            chart1.Series.Add("Sales");
            chart1.Series["Sales"].ChartType = SeriesChartType.Column;

            // Add data points to the chart for the selected agents
            if (dataGridView1 != null && dataGridView1.SelectedRows != null)
            {
                foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                {
                    string agentName = row.Cells[0].Value.ToString();
                    Agents agent = agents.FirstOrDefault(a => a.agentname == agentName);
                    if (agent != null && agent.agentname != null)
                    {
                        chart1.Series["Sales"].Points.AddXY(agent.agentname, agent.totalsales);
                    }
                }
            }

            // Customize the chart as desired
            chart1.ChartAreas.Add(new ChartArea());
            chart1.ChartAreas[0].AxisX.Title = "Agents Names";
            chart1.ChartAreas[0].AxisY.Title = "Sales Chart";
            chart1.ChartAreas[0].AxisY.Interval = 50000000;
            chart1.ChartAreas[0].AxisY.IntervalAutoMode = IntervalAutoMode.FixedCount;
            chart1.Titles.Add("Sales Report Chart");

            // Create a new form to display the chart
            Form chartForm = new Form();
            chartForm.ClientSize = new Size(600, 400);

            // Attach the chart to the form
            chart1.Parent = chartForm;
            chart1.Dock = DockStyle.Fill;

            // Show the form
            chartForm.Show();

Total Sales Report Output Exit $2500000.00 $2000000.00 $1500000.00 $1000000.00 $500000.00 $0.00 Total Sales Report $2.300 000.00 $1,810 000.00 Joe Seneca $1,550,000.00 Ana Seneca Yo Seneca Sales Chart Figure 3: Output/Chart is selected by the user T 0 X

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 Programming Questions!