PC Review


Reply
Thread Tools Rate Thread

Pictures (bitmaps) as Point Markers in XY Scatter Plot?

 
 
Jim S
Guest
Posts: n/a
 
      18th Apr 2004
Hi,

I've figured out how to load custom bitmaps into Shape
objects and use them as Marker Points on my scatter plot,
but I'm not sure I'm doing it in the best/correct way,
especially for "portability" of my workbook.

By "portabiliy", I mean, I want to send the Workbook to
someone but don't want to have to send all the bitmap
files along with it. Is there a way to make these
shapes "part of" the workbook so that they're always
available?

Here's what I'm currently using to load the various
bitmaps:

dim myShape as Shape
Set myShape = ActiveChart.Shapes.AddPicture( _
Filename:=<<path to file>>, _
LinkToFile:=msoTrue, _
SaveWithDocument:=msoFalse, _
Left:=<<left>>, Top:=<<top>>, _
width:=<<width>>, height:= <<height>>)

And then to apply a specific Shape to a specific Point, I
use:

Dim myChart as Chart
myShape.Copy
myChart.SeriesCollection(1).Points(1).Select
Selection.Paste
(Is there a better way to apply the Marker??)

Now, the Shapes collection appears to be a property of a
particular chart. What's the best way to have all of
these bitmap/shape objects available for use without
having to load them from a file? I would guess that I
should probably do something like this:

1. Change LinkToFile to be False and SaveWithDocument to
be True.
2. Create a "dummy" (read: hidden) worksheet or
chartsheet with the bitmaps/Shapes loaded in them, and
save the workbook.
3. Whenever I create a new chart in VBA, just go to
that "dummy" (hidden) workbook to copy the existing Shapes
and apply them to Points in the new chart.

Then, the application of a Shape to a point would look
something like this:

Charts("my dummy sheet").Shapes("some name").Copy
myNewChart.SeriesCollection(1).Points(1).Select
Selection.Paste

Is that how I should do this? Or am I making this WAY too
complicated (likely).

Thanks in advance for any help.

JS


 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      19th Apr 2004
Jim -

You got it right. Use insert picture to load the bitmaps into the hidden
worksheet, give them all names, then copy and paste. You don't need to
select the point first, though, just use this:

Charts("my dummy sheet").Shapes("some name").Copy
myNewChart.SeriesCollection(1).Points(1).Paste

And you can use Sheets("my dummy sheet").Pictures(Name or Number).Copy

I always put my pictures in a dummy worksheet, and in the cell next to
the picture, I put its name, so I can see it quickly.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Jim S wrote:

> Hi,
>
> I've figured out how to load custom bitmaps into Shape
> objects and use them as Marker Points on my scatter plot,
> but I'm not sure I'm doing it in the best/correct way,
> especially for "portability" of my workbook.
>
> By "portabiliy", I mean, I want to send the Workbook to
> someone but don't want to have to send all the bitmap
> files along with it. Is there a way to make these
> shapes "part of" the workbook so that they're always
> available?
>
> Here's what I'm currently using to load the various
> bitmaps:
>
> dim myShape as Shape
> Set myShape = ActiveChart.Shapes.AddPicture( _
> Filename:=<<path to file>>, _
> LinkToFile:=msoTrue, _
> SaveWithDocument:=msoFalse, _
> Left:=<<left>>, Top:=<<top>>, _
> width:=<<width>>, height:= <<height>>)
>
> And then to apply a specific Shape to a specific Point, I
> use:
>
> Dim myChart as Chart
> myShape.Copy
> myChart.SeriesCollection(1).Points(1).Select
> Selection.Paste
> (Is there a better way to apply the Marker??)
>
> Now, the Shapes collection appears to be a property of a
> particular chart. What's the best way to have all of
> these bitmap/shape objects available for use without
> having to load them from a file? I would guess that I
> should probably do something like this:
>
> 1. Change LinkToFile to be False and SaveWithDocument to
> be True.
> 2. Create a "dummy" (read: hidden) worksheet or
> chartsheet with the bitmaps/Shapes loaded in them, and
> save the workbook.
> 3. Whenever I create a new chart in VBA, just go to
> that "dummy" (hidden) workbook to copy the existing Shapes
> and apply them to Points in the new chart.
>
> Then, the application of a Shape to a point would look
> something like this:
>
> Charts("my dummy sheet").Shapes("some name").Copy
> myNewChart.SeriesCollection(1).Points(1).Select
> Selection.Paste
>
> Is that how I should do this? Or am I making this WAY too
> complicated (likely).
>
> Thanks in advance for any help.
>
> JS
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing data markers to text on a xy scatter plot shilpa Microsoft Excel Charting 2 29th Dec 2011 09:54 PM
Too many markers on line chart makes it a thick line and individual markers cannot be seen denzel Microsoft Excel Misc 2 2nd Aug 2006 04:06 PM
make all markers the same in a scatter plot =?Utf-8?B?WFhCRVhY?= Microsoft Excel Charting 1 23rd Feb 2006 12:00 AM
XY Scatter Legend when Edit Individual Markers =?Utf-8?B?Sm9obg==?= Microsoft Excel Charting 6 13th Jun 2005 03:06 PM
reducing number of markers in XY scatter chart Chris Microsoft Excel Charting 2 17th Sep 2003 04:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:39 AM.