-- 作者:有点甜
-- 发布时间:2017/7/20 12:40:00
--
参考
Dim Chart As WinForm.Chart \'定义一个图表变量 Dim Series As WinForm.ChartSeries \'定义一个图系变量 Chart= e.Form.Controls("Chart1") \' 引用窗口中的图表 Chart.SeriesList.Clear() \'清除图表原来的图系 Series = Chart.SeriesList.Add() \'增加一个图系 Series.Length = 10 \'新增图系包括10个数据点 For i As Integer = 0 To 9 \'指定每个数据点的位置 Series.X(i) = i \'指定水平坐标 Series.Y(i) = i + Rand.Next(5) \'垂直坐标用随机数生成 Next Dim c1Chart1 = Chart.basecontrol Dim lbls = c1Chart1.ChartLabels For i As Integer = 0 To 9 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 lbl.Style.ForeColor = Color.Red lbl.Compass = LabelCompassEnum.South lbl.Visible = True Next
|