有人做过用VB画K线图的例子吗?直接用VB画矩形还是可以使用控件?

ragweed_wg 2002-05-31 01:48:43
有人做过用VB画K线图的例子吗?直接用VB画矩形还是可以使用控件?
Office下的图表也可以画K线图,有人用过没有?是否好用?
给个思路也行,呵呵,最好来点源码,也可以直接发到我的邮箱ragweed@sina.com
谢谢。
...全文
405 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ragweed_wg 2002-06-03
  • 打赏
  • 举报
回复
谢谢大家。
_1_ 2002-06-01
  • 打赏
  • 举报
回复
Private Sub DrawKLine(picBroad As PictureBox, CurJL As Long, ts As Long, maxhigh As Double, minlow As Double)
'画K线
Dim DrawColor As Long
Dim i As Long
Dim MaxJL As Long

picBroad.Cls
picBroad.Scale
If CurJL + ts > UBound(hq) Then
MaxJL = UBound(hq)
Else
MaxJL = CurJL + ts
End If

picBroad.Scale (CurJL, maxhigh)-(CurJL + ts + 1, minlow)
For i = CurJL To MaxJL
If hq(i).spj > hq(i).kpj Then
DrawColor = QBColor(12)
ElseIf hq(i).spj < hq(i).kpj Then
DrawColor = QBColor(10)
Else
DrawColor = QBColor(15)
End If
picBroad.Line (i + 0.2, hq(i).kpj)-(i + 0.8, hq(i).spj), DrawColor, BF
picBroad.Line (i + 0.5, hq(i).zgj)-(i + 0.5, hq(i).zdj), DrawColor
Next
End Sub
Private Sub DrawVolume(picBroad As PictureBox, CurJL As Long, ts As Long, maxhigh As Double, minlow As Double) '画K线
'画成交量
Dim DrawColor As Long
Dim i As Long
Dim MaxJL As Long

picBroad.Cls
picBroad.Scale
If CurJL + ts > UBound(hq) Then
MaxJL = UBound(hq)
Else
MaxJL = CurJL + ts
End If

picBroad.Scale (CurJL, maxhigh)-(CurJL + ts + 1, minlow)
For i = CurJL To MaxJL
If hq(i).spj > hq(i).kpj Then
DrawColor = QBColor(12)
ElseIf hq(i).spj < hq(i).kpj Then
DrawColor = QBColor(10)
Else
DrawColor = QBColor(15)
End If
picBroad.Line (i + 0.2, hq(i).cjl)-(i + 0.8, minlow), DrawColor, BF

Next
End Sub
Private Sub DrawAvangeKline(picBroad As PictureBox, CurJL As Long, ts As Long, maxhigh As Double, minlow As Double, AvangeTs As Long, DrawColor As Long) '画K线
'画均线
Dim i As Long
Dim MaxJL As Long
Dim PointValue() As Double
Dim j As Long
Dim StartX As Double, StartY As Double
picBroad.Scale
If CurJL + ts > UBound(hq) Then
MaxJL = UBound(hq)
Else
MaxJL = CurJL + ts
End If
ReDim PointValue(CurJL To MaxJL)
picBroad.Scale (CurJL, maxhigh)-(CurJL + ts + 1, minlow)

For i = CurJL To MaxJL
If i >= AvangeTs Then
PointValue(i) = 0
For j = i - AvangeTs + 1 To i
PointValue(i) = PointValue(i) + hq(j).spj
Next
PointValue(i) = PointValue(i) / AvangeTs
If i > CurJL Then
picBroad.Line (StartX, StartY)-(i + 0.8, PointValue(i)), DrawColor
StartX = i + 0.8
StartY = PointValue(i)
Else
StartX = i
StartY = PointValue(i)
End If
Else
PointValue(i) = 0
End If
Next
End Sub
thirdapple 2002-06-01
  • 打赏
  • 举报
回复
用Line画,不过速度还是不行,如果你可以把阴线和阳线分解为一些图片,用BitBlt贴图,估计要快些
zyl910 2002-06-01
  • 打赏
  • 举报
回复
直接用Line话就是
还用什么控件

现在学编程的人啊

动不动就用非基本控件
孙小雄 2002-06-01
  • 打赏
  • 举报
回复
ChartType 常数


VtChChartType 提供图表类型选项。

常数 描述
VtChChartType3dBar 3D 条形图
VtChChartType2dBar 2D 条形图
VtChChartType3dLine 3D 折线图
VtChChartType2dLine 2D 折线图
VtChChartType3dArea 3D 面积图
VtChChartType2dArea 2D 面积图
VtChChartType3dStep 3D 阶梯图
VtChChartType2dStep 2D 阶梯图
VtChChartType3dCombination 3D 组合图
VtChChartType2dCombination 2D 组合图
VtChChartType2dPie 2D 饼图
VtChChartType2dXY 2D XY 散点图
孙小雄 2002-06-01
  • 打赏
  • 举报
回复
我说一个例子


ctrl+t 引用 D:\WIN2K\System32\MSCHRT20.OCX **部件**

Private Sub Command1_Click()
With MSChart1
.chartType = VtChChartType2dLine
.ColumnCount = 8
.RowCount = 8
.ShowLegend = True
.SelectPart VtChPartTypePlot, index1, index2, _
index3, index4
.EditCopy
.SelectPart VtChPartTypeLegend, index1, _
index2, index3, index4
.EditPaste
End With
End Sub


有什么疑问 留言CSDN消息给我
http://www.csdn.net/Message_Board/Send.asp?sendto=sunxl
rise139 2002-06-01
  • 打赏
  • 举报
回复
收到给个话?
rise139 2002-06-01
  • 打赏
  • 举报
回复
接着...
ChengGang 2002-05-31
  • 打赏
  • 举报
回复
本人没做过股票,但见过朋友有关股票的资料,里面的K线图好象跟股票的涨跌有关。我想可以利用画线或者画点的语句(书上有),利用实时取得的股票涨跌数据做出类似K线图的曲线。

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧