Lines and Markers

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:

The Series property in Visual Studio

This is a Collection. So click small the button to bring up the Series Collection Editor. Now locate the Color property:

The Series Collection Editor showing the Color item highlighted

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:

The Series Collection Editor showing the BorderWidth item highlighted

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:

The Series Collection Editor showing the LegendText item highlighted

Adding Markers

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 Series Collection Editor showing the MarkerStyle item highlighted

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:

The Series Collection Editor showing the MarkerColor item highlighted

Run your program to test it out. Here's a chart with a couple of items highlighted:

A char showing the Marker and Series 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.

Chart Backgrounds, Titles >>

Back to the C# NET Contents Page

Back to the VB NET Contents Page