ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¹Ïªí chart ¤ºÁͶսuªº¸ê®ÆÂI¤§ Top Left ®y¼Ð VBA¦p¦ó¨ú±o

[µo°Ý] ¹Ïªí chart ¤ºÁͶսuªº¸ê®ÆÂI¤§ Top Left ®y¼Ð VBA¦p¦ó¨ú±o

·q½Ð½å¹F«ü¾É¡G
¤U¦C·s¥[¤@ÁͶսu¡A¸ê®ÆÂI¦b Array ¤º¡A°õ¦æµeÁͶսu«á¦p¦ó¨ú±o­Ó¸ê®ÆÂIªº top left ®y¼Ð­È?
ÁÂÁÂ

  ActiveChart.SeriesCollection.NewSeries.Select
        With Selection
            .Name = "=""AAAA"""
            .XValues = Array(0.12,0.13, 0.14,0.15)     'x_category
            .Values = Array(2.2,2.1,1.8,1.5)                   'y_value
            .MarkerStyle = -4142
           With Selection.Format.Line
               .Visible = msoTrue
               .ForeColor.RGB = RGB(255, 0, 0)
               .Transparency = 0
               .Weight = 3#
           End With
        End With

¦^´_ 1# Scott090
¬O³o¼Ë¶Ü?
  1. Option Explicit
  2. Sub Ex()
  3.     Dim X, Y
  4.     With ActiveChart.SeriesCollection.NewSeries
  5.         .XValues = Array(0.12, 0.13, 0.14, 0.15)   'x_category
  6.         .Values = Array(2.2, 2.1, 1.8, 1.5)        'y_value
  7.         X = .XValues 'X¶b¼Æ­È
  8.         Y = .Values 'Y¶b¼Æ­È
  9.         MsgBox "Top= " & X(1) & " ,Left= " & Y(1)
  10.     End With
  11. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE

ÁÂÁ«ü¾É
¯à§_Âà¤Æ¬° ¬Û¹ï©óchartarea ©Î plotarea ªº top left (¤]³\¬Oµøµ¡®y¼Ð§a? ¤£½T©w¥s¬Æ»ò)
¨Ò¦p  .top = 250
           .left = 55
¦A·P®¦

TOP

¥»©«³Ì«á¥Ñ Scott090 ©ó 2014-8-16 08:10 ½s¿è

¦^´_ 2# GBKEE


    '¯S©w¸ê®ÆÂI(0.15,1.5) ªº Top, Left ¦p¦ó¨ú±o??
½Ð°Ñ¦Òªþ¥ó¡A ÁÂÁÂ

TOP

¦^´_ 3# Scott09
ªþ¥ó

Chart sample.rar (17.53 KB)

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-8-17 07:28 ½s¿è

¦^´_ 5# Scott090

¯S©w¸ê®ÆÂI(0.15,1.5) ªº Top, Left ¦p¦ó¨ú±o, ¥\¤O¤£°÷À°¤£¤W¦£.
¦p¹Ï: ·Æ¹«²¾¨ì¸ê®ÆÂI¥iÅã¥Ü¥X¸ê®ÆÂIªº¼Æ­È,¬°¦óÁÙ­n¥[¤W»¡©ú.


   
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 6# GBKEE


    ÁÂÁ¤j®v¼ö¤ß¦a¦^À³

TOP

¦^´_ 7# Scott090
À°§A½m¤@¤U¥\,¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim X(), Y(), XLeft As Single, Ytop As Single, i As Integer
  4.     Dim P As PlotArea, C As Chart, S As Shapes
  5.     Set C = ActiveSheet.ChartObjects(1).Chart  '«ü©w¹Ïªí
  6.     Set P = C.PlotArea
  7.     X = C.SeriesCollection(1).XValues 'X¶b¼Æ­È
  8.     Y = C.SeriesCollection(1).Values  'Y¶b¼Æ­È
  9.     i = 3   '«ü©w¼Æ­ÈÂI.
  10.     With C.Axes(1) 'xlCategory  'X¶b
  11.          XLeft = P.InsideWidth / (.MaximumScale - .MinimumScale)
  12.          'ÂI¼Æ¶¡¶Zªº¼e«×
  13.     End With
  14.     With C.Axes(2)   'xlValue  'Y¶b
  15.         Ytop = P.InsideHeight / (.MaximumScale - .MinimumScale)
  16.         ''ÂI¼Æ¶¡¶Zªº°ª«×
  17.     End With
  18.     XLeft = P.InsideLeft + (XLeft * X(i))
  19.     Ytop = P.InsideTop + P.InsideHeight - (Ytop * Y(i))
  20.     Set S = C.Shapes
  21.     If S.Count <> 0 Then
  22.         C.Parent.Activate
  23.         S.SelectAll
  24.         Selection.Delete
  25.     End If
  26.     With C.Shapes.AddShape(msoShapeRectangle, Left:=XLeft, Top:=Ytop, Width:=100, Height:=50)
  27.         .TextFrame.Characters.Text = "ªþ¥[»¡©ú1:" & Chr(10) & "X: " & X(i) & Space(5) & "Y: " & Y(i)
  28.     End With
  29.     C.Parent.Parent.Activate
  30. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ Scott090 ©ó 2014-8-18 21:14 ½s¿è

¦^´_ 8# GBKEE


    «D±`·P®¦¤j®v¼ö±¡ªº«ü¾É
¥Ñ PlotArea µøµ¡ª½±µ­pºâ¸ê®ÆÂI¦ì¸m¤@©w¬O«D±`ªºÃ­°·ªº°µªk

¥t¡A¦³§ä¨ì¸ê®ÆÂIªºÄÝ©Ê Points().top Points().left¡A¨äí°·©Ê¦p¦ó¤£±o¦Óª¾¡A¤jÁx¦C¥X¨Óµ¹°Ñ¦Ò¡G
  1. Sub Ex2()
  2.     Dim X(), Y(), XLeft As Single, Ytop As Single, i As Integer
  3.     Dim P As PlotArea, C As Chart, S As Shapes
  4.    
  5.     Set C = ActiveSheet.ChartObjects(1).Chart  '«ü©w¹Ïªí
  6.     X = C.SeriesCollection(1).XValues 'X¶b¼Æ­È
  7.     Y = C.SeriesCollection(1).Values  'Y¶b¼Æ­È
  8.     i = 3   '«ü©w¼Æ­ÈÂI.
  9.    
  10.     Ytop = C.SeriesCollection(1).Points(i).Top      '¸ê®ÆÂI i ªº Top ­È
  11.     XLeft = C.SeriesCollection(1).Points(i).Left    '¸ê®ÆÂI i ªº left ­È
  12.    
  13.     With C.Shapes.AddShape(msoShapeRectangle, Left:=XLeft, Top:=Ytop, Width:=100, Height:=50)
  14.         .TextFrame.Characters.Text = "ªþ¥[»¡©ú1:" & Chr(10) & "X: " & X(i) & Space(5) & "Y: " & Y(i)
  15.     End With
  16.    
  17.     Range("E10").Select
  18. End Sub
½Æ»s¥N½X

TOP

¦^´_ 9# Scott090
2003ª©Points¨S¦³³o¨ÇÄÝ©Ê
  1.   Ytop = C.SeriesCollection(1).Points(i).Top      '¸ê®ÆÂI i ªº Top ­È
  2. XLeft = C.SeriesCollection(1).Points(i).Left    '¸ê®ÆÂI i ªº left ­È
½Æ»s¥N½X
¸Õ¸Õ¬Ý
  1. Sub Ex()
  2.     Dim P As Point, C As Chart, i As Integer
  3.     Set C = ActiveSheet.ChartObjects(1).Chart  '«ü©w¹Ïªí
  4.     i = 2   '«ü©w¼Æ­ÈÂI
  5.     With C.SeriesCollection(1)
  6.         .HasDataLabels = True
  7.         .DataLabels.Delete
  8.     End With

  9.     Set P = C.SeriesCollection(1).Points(i)
  10.     P.ApplyDataLabels xlDataLabelsShowLabel, ShowValue:=True
  11.     With P.DataLabel
  12.         .Interior.ColorIndex = 35
  13.         .Characters.Text = "ªþ¥[»¡©ú1:  " & vbLf & .Characters.Text
  14.     End With
  15. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¡i°±º¢¤£«e¡A²×µL©Ò±o¡j¤H³£°g©ó´M§ä©_ÂÝ¡A¦]¦Ó°±º¢¤£«e¡FÁa¨Ï®É¶¡¦A¦h¡B¸ô¦Aªø¡A¤]¤FµL¥Î³B¡A²×µL©Ò±o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD