Home and Learn: Intermediate Programming
Excel Chart Project: For C# and VB NET Students
We finished with the coding of a our chart in the previous lesson. Now we'll start the formatting. This is all done through the Property pages of charts (though you can do it with code). We'll start with the chart lines.
You can change the color of the line and the thickness. But it's easier to do this via the properties area.
Switch back to Design View in Visual Studio. Click on your chart to highlight it. Now locate the Series property:
This is a Collection. So click small the button to bring up the Series Collection Editor. Now locate the Color property:
Change it to anything you like. We've gone for an orange color.
To make the series line a bit thicker, change the BorderWidth property (just above Color) to 3:
So that your Series doesn't stay on the default text of Series 1, you can change it to something more appropriate. Scroll down and locate the LegendText property. Change it to Sales:
A Marker is a data point indicator that is used to join your lines. If that's not too clear, scroll down the Series Collection Editor and locate the Marker category. Click the arrow to reveal a dropdown list of Marker styles you can use:
The one highlighted in the image above is Square. But Circle looks better. But choose any you Marker like.
You can change the color of the Marker, as well. Change the MarkerColor property to anything you like:
Run your program to test it out. Here's a chart with a couple of items highlighted:
We'll do some more formatting on the Series box later. In the next lesson, we'll format the background and add some titles.
Back to the Intermediate Programming Contents Page
Email us: enquiry at homeandlearn.co.uk