Fine tune column chart asp.net c#

There are 4 items numbered 1 through 4 on the attached image. I hope to be able to do them by revising the code below:

Question: Could you please review to see if all or some of them doable?

Thank you.
    protected void Page_Load(object sender, EventArgs e)
    {
            var chartImage = new Chart();
            chartImage.Width = 600;
            chartImage.Height = 400;

            //chartImage.Titles.Add("Sample Chart");
            chartImage.Series.Add("Decade");
           // chartImage.Legends.Add(chartImage.Series[0].Name); // optional, show legend

            // add data points
            object[] xValue = { "1970", "1980", "1990", "2000", "2010" };
            object[] yValues = { "9", "22", "52", "89", "123" };
            for (int x = 0; x < xValue.Length; x++) {
                chartImage.Series[0].Points.AddXY(xValue[x], yValues[x]);} // may need to cast to double, if "option strict"
 
            chartImage.ChartAreas.Add("chartArea0"); // always need to add this
            chartImage.ChartAreas[0].AxisX.Title = "Decade"; // optional, show axis x title
           // chartImage.ChartAreas[0].AxisY.Title = "Incidence"; // optional, show axis y title
            chartImage.ChartAreas[0].AxisX.LabelStyle.Angle = 90;
            chartImage.ImageStorageMode = ImageStorageMode.UseImageLocation; // avoid having to define http handler for now, simpler for quick testing
            this.Controls.Add(chartImage); // add to page for automatic rendering
        }

Open in new window

ColumnChart.png
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert SchuttSoftware EngineerCommented:
Give these a try:
            // 1 don't show grid
            chartImage.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
            chartImage.ChartAreas[0].AxisY.MajorGrid.Enabled = false;

            // 2 remove y labels?
            chartImage.ChartAreas[0].AxisY.LabelStyle.Enabled = false;

            // 3 show value
            chartImage.Series[0].IsValueShownAsLabel = true;
            chartImage.Series[0].LabelForeColor = System.Drawing.Color.Blue;

            // 4 rotate x labels
            chartImage.ChartAreas[0].AxisX.LabelStyle.Angle = 90;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi Rober,

Thank you very much for the very good solution you gave to me. As shown on the attached image:

1. The border for ChartAreas[0] is also eliminated in removing the major axis. I tired to use the line below but it didn't work:
chartImage.ChartAreas[0].BorderColor = System.Drawing.Color.DeepPink;

2. Is it possible to remove the y-axis graduation as well?

Regards,

Mike
ColumnChart2.png
0
Robert SchuttSoftware EngineerCommented:
Try this:
1. Besides setting BorderColor, also set (not really sure why...):
chartImage.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid;

Open in new window

2. What you call graduation is called tick marks:
chartImage.ChartAreas[0].AxisY.MajorTickMark.Enabled = false;

Open in new window

0
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you very much for the solution.

I have a follow up question if you have a couple of minutes (in your case probably couple of second because you seem to be very comfortable with the subject).

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28490290.html

Regards,

Mike
0
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.