PTS Charts in Excel 2010
by Jon Peltier
Saturday, July 25th, 2009
Peltier Technical Services, Inc., Copyright © 2010.
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
As I wrote in My First Look at Excel 2010 and in Sparklines and Data Bars in Excel 2010, and as roughly 97% of the blogs in the whole internet have reported, Microsoft has just released the Technical Preview edition of Office 2010.
I spent my first couple hours in Excel 2010 just driving around, seeing what the terrain looked like. Then I experimented with a new feature, Sparklines, and with a feature that was introduced in Excel 2007 but made useful in 2010, Data Bars.
PTS Utilities in Excel 2010 – Good news!
Finally today I got up the courage to test my commercial utilities in Excel 2010. Aside from very minor things, like building the ribbon interface not just in 2007 but in any version 2007 and later, the utilities have worked just fine.
This screen shot shows the commands for my utilities happily displayed on the PTS Charts tab of the ribbon. In the worksheet below is a waterfall chart created using the unmodified Waterfall Chart utility.

If any PTS Utility customers want to try out their utility in Excel 2010, send me an email and I will reply with a link to an updated version.
PTS Utility in 2007 – Bad News
I was putting the finishing touches on a new utility, the PTS Chart Zoomer Utility. It allows a user to select a region of a chart using the mouse, and the chart axes are rescaled to show a closer view of this region.

Select a region of a chart with the mouse…

… the region expands to fill the chart. Select another region…

… and this region now fills the chart.
I built the ribbon bits for this utility, and I was going through my final testing in Excel 2007 SP2, and nothing worked. No selection rectangle appeared in the chart, no resizing of the chart region occurred, nothing happened. I checked my code: it looked fine. I reran my code in Excel 2003: it worked fine.
I was starting to think, not another Excel 2007 upgrade hassle. I’ve had three unpleasant 2003 to 2007 upgrades of client projects in the past couple of months. The unpleasantness is due to a load of unanticipated incompatibilities, and even my best workaround attempts weren’t always successful. In one or two cases, the code might have changed, so that formerly optional arguments were required (though the documentation didn’t point this out). Mostly, though, the problems were with file formats, template handling differences, and charts. Charts, ouch. Dynamic charts would lose track of the ranges they were linked to. Charts on copied sheets would end up linked to the wrong data sheets. Labels or entire charts would move or disappear.
The problem in this case boiled down to a couple chart events not working. To draw a selection rectangle as shown in the screen shots above, you need to click the mouse (the MouseDown event), drag the mouse (the MouseMove event), and release the mouse (the MouseUp event). MouseMove is working just fine in 2007, but neither MouseDown nor MouseMove are triggered by user actions.
I think I could hack my way around this deficiency if all I were doing were drawing the rectangle and rescaling the axes. It wouldn’t be pretty, but it might work. However, the Chart Zoomer utility also has features that remember and restore previous zoom settings (Ctrl+Left or Right Click), and that resize to fit all points or to restore Excel’s default axes (Alt+Left or Right Click). I can’t figure out how to capture these mouse clicks, so I wouldd have to add a bunch of controls to the ribbon tab, or float a dialog nearby, or generate a bunch of shortcut keys.
I haven’t decided whether or how to proceed with this utility: should I scrap it, release what I have as a Classic Excel only utility, or hack my brains out and release a utility that works or at least mostly works in all versions of Excel?
Related Posts:
- Programming Excel 2007 and Excel 2010 AutoShapes with VBA (Guest Post)
- Excel Utilities in the Works
- Chart Event to Highlight a Series
- Introducing PTS Dot Plot Utility
- PTS Blog Inaugural Post
- An Undistorted Election Results Map
- Stock Charts in Excel 2007
- Chart Event Class Module to Highlight a Series
- Forms Controls and ActiveX Controls in Excel
- Cascade Chart Utility Joins the Team
Posted: Saturday, July 25th, 2009 under Excel 2010.
Comments: 9
Comments
Comment from LOL
Time: Sunday, July 26, 2009, 11:03 pm
“In the worksheet below is a waterfall chart created *suing* the unmodified Waterfall Chart utility.”
LOL!!!
Comment from Doug Glancy
Time: Monday, July 27, 2009, 2:39 am
Jon, that’s frustrating, to say the least.
I fooled around a bit with a simple chart class and with a click/drag/release all three events fired in both 2003 and 2007, except that in both versions the up event doesn’t fire in the chart area, but it does in the plot area.
The other thing is that with a touchpad the up/down events fire if I tap in one place without dragging, but only the move events fire if I tap/drag/release.
Comment from Jon Peltier
Time: Monday, July 27, 2009, 7:46 am
LOL – Stupid spell checker doesn’t tell me when I use the wrong word but spell it right.
Comment from Jon Peltier
Time: Monday, July 27, 2009, 7:54 am
Doug -
Did you do this in a chart sheet or in an embedded chart? ISTR that these events fire in a chart sheet, but it’s not too useful. In 2003 you could size the chart to the window, and the X-Y coordinates you got were useful, based on offsets from the top left of the window. In a chart sheet which is not sized to window, which is all of them in 2007, the X-Y coordinates you get are still from the top left corner of the window, but I can’t figure out how to tell how much gray area there is around the chart, or where the user may have scrolled.
Comment from Doug Glancy
Time: Monday, July 27, 2009, 10:07 am
Jon,
This was with both an embedded and a chart sheet.
Comment from Brett
Time: Tuesday, July 28, 2009, 10:40 am
Maybe this is just me, but CTRL+Click and ALT+Click don’t seem like useful shortcuts for returning to previous settings unless you’re trying to do mouse gestures (like the Opera web browser supports for example) or using the CTRL and ALT as modifiers before dragging (in CAD programs, CTRL, SHIFT, and ALT are often used to change mouse behavior between panning, rotating, and zooming for example).
Web browsers use ALT+Left and ALT+Right to go forward and back through the history and applications use CTRL+Z and CTRL+Y to move through Undo/Redo history. I feel like I’ve gotten used to using keyboard shortcuts like this for navigation. ALT+TAB, ALT+SHIFT+TAB and CTRL+TAB, CTRL+SHIFT+TAB to navigate windows or tabs is another good example (and CTRL+PGUP/PGDN for worksheets).
Now if you could make use of scroll wheel (or maybe ALT+Scrollwheel) to mimic the zoom behavior that CTRL+scrollwheel has in most applications, that could be very helpful. Middle Click and Drag would be cool too for selecting or panning. Another random thought would be to use the Forward and Back buttons (Buttons 4 and 5) on many mouses these days, but of course that is very restricting. CTRL+> and CTRL+< are used by several Office apps now to change font size up and down.
So if you had to use keyboard shortcuts to move backward and forward in zoom history, what about “CTRL+SHIFT+=” and “CTRL+SHIFT+-” (basically CTRL+SHIFT and the plus and minus keys). These shortcuts are already used by Microsoft Word for superscript and subscript and though I sincerely wish they were used that way in Excel, they aren’t. The plus and minus aspect correlates with the concept of zooming in and out. CTRL+0 could then be used to reset to the default (in Firefox, CTRL+0 resets the zoom level to 100%) and CTRL+SHIFT+0 or “CTRL+)” could be used for tightly bounding the data.
Just some thoughts! I really like the idea of giving added dynamic capabilities to the charts in Excel similar to what MATLAB and other packages have. Several mouse clicks and manual number entries later is a horrible way to update the view of a graphical interface. That’s almost like making a powerpoint from commandline…
Comment from Jon Peltier
Time: Tuesday, July 28, 2009, 12:43 pm
Brett -
You’ve given me a few ideas. I can certainly implement a few shortcut keys so I’m not relying on clicks on the chart. I could also fake a toolbar with a small modal dialog so mouse users will have a means to make these changes. There’s always room for a redesign, I guess.
Comment from Austin
Time: Saturday, March 27, 2010, 11:12 pm
I am trying to accomplish this task on a project and am having a different problem. The MouseDown works but the MouseMove does not. This is in excel 2007 an embedded chart. Any Ideas? I would greatly appreciate any help.
Comment from Jon Peltier
Time: Saturday, March 27, 2010, 11:27 pm
Austin -
I’ve had problems trying to implement chart events in 2007. Some of the events don’t fire as expected. I’ve figured out a few workarounds, but have not had time to really apply them.



















Write a comment
I welcome comments from my readers. If you have an opinion on this post, if you have a question or if there is anything to add, I want to hear from you. Whether you agree or disagree, please join the discussion.
If you want to include an image in your comment, post it on your own site or on one of the many free image sharing sites, and include a link in your comment. I'll download your image and insert the necessary html to display the image inline.
Read the PTS Blog Comment Policy.