Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

Excel--Macro to label scatter plot.

瀏覽次數:13 次
跳到第一則未讀訊息

Jeff Bangert

未讀,
1992年11月21日 晚上7:20:191992/11/21
收件者:
Is it possible to write a macro which will automatically label the
points in a scatter plot?

What I would like to do is define a range which includes a column of
labels, a column of x values, and a column of y values. Then, when
the macro is run, it would produce a scatter plot with each point
labeled with a text box. It would be ok with me if the labels
overlapped. I could always adjust them by hand.

Thanks for the help,

--
Jeff Bangert je...@kuhub.cc.ukans.edu
Computer Center je...@ukanvax.bitnet
University of Kansas
Lawrence, KS 66045
(913)864-0466

Joel Spolsky

未讀,
1992年11月23日 晚上9:34:401992/11/23
收件者:
In article <1992Nov21.1...@kuhub.cc.ukans.edu> je...@kuhub.cc.ukans.edu (Jeff Bangert) writes:
>Is it possible to write a macro which will automatically label the
>points in a scatter plot?
>
>What I would like to do is define a range which includes a column of
>labels, a column of x values, and a column of y values. Then, when
>the macro is run, it would produce a scatter plot with each point
>labeled with a text box. It would be ok with me if the labels
>overlapped. I could always adjust them by hand.


Yeah, it's pretty easy too. Suppose Sheet1 looks like this:

label x y
a 1 1
b 2 2
c 3 3

Now you create a default scatter chart based on that using the charting
wizard. Activate the chart (double click on it so it comes up in its
own window) and run the following macro (which assumes 3 data points -
change the constant in the second line to fix that).

LabelScatterPoints (a)
=FOR("i",1,3)
= ATTACH.TEXT(4,1,i)
= FORMULA(OFFSET(Sheet1!$A$1,i,0))
=NEXT()
=RETURN()

--
Joel Spolsky
Program Manager
Microsoft Excel
joe...@microsoft.com

0 則新訊息