- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 21# lin_6219 - Sub KChartWithVolume2() ' K½u¹Ï»P¦¨¥æ¶q¹Ï©ñ¦b¦P¤@¹Ïªí
- Dim nRow As Integer, ChtObj As ChartObject
- Dim i As Integer, j As Integer, chartname As String
- Dim myMax, myMin, GapNr As Integer
-
- On Error Resume Next
-
- With Worksheets("¥Dµe±")
- .ChartObjects.Delete
- .Select
- nRow = Worksheets("ø¹Ï¸ê®Æ").Range("A65536").End(xlUp).Row
- ' Set ChtObj = Worksheets("¥Dµe±").ChartObjects.Add(1, 1, 450, 250)
- ' With ChtObj.Chart ~ End With
- ' ¦¹½d¨Ò §ï¥H Worksheets("¥Dµe±").Shapes.AddChart.Select ªº¤è¦¡³B²z¡F
- ' With ActiveChart
- ' . . . . . . . . . . . .
- ' With .ChartArea
- ' .Height = 250
- ' .Width = 450
- ' End With
- ' . . . . . . . . . . . .
- ' chartname = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
- ' .Shapes(chartname).Left = Cells(1, 1).Left
- ' .Shapes(chartname).Top = Cells(1, 1).Top
- ' . . . . . . . . . . . .
- ' End With
- ' ¦P²z¡A¥ç¥i¥H¨Ï¥Î Worksheets("¥Dµe±").ChartObjects.Add() ªº¤è¦¡³B²z
- ' ®t§O¥u¦b©ó With ActiveChart ~ End With ¶¡¡An¥t¦æ«Å§i¹Ïªí°ª¡B¼e«×¡A¥H¤Î®y¼Ð¦ì¸m¡C
- ' ´«¨¥¤§¡A Worksheets("¥Dµe±").ChartObjects.Add() ¬O¤@¦¸«K«Å§i§¹¦¨¡A«Å§iª«¥ó¤£¦P¡C
- .Shapes.AddChart.Select
-
- ' With ChtObj.Chart
- With ActiveChart
- ' .SetSourceData Worksheets("ø¹Ï¸ê®Æ").Range("A2:E" & CStr(nRow))
- .SetSourceData Source:=Range("ø¹Ï¸ê®Æ!$A$2:ø¹Ï¸ê®Æ!$E$" & CStr(nRow))
- .ChartType = xlStockOHLC
- .HasTitle = True
- .ChartTitle.Characters.Text = "K½u»P¦¨¥æ¶q¹Ï"
-
- With .ChartGroups(1)
- .AxisGroup = xlPrimary
- .HasUpDownBars = True
- .UpBars.Interior.ColorIndex = 3
- .DownBars.Interior.ColorIndex = 1
- .GapWidth = 10
- End With
-
- ' .SeriesCollection.Add Worksheets("ø¹Ï¸ê®Æ").Range("G1:G" & CStr(nRow))
- .SeriesCollection.Add Source:=Range("ø¹Ï¸ê®Æ!$G$2:ø¹Ï¸ê®Æ!$G$" & CStr(nRow))
-
- With .SeriesCollection(5)
- .ChartType = xlXYScatterLinesNoMarkers
- ' .ChartType = xlLine
- .AxisGroup = xlPrimary
- ' ¦pªG ¥D®y¼ÐȬ° xlStockOHLC¡A¦¹³B«Å§i·|³Q©¿µø¡Aµø¦P xlSecondary¡C
- .Border.ColorIndex = 7
- .Name = "=ø¹Ï¸ê®Æ!$G$1"
- End With
-
- With Worksheets("ø¹Ï¸ê®Æ") ' ³]©w¥D®y¼Ð¶b³Ì¤j¤Î³Ì¤pÈ
- myMax = Application.Max(.Range("C2:C" & CStr(nRow)))
- myMin = Application.Min(.Range("D2:D" & CStr(nRow)))
- myMin = myMin - (myMax - myMin)
- End With
-
- With .Axes(xlValue)
- .MaximumScale = Round(myMax, 2)
- .MinimumScale = Round(myMin, 2)
- End With
-
- ' .SeriesCollection.NewSeries ' ·s¼W¦¨¥æ¶q¼Æ¦C (»P¤Uz«Å§iµ²ªG¤@P)
- .SeriesCollection.Add Source:=Range("ø¹Ï¸ê®Æ!$F$2:ø¹Ï¸ê®Æ!$F$" & CStr(nRow))
-
- With .SeriesCollection(6)
- ' ¦¹³B .Values ¦s©ñȽd³ò¥²¶·¬O«ü¦V "¦³¹êÅé¼Æ¾Ú¸ê®Æ" ½d³ò°Ï°ì¡C
- ' ¦pªG¨Ï¥Î .SeriesCollection.NewSeries «Å§i¡A«h¥²¶·«ü©ú .Values¡C
- ' .Values = Worksheets("ø¹Ï¸ê®Æ").Range("F2:F" & CStr(nRow))
- .ChartType = xlColumnClustered
- .Name = "¦¨¥æ¶q" ' "=ø¹Ï¸ê®Æ!$F$1" (¦¨¥æª÷ÃB)
- .Interior.ColorIndex = 17
- .AxisGroup = xlSecondary ' ³]¬°°Æ®y¼Ð¶b
- End With
-
- With Worksheets("ø¹Ï¸ê®Æ") ' pºâ°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤pÈ
- myMax = Application.Max(.Range("F2:F" & CStr(nRow)))
- myMax = myMax * 2
- myMin = 0.01
- End With
-
- With .Axes(xlValue, xlSecondary) ' ³]©w°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤pÈ
- .MaximumScale = Round(myMax, 0)
- .MinimumScale = Round(myMin, 0)
- End With
-
- With .Axes(xlCategory) ' X®y¼Ð¶b (®É¶¡¶b)
- .CategoryType = xlCategoryScale
- .TickLabelSpacing = 4 ' ¼Ð¥Ü¶¡¶Z
- .TickLabels.NumberFormatLocal = "yyyy/m/d"
- .TickLabels.Font.ColorIndex = 5 ' Blue Color
- End With
-
- With .Legend ' §R°£¤£¥²nªº¹Ï¨Ò
- .LegendEntries(2).Delete ' ¶}½L»ù
- .LegendEntries(2).Delete ' ³Ì°ª»ù
- .LegendEntries(2).Delete ' ³Ì§C»ù
- .LegendEntries(2).Delete ' ¦¬½L»ù
- .Top = .Parent.ChartTitle.Top - 5
- End With
-
- With .ChartArea
- .Height = 250 ' ±N쥻³]©w¤§°ª«×½Õ¦Ü¾A«×¦ì¸m
- .Width = 450
-
- .Border.Weight = 2
- .Border.LineStyle = 0
- ' ¹ÏªíªºÃ¸¹Ï°Ï¥~¤§ X¡BY ¶b¦C¥Ü¸ê®Æ¼Æ¾Ú°Ï¶ô³¡¤À¤©¥H¶ñ¤J¹Ïªí¹w³](¨t²Î)¤§©³¦â¡B¥i¼W±jµøı®ÄªG¡C
- .Fill.OneColorGradient Style:=msoGradientHorizontal, Variant:=1, Degree:=0.231372549019608
- ' .Fill.Visible = True ' ¥[¤J¹Ïªí©³¦âÅܼƤºµ¹¤_¤§¦â¨t¡C
- ' .Fill.ForeColor.SchemeColor = ¹Ïªí©³¦â
- End With
-
- With .PlotArea ' ½Õ¾ãø¹Ï°Ï°ì¤j¤p»P¦ì¸m
- .Top = .Top - 10
- .Height = .Height + 15
- .Width = .Width + 95
- End With
-
- .PlotArea.Select ' ±N¹ÏªíªºÃ¸¹Ï°Ï®æ½u¦Ç¶ÂÃC¦âק令²H«C¦â¡B¥H¤Îªí®æ¹ê½u§ï¥Hµê½uªí¥Ü
- .Axes(xlValue).MajorGridlines.Select
- With Selection.Format.Line
- .Visible = msoTrue
- .ForeColor.ObjectThemeColor = msoThemeColorAccent1
- .ForeColor.TintAndShade = 0
- .ForeColor.Brightness = 0.8000000119
- .Transparency = 0
- .Weight = 0.25
- .DashStyle = msoLineSysDash
- End With
- End With
-
- chartname = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
- .Shapes(chartname).Left = Cells(1, 1).Left ' ³]©w¦¹¹Ïªí¹ê»ÚÂ\©ñªº X¡BY ®y¼Ð¦ì¸m¡C
- .Shapes(chartname).Top = Cells(1, 1).Top
- .[A1].Select
- End With
- End Sub
½Æ»s¥N½X |
|