Chao cac bạn, mình có biểu đồ này khó quá, nhờ các bạn giúp mình với.
Trong đó khi kích vào thanh cuộn thì hiện 5 trade 1 lần. CÁc mũi tên chỉ số lượng lớn nhất và nhỏ nhất, dữ liệu đó hiện trong mũi tên
Có thể dùng scroll bar kết hợp có thể vẽ được biểu đồ theo kiểu này.
Tuy nhiên hiện tại tôi chỉ có thể làm theo kiểu tạo ra một data động theo scroll bar rồi biểu đồ sẽ động theo data đó.
Nhờ các bác cao thủ thể hiện tiếp.
Đoạn 1 scroll chart của OverAC xem như ổn, đoạn 2 mũi tên chỉ ở 2 điểm có lẽ nên gài thêm VBA vào mỗi Event scroll change, viết code
PHP:
Sub ScrollBar2_Change()
GET.CHART.ITEM
....
hoặc lấy số liệu thay đổi trực tiếp từ các cell/ range trước và sau khi scroll
....
lấy hiệu số này để điều khiển mũi tên
xác định tọa độ điểm 3 và 5 so với thời điểm trước đó nếu tăng, sơn lại mũi tên màu xanh, quay lên, nếu giảm - đỏ - quay xuống!
End Sub
Đây là ý tưởng, muộn quá, không kịp làm ra nhưng các bạn có thể tham khảo đoạn code này:
Locating Chart Items
Sometimes, however hard we try, the only way to get a chart looking exactly how we want it is to add drawing objects to it, such as rectangles, lines, arrows and so on. As soon as we do that, we hit the problem of trying to identify where in the drawing object coordinate space an item on the chart is located, such as the top middle of a specific column in a column chart.
That level of positional information cannot be obtained through the Excel object model, but can be obtained by calling on the long-disused XLM function GET.CHART.ITEM. This function has the following parameters:
GET.CHART.ITEM(x_y_index, point_index, item_text)
Where:
x_y_index is 1 to return the x position and 2 to return the y position.
point_index depends on the item we're looking at, but is a number from 1 to 8 to identify a specific vertex within the item. For example, 2 is the upper middle of any rectangular item, such as a column in a column chart.
item_text identifies the item we're interested in, such as "Plot" for the plot area, or "S2P4" for the fourth data point in the second series in the chart.
The full list of available parameters can be found in the XLM Macros help file available for download from the Microsoft Web site at http://support.microsoft.com/?kbid=128175. The only caveat with using GET.CHART.ITEM is that the chart must be active for it to work. The code in Listing 15-3 moves an arrow on a chart to be from the top-left corner of the inside of the plot area (using normal VBA positioning) to the top middle of the third column of a column chart, resulting in the chart shown in Figure 15-16.
Listing 15-3. Using GET.CHART.ITEM to Locate a Chart Item's Vertices
PHP:
Private Sub cmdMoveArrow_Click()
Dim rngActive As Range
Dim dXVal As Double
Dim dYVal As Double
Dim chtChart As Chart
Set rngActive = ActiveCell
'We have to activate the chart to use GET.CHART.ITEM
Me.ChartObjects(1).Activate
'Find the XY position of the middle top of the third column
'in the data series,
'returned in XLM coordinates
dXVal = ExecuteExcel4Macro("GET.CHART.ITEM(1,2,""S1P3"")")
dYVal = ExecuteExcel4Macro("GET.CHART.ITEM(2,2,""S1P3"")")
'Get the Chart
Set chtChart = Me.ChartObjects(1).Chart
With chtChart
'Convert the XLM coordinates to Drawing Object coordinates
'The x values are the same, but the Y values need to be
'flipped
dYVal = .ChartArea.Height - dYVal
'Move and size the Arrow
.Shapes("linArrow").Left = .PlotArea.InsideLeft
.Shapes("linArrow").Top = .PlotArea.InsideTop
.Shapes("linArrow").Width = dXVal - .Shapes("linArrow").Left
.Shapes("linArrow").Height = dYVal - .Shapes("linArrow").Top
End With
rngActive.Activate
End Sub
Có thể dùng scroll bar kết hợp có thể vẽ được biểu đồ theo kiểu này.
Tuy nhiên hiện tại tôi chỉ có thể làm theo kiểu tạo ra một data động theo scroll bar rồi biểu đồ sẽ động theo data đó.
Nhờ các bác cao thủ thể hiện tiếp.