以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]折线图百分比格式 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=193994) |
||||
-- 作者: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
|
||||
-- 作者:有点蓝 -- 发布时间:2024/10/31 14:21:00 -- 改什么?有什么问题? |
||||
-- 作者:lgj716330 -- 发布时间:2024/10/31 14:46:00 -- 两条折线的时候,只有其中一条设置了百分比格式,另一条没成功。数据点的位置也不对,不知道如何调整 [此贴子已经被作者于2024/10/31 14:49:55编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/10/31 14:50:00 -- 完整代码发上来 |
||||
-- 作者: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
|
||||
-- 作者:有点蓝 -- 发布时间: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
|
||||
-- 作者:lgj716330 -- 发布时间:2024/10/31 18:32:00 -- 还是不行 |
||||
-- 作者:有点蓝 -- 发布时间:2024/10/31 20:03:00 --
|
||||
-- 作者:lgj716330 -- 发布时间:2024/11/1 17:15:00 -- Chart.SeriesList.Clear() 这里没起作用,切换数据的时候数据标示仍会重叠 |
||||
-- 作者:有点蓝 -- 发布时间:2024/11/1 17:17:00 -- Dim lbls = c1Chart1.ChartLabels lbls.clear
|