Microsoft Chart Object in Report - Formatting Line Weights (1 Viewer)

Daveyk01

Registered User.
Local time
Today, 15:11
Joined
Jul 3, 2007
Messages
144
I am a bit rusty. Using a Microsoft Chart Object 6.0 in an Access 2010 report. It's easy enough to do the basics and that chart responds to data.

In my case, I have 12 lines, or columns, being controlled by data. It responds to the data. just fine. What I want to do is control the line weight and colour of each line through VBA.

You can click on the chart itself on the report form, but formatting the line you actually want is almost impossible. Pretending we can, you get the pop-up configuration windows and the TAB "PATTERNS". Under that, you can select "LINE" and then choose the style, color and weight. This is what I need to do in VBA.

Lines like this do not work:
Graph_Data.Columns("A").Line.Weight = 5
or...
objDataSheet.Columns("A").Line.Weight = 5​

I tried a variety of versions of that and am pulling my hair out.

I am hoping someone on here has experience formatting a chart object through VBA in Access.

Thanks kindly,

Dave
 

JHB

Have been here a while
Local time
Tomorrow, 00:11
Joined
Jun 17, 2012
Messages
7,732
Sorry - NO so easy isn't it. :)
Set the first line to color red:
Code:
  Me.NameOfYourGraph.SeriesCollection(1).Border.Color = 255
 

JHB

Have been here a while
Local time
Tomorrow, 00:11
Joined
Jun 17, 2012
Messages
7,732
And here how to change the line weight.
Code:
 Me.NameOfYourGraph.SeriesCollection(1).Border.Weight = 4
Weight = 4
 

Daveyk01

Registered User.
Local time
Today, 15:11
Joined
Jul 3, 2007
Messages
144
And here how to change the line weight.
Code:
 Me.NameOfYourGraph.SeriesCollection(1).Border.Weight = 4
Weight = 4

Wonderful! That worked perfect. Is there a list somewhere that shows all available controllable graph options? My help file does not work well. Such as change a line to dashes, dots, smooth, ect. When you have a chart with 18 lines, it is easier to do it in VBA that clicking on the line you want in edit mode.

Would it be possible to change the color of just one section of a line, like between two points. Maybe one point is out of a given tolerance and you want to show that in red (in my case, now, I don't need this, but I can see this need elsewhere).

Again, thanks kindly JHB, you came through for me!

Dave
 

JHB

Have been here a while
Local time
Tomorrow, 00:11
Joined
Jun 17, 2012
Messages
7,732
... Is there a list somewhere that shows all available controllable graph options?
..
Again, thanks kindly JHB, you came through for me!
Graph object isn't the easiest to work with in MS-Access, because many of the properties isn't visible. I'm not aware of such a list!
Would it be possible to change the color of just one section of a line, like between two points.
I don't think it is possible, but if you could do it on a graph object in Excel, then ... there must be a way! :)
 

Daveyk01

Registered User.
Local time
Today, 15:11
Joined
Jul 3, 2007
Messages
144
Yea, I am stumbling across a few options, like Border.LineStyle = 1 <- Don't know what make a dashed line and other options (yet).

Figured this one out: Border.Color = 255

Trial an error, but I didn't figure out what you gave me! lol

Can you selectively remove a line from the legend but not the line from the graph? For example, I might have a graph with two RED limit lines, but I really only need one line in the legend stating "LIMITS". Not the end of the world, just looking for perfection.
 

Daveyk01

Registered User.
Local time
Today, 15:11
Joined
Jul 3, 2007
Messages
144
With 16 data lines letting the line color to automatic as data lines 11 and 12 virtually the same color. I can not distinguish the lines from one another. Now to find 16 unique colors.....
 

JHB

Have been here a while
Local time
Tomorrow, 00:11
Joined
Jun 17, 2012
Messages
7,732
..
Can you selectively remove a line from the legend but not the line from the graph? For example, I might have a graph with two RED limit lines, but I really only need one line in the legend stating "LIMITS".
I'm not quite sure what you exactly mean, can show a printscreen of what you want?
 

JHB

Have been here a while
Local time
Tomorrow, 00:11
Joined
Jun 17, 2012
Messages
7,732
With 16 data lines letting the line color to automatic as data lines 11 and 12 virtually the same color. I can not distinguish the lines from one another. Now to find 16 unique colors.....
You can also make them unique using continuous lines and broken lines.
 

Users who are viewing this thread

Top Bottom