vba Chart Object X Axis is cut off when I make chart large

Hi Experts,

I have a question that might be a bug.

I have a chart on a form. If the chart object is less than 25cm wide by 19 cm high, it displays data correctly. If I make the chart object > 25cm wide, the chart starts to cut off the data at the end of the x-axis.

Using the property for zoom, stretch and clip does not help.


Thanks for your help.

Who is Participating?
telyni19Connect With a Mentor Commented:
It does look good at 25 cm, but I can't see how small it is relative to your whole application. Why not just center it within the available space and leave it at 25 cm if that is the width that will show the chart the best without cutting off part of it?
Could you attach a sample database that exhibits this behavior? It would be helpful to be able to look at the form and chart properties to see what might be causing it.
WestCoastHipAuthor Commented:

Here is a description of the behavior. Unfortunately, this did not seem to remedy my chart.


It looks like an Access chart bug, and compounded with the tabbed control the chart is on, the provided solution does not seem to remedy.

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

It definitely sounds like Access has some odd behavior as standard. What does the chart do when you use the code in the article you referenced? You said it didn't help, but does it do the same thing as without the code, or does it do something different but equally bad?
WestCoastHipAuthor Commented:

The same behavior occurs using the suggested fix at ->http://blogs.office.com/b/microsoft-access/archive/2010/08/26/scale-access-chart-objects-at-runtime.aspx

For now, just keeping it as is........and tying a magnifying glass with a piece of string to the monitor.

Caveman Style. Fixing stuff since.......cavemen.

Jeffrey CoachmanMIS LiasonCommented:
So, will you be posting a sample file?

This will save us all the time involved in "Guessing" what the issue might be...
Sound fair?

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Compile the code. (From the database window, click: Debug-->Compile)
10. Run the compact/Repair utility.
11. Remove any Passwords and/or security.
12. Post explicit steps to replicate the issue.
13. Test the database before posting.

In other words, ...post a database that we can easily open and immediately see the issue, and if applicable, also include a Graphical representation of the Exact results you are expecting.

WestCoastHipAuthor Commented:

Sorry to not have provided the database. I would estimate the time involved to perform the steps is close to 5 hours, probably not going to happen.

Instead, here is a simple jpg of what the chart looks like when under 25 cm, and what it looks like extended to 31 cm.

You can see the data series cannot be contained by the chart object.....no matter how hard I try.

Thanks for looking.

Jeffrey CoachmanMIS LiasonCommented:
The issue here is that there are too many unknowns here:
How was the graph created?
What type of control is displaying the graph?
What is the size of the graph object inside the report.
In Office, what "Document Window" option are you using?
What are the size properties of the Report/control?

Again, perhaps this will end up being something simple, I just don't want to spend time "Guessing" at all the possibilities...

As I said, all I need is a "Sample",  with just made-up data.

In other words just post a database with enough data to display this issue.

I create standard charts with Access (using the chart Wizard) and I have never seen this issue.
So again, it could be something simple, it could be something complex, it may even be a combination of things...

Jeffrey CoachmanMIS LiasonCommented:
<I would estimate the time involved to perform the steps is close to 5 hours>
5 Hours?!... just to make a chart of this data?
DataMonthDay      DataValue
9/10/2011      3
10/10/2011      8
11/10/2011      6
12/10/2011      3
1/10/2012      2
2/10/2012      4
3/10/2012      17

I made a sample in 5 minutes, not 5 hours...

In any event here is my sample of your data in a chart.
I have no issues resizing the chart and having it display all the data.

Jeffrey CoachmanMIS LiasonCommented:
Chart in a form as well, again, no issues...
WestCoastHipAuthor Commented:

Thanks for your input.

I realize that it must seem that it is not too big of a deal to send an mdb. The issue is that a quick look tells me that the code on the form to generate the 6 charts, each on a different tab is @ 4000 lines.

I posted a link from MS that states that this is a known issue.

What I am looking for is ideas other than the ones suggested on that link to remedy the issue.

The issue with leaving the charts at 25cm, is a matter of aesthetics. I can telll you that a 25 cm chart on a 60 cm monitor looks a little ridiculous though, especially on a full screen application.

On second thought, here is a sample of exactly what is happening. Take a look for yourself.

You are correct it took 5 minutes. I was thinking that I would send the existing app, but it the same for all charts.

Take a look at each tab. All are the exact same chart, just some tabs have a >30 cm width, others are 25cm. (the magic number is 9.2 inches)


Jeffrey CoachmanMIS LiasonCommented:
Did you look at the charts in the sample you posted?

I looks like the Series is flipped... (In Rows when it should be in columns or vice versa)

In any event, (if this is what I think it is), this is more of a apparition, then a bug.
This is what happens when you insert the chart and do not resize it.

For some reason when you insert a chart in MS Access, the Preview is a bit "Off", (For lack of a more descriptive explanation)

So on the charts that are "Off", all you might have to do is resize the chart slightly.

Also note that this might just be a function of the chart being to big (Wide) for the screen.
In this case you would just have to scroll over.

In any case, here is your sample back
All charts display fine for me.
Let me know what you think.

WestCoastHipAuthor Commented:

These charts do not display fine on my PC. If you notice that the charts on the tabs are different. I am not concerned with the data in any way.

I am concerned that the chart is not contained properly within the chart object. Did you see the different charts on each tab?

The first tab, the chart looks fine (image provided). Complete chart and legend. On the second tab(image provided), you can see that the chart only shows a part of the previous chart, and the legend is off the object somewhere. The x axis is cut off as well (no end tick visible)

This IS A BUG as stated at the MS Access blog (http://blogs.office.com/b/microsoft-access/archive/2010/08/26/scale-access-chart-objects-at-runtime.aspx). I am merely looking to see if anyone has had any luck with work arounds that do not include:
1. Make chart less than 25 cm
2. Buy a smaller monitor with less resolution.

The chart is also not too wide for my 55cm monitor. In fact, the reason I want the chart larger is to fill more of the monitor.

I also do not believe the chart in the sample I sent you "looked fine". Did you notice that those are the exact same charts on all tabs except for width, but some do not have legends? The legends are not turned off, they are outside of the chart object, and the series is being cutoff as well. Take another look. If you have screen shots of them looking fine on all tabs, please let me know if you have applied any patches to your Access (I am 2007(12.0.6535.5005) SP2 MSO(12.0.6545.504).

Thanks Tab 1 the chart is ok, full x axis, legend Tab 2, the chart has partial x axis, and no legend. where are they?
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
OK, I see what you mean now...
If there is a workaround for this, the author would be obliged to let everyone know.

Whats the reason why the charts have to be in a Form?

Unless I need "Interaction" I rarely put charts in Forms.

The charts will scale automatically if they are in a report, and opened explicitly in Print Preview.

Jeffrey CoachmanMIS LiasonCommented:
screenshots of Reports
WestCoastHipAuthor Commented:

The reasons the charts are in a form is because that is what the design states for the application. This has been spec'd by the client whom sends me money in order to implement designs he comes up with.

I am resigned to making the charts no wider than 9.2 inches and writing this off as a bug by MS, so if client wants bigger charts they can buy a decent 3rd party chart library.

I appreciate everyone's input on this.


WestCoastHipAuthor Commented:
This is a MS Chart Object bug. It appears there are no additional workarounds other than the options found at http://blogs.office.com/b/microsoft-access/archive/2010/08/26/scale-access-chart-objects-at-runtime.aspx
I don't think I should get all the points for this. Boag2000 obviously did a lot of work looking into the issue. I may have suggested the action you're actually going to take, but I'm not the only one who helped you come to that conclusion.
Sorry, I didn't see it was shared, since there were so many comments and the selected one was short. I'm glad it was.
WestCoastHipAuthor Commented:
I appreciated the comments from both Boag and yourself. The points were split evenly.

The solution I am using is exactly what you suggested.  

This question was like that old joke:

Old Guy: It hurts when I do this!
Doctor: Then stop doing that!

Thanks to both of you for your opinions.
Jeffrey CoachmanMIS LiasonCommented:

...and thanks for taking the time to clarify the issue.
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.

All Courses

From novice to tech pro — start learning today.