vb调用数据库数据画mschart折线图.doc

上传人:F****n 文档编号:98044480 上传时间:2019-09-07 格式:DOC 页数:6 大小:200KB
返回 下载 相关 举报
vb调用数据库数据画mschart折线图.doc_第1页
第1页 / 共6页
vb调用数据库数据画mschart折线图.doc_第2页
第2页 / 共6页
vb调用数据库数据画mschart折线图.doc_第3页
第3页 / 共6页
vb调用数据库数据画mschart折线图.doc_第4页
第4页 / 共6页
vb调用数据库数据画mschart折线图.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《vb调用数据库数据画mschart折线图.doc》由会员分享,可在线阅读,更多相关《vb调用数据库数据画mschart折线图.doc(6页珍藏版)》请在金锄头文库上搜索。

1、Private Sub Command1_Click() On Error Resume Next Dim i As Integer Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & App.Path & lwl.mdb conn.Open rs.Open

2、select * from lwl, conn, adOpenKeyset, adLockOptimistic Set MSChart1.DataSource = rs With MSChart1 / 以线条方式显示 .chartType = 3 / 把刻录改为手工方式 .Plot.Axis(VtChAxisIdY).ValueScale.Auto = False / 设置最大值 .Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 1000 / 设置最小值 .Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0 / 设

3、置每格为 1 .Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 1 / 设置收入和兼职收入总列数 .ColumnCount = 2 /轴坐标标题 .Plot.Axis(VtChAxisIdX, 0).AxisTitle = 日期 .Plot.Axis(VtChAxisIdY, 0).AxisTitle = 收入 /轴坐标标题字体大小的设置 .Plot.Axis(VtChAxisIdX, 0).AxisTitle.VtFont.Size = 15 .Plot.Axis(VtChAxisIdY, 0).AxisTitle.VtFont.Size

4、= 25 /设置图表标题 .Title.Text = 日期和收入对应折线图 / 显示图例说明 .ShowLegend = True / 标记每个点的值 For i = 1 To .Plot.SeriesCollection.Count .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint Next If rs.RecordCount 0 Then rs.MoveFirst Else Exit Sub End If For i = 0 To rs

5、.RecordCount - 1 .Column = 1 收入曲线所在列 .RowCount = rs.RecordCount .Row = i + 1 .RowLabel = CStr(rs(日期) .Data = rs(收入) .ColumnLabel = 收入 图例说明文字 /兼职收入显示 .Column = 2 兼职收入曲线所在列 .Data = rs(兼职收入) .ColumnLabel = 兼职收入 图例说明文字 rs.MoveNext Next End WithEnd SubPrivate Sub Command2_Click() 下列示例设置图表查看距离和轴分段间距。 Chan

6、ge the chart type to 3D Bar. MSChart1.chartType = VtChChartType3dBar With MSChart1.Plot Changes 3d bar charts viewing. .DepthToHeightRatio = 2 .WidthToHeightRatio = 2 Changes the spacing between divisions on the X-Axis. .xGap = 0 Changes the spacing between divisions on the Z-Axis. .zGap = 0.8 End WithEnd Sub调试界面显示:数据库贴图如下:参考资料来源入http:/

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 教学/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号