Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共16 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:[求助]折线图百分比格式

1楼
lgj716330 发表于:2024/10/31 14:10:00
当折线图是多图系时,下面怎么改
Dim c1Chart1 = Chart.basecontrol
Dim lbls = c1Chart1.ChartLabels
For i As Integer = 0 To 12
    Dim lbl As C1.Win.C1Chart.Label = lbls.LabelsCollection.AddNewLabel()
    lbl.Text = Format(series.y(i), "0.00%")
    lbl.AttachMethod = C1.Win.C1Chart.AttachMethodEnum.DataIndex
    lbl.AttachMethodData.GroupIndex = 0
    lbl.AttachMethodData.SeriesIndex = 0
    lbl.AttachMethodData.PointIndex = i
    If Series.Y(i) >= 0 Then
        lbl.Style.ForeColor = Color.Black
    Else
        lbl.Style.ForeColor = Color.Red
    End If
    lbl.style.font = New font("宋体", 15)
    lbl.Compass = LabelCompassEnum.North
    lbl.Visible = True
Next
2楼
有点蓝 发表于:2024/10/31 14:21:00
改什么?有什么问题?
3楼
lgj716330 发表于:2024/10/31 14:46:00
两条折线的时候,只有其中一条设置了百分比格式,另一条没成功。数据点的位置也不对,不知道如何调整

图片点击可在新窗口打开查看此主题相关图片如下:微信图片_20241031144258.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2024/10/31 14:49:55编辑过]
4楼
有点蓝 发表于:2024/10/31 14:50:00
完整代码发上来
5楼
lgj716330 发表于:2024/10/31 15:07:00
Dim Chart As WinForm.Chart 
Dim Series As WinForm.ChartSeries 
Dim t As Table = Tables("实销流水同期比较") 
Chart = e.Form.Controls("Chart2") 
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.DataSource = "实销流水同期比较"
Chart.SeriesList.Clear()
Chart.AxisY.AnnoFormatString="00%"
For Each c As Col In t.Cols
    If c.Name <> "月份"  Then
        Series = Chart.SeriesList.Add()
        Series.Text = c.Name
        Series.X.DataField = "月份"
        Series.Y.DataField = c.Name
    End If
Next

Chart.HeaderText = "销售增长情况" 

Dim c1Chart1 = Chart.basecontrol
Dim lbls = c1Chart1.ChartLabels
For i As Integer = 0 To t.Rows.Count
    Dim lbl As C1.Win.C1Chart.Label = lbls.LabelsCollection.AddNewLabel()
    lbl.Text = Format(series.y(i), "0.00%")
    lbl.AttachMethod = C1.Win.C1Chart.AttachMethodEnum.DataIndex
    lbl.AttachMethodData.GroupIndex = 0
    lbl.AttachMethodData.SeriesIndex = 0
    lbl.AttachMethodData.PointIndex = i
    If Series.Y(i) >= 0 Then '根据值进行判断,如果大于0则为黑色,如果小于0则为红色
        lbl.Style.ForeColor = Color.Black
    Else
        lbl.Style.ForeColor = Color.Red
    End If
    lbl.style.font = New font("宋体", 15)
    lbl.Compass = LabelCompassEnum.North
    lbl.Visible = True
Next
6楼
有点蓝 发表于:2024/10/31 15:16:00
Dim Chart As WinForm.Chart 
Dim Series As WinForm.ChartSeries 
Dim t As Table = Tables("实销流水同期比较") 
Chart = e.Form.Controls("Chart2") 
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.DataSource = "实销流水同期比较"
Chart.SeriesList.Clear()
Chart.AxisY.AnnoFormatString = "00%"
Chart.HeaderText = "销售增长情况" 

Dim c1Chart1 = Chart.basecontrol
Dim lbls = c1Chart1.ChartLabels

For Each c As Col In t.Cols
    If c.Name <> "月份" Then
        Series = Chart.SeriesList.Add()
        Series.Text = c.Name
        Series.X.DataField = "月份"
        Series.Y.DataField = c.Name
        
        For i As Integer = 0 To t.Rows.Count
            Dim lbl As C1.Win.C1Chart.Label = lbls.LabelsCollection.AddNewLabel()
            lbl.Text = Format(series.y(i), "0.00%")
            lbl.AttachMethod = C1.Win.C1Chart.AttachMethodEnum.DataIndex
            lbl.AttachMethodData.GroupIndex = 0
            lbl.AttachMethodData.SeriesIndex = 0
            lbl.AttachMethodData.PointIndex = i
            If Series.Y(i) >= 0 Then '根据值进行判断,如果大于0则为黑色,如果小于0则为红色
                lbl.Style.ForeColor = Color.Black
            Else
                lbl.Style.ForeColor = Color.Red
            End If
            lbl.style.font = New font("宋体", 15)
            lbl.Compass = LabelCompassEnum.North
            lbl.Visible = True
        Next
    End If
Next
7楼
lgj716330 发表于:2024/10/31 18:32:00
还是不行
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目2.foxdb


8楼
有点蓝 发表于:2024/10/31 20:03:00
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目2.zip

9楼
lgj716330 发表于:2024/11/1 17:15:00
Chart.SeriesList.Clear() 这里没起作用,切换数据的时候数据标示仍会重叠
10楼
有点蓝 发表于:2024/11/1 17:17:00
Dim lbls = c1Chart1.ChartLabels
lbls.clear
共16 条记录, 每页显示 10 条, 页签: [1] [2]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03906 s, 4 queries.