趋势图一般是横向表示时间进度,纵向表示数值表示,把下面的代码拷贝到窗体代码中,运行即可,多改动一下里面的数据试试,很快就可以弄明白了
成都创新互联-专业网站定制、快速模板网站建设、高性价比乌审网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式乌审网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖乌审地区。费用合理售后完善,10多年实体公司更值得信赖。
Private Sub Form_Load()
Dim arrData(1 To 12, 1 To 2)
Dim i As Integer
For i = 1 To 12
arrData(i, 1) = i "月"
Randomize
arrData(i, 2) = Rnd * 1000
Next i
MSChart1.ChartData = arrData
MSChart1.chartType = VtChChartType2dLine
End Sub
你想说什么??你可以将数据库里面查询出来的结果保存在dataset中,直接赋值给chart的datasource。自动生成折线!
。net 其实还是很好绘制图形的
你可以看下 Graphics 类
Dim d As New Bitmap(Me.Width, Me.Height) ‘一个图片吧
Dim g As Graphics = Graphics.FromImage(d)’绘制 准备在这个图片是进行
然后 就是你绘制的东西了
线 就是 g.DrawLine()
圆 弧度 就用 g.DrawArc(Pens.Black, New Rectangle(0, 0, 400, 200), 0, 360)
复杂的就是 g.DrawBezier()
等 如果你用的是 VS的 编译 上面都有详细的参数说明
Dim d As New Bitmap(Me.Width, Me.Height)
Dim g As Graphics = Graphics.FromImage(d)
g.DrawArc(Pens.Black, New Rectangle(0, 0, 200, 200), 0, 360)
g.DrawLine(Pens.Red, New Point(0, 0), New Point(200, 200))
g.DrawLines(Pens.Green, New Point() {New Point(0, 0), New Point(50, 40), New Point(50, 80), New Point(90, 70), New Point(100, 400)})
g.DrawBezier(Pens.Yellow, New Point(0, 100), New Point(0, 0), New Point(200, 0), New Point(200, 200))
g.Dispose()
Me.BackgroundImage = d
TeeChart5
这个画图表很不错。。
百度一下一大堆下载的。
方法一:Excel中就可以实现;
方法二:通过VB.net将数据写入到Excel中生成趋势图;
方法三:直接通过VB.net写出这种趋势图。
具体方法可以参考VB.net操作Excel方法:
可用代码:
For i = 0 To iRow - 1
pointXY(i) = "'这里你可以直接放上你的数据点值在X线上
"
pointYY(i) = "'这里你可以直接放上你的数据点值在Y线上
Next
Private Sub DrawRectangle()
Try
Dim oV2Bar As New Graphing.V3.Bar.BarChart()
Dim renderer As New Graphing.V3.Render
PictureBox1.Image = renderer.DrawChart(oV2Bar, Xline,Yline iRow, pointXY, pointYY)
End If
Catch ex As Exception
MsgBox(ex.Message)
Public Class BarChart : Inherits Base.BaseGraph
'This will hold the Bar pieces.
Public BarSliceCollection As New Bar.BarPieceCollection()
Private _Alignment As Base.b_BarTypes = Base.b_BarTypes.HorizontalLeft
Public Property Alignment() As Base.b_BarTypes
Get
Return _Alignment
End Get
Set(ByVal Value As Base.b_BarTypes)
_Alignment = Value
End Set
End Property
'Private _ChartType As Base.b_ChartType = Base.b_ChartType.Bar
Public Shadows ReadOnly Property ChartType() As Base.b_ChartType
Get
Return MyBase.ChartType
End Get
End Property
Sub New()
MyBase.new()
MyBase.ChartType = Base.b_ChartType.Bar
End Sub
Sub New(ByVal BarPieceCollection As BarPieceCollection)
MyBase.new()
MyBase.ChartType = Base.b_ChartType.Bar
BarSliceCollection = BarPieceCollection
End Sub
End Class
End Try
End Sub