Foxtable(狐表)用户栏目专家坐堂 → 关联表图表生成


  共有5012人关注过本帖树形打印复制链接

主题:关联表图表生成

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/22 12:21:00 [显示全部帖子]

Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim dt1 As DataTable = DataTables("表A") '定义一个变量t引用数据表
Dim dt2 As DataTable = DataTables("表B")
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.SeriesList.Clear() '清除图表原来的图系
Dim filter As String = "日期 >= #" & Date.Today & "# and 日期 <= #" & Date.Today.AddMonths(1) & "#"
For Each dr As DataRow In dt1.Select("选择 = true")
    Series = Chart.SeriesList.Add() '增加一个图系
    series.Text = dr("成员")
    Dim drs As List(Of DataRow) = dt2.Select("成员 = '" & dr("成员") & "' and " & filter)
    series.Length = drs.Count
    For i As Integer = 0 To drs.Count - 1
        Series.X(i) = i
        Series.Y(i) = drs(i)("体重")
    Next
Next
Dim r As Integer = 0
Do
    Chart.AxisX.SetValueLabel(r, Format(Date.Today.AddDays(r),"dd")) '指定字符表示
    r+=1
Loop While Date.Today.AddDays(r) <= Date.Today.AddMonths(1)

Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/22 14:30:00 [显示全部帖子]

Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim dt1 As DataTable = DataTables("表A") '定义一个变量t引用数据表
Dim dt2 As DataTable = DataTables("表B")
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.SeriesList.Clear() '清除图表原来的图系
Dim filter As String = "成员 in ('" & dt1.GetComboListString("成员", "选择 = true").Replace("|", "','") & "')"
Dim max As Date = dt2.Compute("max(日期)", filter)
For Each dr As DataRow In dt1.Select("选择 = true")
    Series = Chart.SeriesList.Add() '增加一个图系
    series.Text = dr("成员")
    series.Length = 30
    For i As Integer = 0 To 29
        Dim fdr As DataRow = dt2.Find("成员 = '" & dr("成员") & "' and 日期 = #" & max.AddDays(i-29) & "#")
        If fdr IsNot Nothing Then
            Series.X(i) = i
            Series.Y(i) = fdr("体重")
        Else
            Series.X(i) = i
            Series.Y(i) = 0
        End If
    Next
Next

For i As Integer = 0 To 29
    Chart.AxisX.SetValueLabel(i, Format(max.AddDays(i-29),"dd")) '指定字符表示
Next

Chart.AxisX.AnnoWithLabels = True '启用字符标示
'Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/22 15:42:00 [显示全部帖子]

 

 

Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim dt1 As DataTable = DataTables("表A") '定义一个变量t引用数据表
Dim dt2 As DataTable = DataTables("表B")
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.SeriesList.Clear() '清除图表原来的图系

Chart.AxisX.ClearValueLabel
Dim filter As String = "成员 in ('" & dt1.GetComboListString("成员", "选择 = true").Replace("|", "','") & "')"
Dim max As Date = dt2.Compute("max(日期)", filter)
For Each dr As DataRow In dt1.Select("选择 = true")
    Series = Chart.SeriesList.Add() '增加一个图系
    series.Text = dr("成员")
    series.Length = 30
    For i As Integer = 0 To 29
        Dim fdr As DataRow = dt2.Find("成员 = '" & dr("成员") & "' and 日期 = #" & max.AddDays(i-29) & "#")
        If fdr IsNot Nothing Then
            Series.X(i) = i
            Series.Y(i) = fdr("体重")
        Else
            Series.X(i) = i
            Series.Y(i) = 0
        End If
    Next
Next

For i As Integer = 0 To 29
    Chart.AxisX.SetValueLabel(i, Format(max.AddDays(i-29),"dd")) '指定字符表示
Next

Chart.AxisX.AnnoWithLabels = True '启用字符标示
'Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/22 16:02:00 [显示全部帖子]

 留空

 

Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim dt1 As DataTable = DataTables("表A") '定义一个变量t引用数据表
Dim dt2 As DataTable = DataTables("表B")
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.SeriesList.Clear() '清除图表原来的图系

Chart.AxisX.ClearValueLabel
Dim filter As String = "成员 in ('" & dt1.GetComboListString("成员", "选择 = true").Replace("|", "','") & "')"
Dim max As Date = dt2.Compute("max(日期)", filter)
For Each dr As DataRow In dt1.Select("选择 = true")
    Series = Chart.SeriesList.Add() '增加一个图系
    series.Text = dr("成员")
    series.Length = 30
    For i As Integer = 0 To 29
        Dim fdr As DataRow = dt2.Find("成员 = '" & dr("成员") & "' and 日期 = #" & max.AddDays(i-29) & "#")
        If fdr IsNot Nothing Then
            Series.X(i) = i
            Series.Y(i) = fdr("体重")
        Else
            'Series.X(i) = i
            'Series.Y(i) = 0
        End If
    Next
Next

For i As Integer = 0 To 29
    Chart.AxisX.SetValueLabel(i, Format(max.AddDays(i-29),"dd")) '指定字符表示
Next

Chart.AxisX.AnnoWithLabels = True '启用字符标示
'Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/22 16:04:00 [显示全部帖子]

平行

 

Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim dt1 As DataTable = DataTables("表A") '定义一个变量t引用数据表
Dim dt2 As DataTable = DataTables("表B")
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.SeriesList.Clear() '清除图表原来的图系

Chart.AxisX.ClearValueLabel
Dim filter As String = "成员 in ('" & dt1.GetComboListString("成员", "选择 = true").Replace("|", "','") & "')"
Dim max As Date = dt2.Compute("max(日期)", filter)
For Each dr As DataRow In dt1.Select("选择 = true")
    Series = Chart.SeriesList.Add() '增加一个图系
    series.Text = dr("成员")
    series.Length = 30
    For i As Integer = 0 To 29
        Dim fdr As DataRow = dt2.Find("成员 = '" & dr("成员") & "' and 日期 = #" & max.AddDays(i-29) & "#")
        If fdr IsNot Nothing Then
            Series.X(i) = i
            Series.Y(i) = fdr("体重")
           
        Else
            Series.X(i) = i
            If i = 0 Then
                Series.Y(i) = 0
            Else
                Series.Y(i) = Series.Y(i-1)
            End If
        End If
    Next
Next

For i As Integer = 0 To 29
    Chart.AxisX.SetValueLabel(i, Format(max.AddDays(i-29),"dd")) '指定字符表示
Next

Chart.AxisX.AnnoWithLabels = True '启用字符标示
'Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/22 16:14:00 [显示全部帖子]

 看9楼

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/22 16:49:00 [显示全部帖子]

 你这种,参考2楼代码。

 回到顶部