Foxtable(狐表)用户栏目专家坐堂 → 饼图


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

主题:饼图

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


加好友 发短信
等级:婴狐 帖子:58 积分:713 威望:0 精华:0 注册:2015/5/11 20:47:00
饼图  发帖心情 Post By:2015/9/13 21:32:00 [只看该作者]

"待派工耗时M","待维修耗时M","维修耗时M","待检验耗时M","检验耗时M"是表的列名,求这些列的饼图

Dim Chart As WinForm.Chart 
Dim Series As WinForm.ChartSeries 
Dim t As Table = Tables("停机处置") 
Dim q1 As Single = val(t.Compute("Avg(" & "待派工耗时M" & ")", "[待派工耗时M] > 0"))
Dim q2 As Single = val(t.Compute("Avg(" & "待维修耗时M" & ")", "[待维修耗时M] > 0"))
Dim q3 As Single = val(t.Compute("Avg(" & "维修耗时M" & ")", "[维修耗时M] > 0"))
Dim q4 As Single = val(t.Compute("Avg(" & "待检验耗时M" & ")", "[待检验耗时M] > 0"))
Dim q5 As Single = val(t.Compute("Avg(" & "检验耗时M" & ")", "[检验耗时M] > 0"))
Dim qq() As Single = {q1,q2,q3,q4,q5}
Dim ss() As String = {"待派工耗时M","待维修耗时M","维修耗时M","待检验耗时M","检验耗时M"}
Dim sm As Integer = t.Compute("Sum(qq)") 
Chart= Forms("报表").Controls("Chart4") 
Chart.VisualEffect = True 
Chart.ChartType = ChartTypeEnum.Pie 
For Each r As Row In t.Rows
    Series = Chart.SeriesList.Add() 
    Series.Length = 1 
    Series.Text = r(" & ss & ") & "(" & r("qq") & ")" 
    Series.Y(0) = r("qq") '指定值
    Series.DataLabelText = Math.Round(r("qq")*100/sm,2) & "%" 
Next
Chart.LegendVisible = True 
Chart.LegendCompass= CompassEnum.East '

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/9/14 10:04:00 [只看该作者]

Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries
Dim t As Table = Tables("停机处置")
Dim q1 As Single = val(t.Compute("Avg(" & "待派工耗时M" & ")", "[待派工耗时M] > 0"))
Dim q2 As Single = val(t.Compute("Avg(" & "待维修耗时M" & ")", "[待维修耗时M] > 0"))
Dim q3 As Single = val(t.Compute("Avg(" & "维修耗时M" & ")", "[维修耗时M] > 0"))
Dim q4 As Single = val(t.Compute("Avg(" & "待检验耗时M" & ")", "[待检验耗时M] > 0"))
Dim q5 As Single = val(t.Compute("Avg(" & "检验耗时M" & ")", "[检验耗时M] > 0"))
Dim qq() As Single = {q1,q2,q3,q4,q5}
Dim ss() As String = {"待派工耗时M","待维修耗时M","维修耗时M","待检验耗时M","检验耗时M"}
Dim sm As Integer = q1+q2+q3+q4+q5
Chart= Forms("报表").Controls("Chart4")
Chart.VisualEffect = True
Chart.ChartType = ChartTypeEnum.Pie
For i As Integer = 0 to ss.length -1
    Series = Chart.SeriesList.Add()
    Series.Length = 1
    Series.Text = ss(i) & "(" & qq(i) & ")"
    Series.Y(0) = qq(i) '指定值
    Series.DataLabelText = Math.Round(qq(i)*100/sm,2) & "%"
Next
Chart.LegendVisible = True
Chart.LegendCompass= CompassEnum.East '

 回到顶部