Foxtable(狐表)用户栏目专家坐堂 → label怎么做走势图啊!


  共有9980人关注过本帖平板打印复制链接

主题:label怎么做走势图啊!

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/4 17:14:00 [只看该作者]

 

Dim d1 As Date = e.Form.Controls("DateTimePicker1").Value
Dim filter1 As String
If e.Form.Controls("RadioButton1").Checked Then
    Dim w As Integer = d1.DayOfWeek '算出今天是星期几
    Dim dt1 As Date = d1.AddDays(-w) '获取本周的第一天
    Dim dt2 As Date = d1.AddDays(6 - w) '获取本周的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton2").Checked Then
    Dim y As Integer = d1.Year
    Dim m As Integer = d1.Month
    Dim dt1 As New Date(y, m, 1)
    Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton3").Checked Then
    Dim y As Integer = d1.Year
    Dim dt1 As New Date(y, 1, 1)
    Dim dt2 As New Date(y, 12, 31)
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton5").Checked Then
    Dim y As Integer = d1.Year
    Dim q As Integer = (d1.Month - 1) \ 3 + 1 '计算现在是第几个季度
    Dim dt1 As New Date(y, 3 * (q - 1) + 1, 1) '获取本季度的第一天
    Dim dt2 As New Date(y, 3 * q, Date.DaysInMonth(y,3 * q)) '获取本季度的最后一天
    Filter1 = "回款日期 >= #" & dt1 & "# And 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton4").Checked Then
    filter1 = "1=1"
End If

Dim Chart As WinForm.Chart = e.Form.Controls("Chart3") ' 引用窗口中的图表
Dim series As winform.ChartSeries
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.AxisX.ClearValueLabel
Dim tp As DateGroupEnum = 0
For i As Integer = 111 To 115
    Dim c As WinForm.RadioButton= e.Form.Controls("RadioButton" & i)
    If c.Checked Then
        Select Case c.Text
            Case "年"
                tp = DateGroupEnum.Year
            Case "季度"
                tp = DateGroupEnum.Quarter
            Case "月"
                tp = DateGroupEnum.month
            Case "周"
                tp = DateGroupEnum.Week
            Case "天"
                tp = DateGroupEnum.None
        End Select
       
        Exit For
       
    End If
Next
Dim g As New GroupTableBuilder("统计表1", DataTables("表A"))
g.Groups.AddDef("回款日期", tp, "日期")
g.Totals.AddDef("销售额")
g.Totals.AddDef("货物成本")
g.Totals.AddDef("物流成本")
g.Totals.AddDef("其它成本")
g.Totals.AddDef("合计成本")
g.Totals.AddDef("利润")
g.Filter = filter1
g.Build()

Dim t As Table = Tables("统计表1")
t.Sort = "日期"
For i As Integer = 111 To 116
    Dim c As WinForm.CheckBox = e.Form.Controls("CheckBox" & i)
    If c.Checked Then
        Series = Chart.SeriesList.Add() '增加一个图系
        Series.Length = t.Rows.Count
        Series.Text = c.Text
        For r As Integer = 0 To t.Rows.Count - 1
            Series.X(r) = r
            Series.Y(r) = t.Rows(r)(c.Text)
        Next
    End If
Next

For r As Integer = 0 To t.Rows.Count - 1
    Chart.AxisX.SetValueLabel(r, t.Rows(r)("日期")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.AxisX.AnnoRotation = - 45 'X轴标示逆时针旋转45度
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)


 回到顶部
总数 93 1 2 3 4 5 6 7 8 9 10 下一页