2020年5月7日 星期四

vb.net Chart 連結 DataTable [Connect DataTable with Chart]


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Imports System.Windows.Forms.DataVisualization.Charting


    Private Sub frmReportSaleGraphic_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim ds As DataTable


        Chart1.Series.Clear()

        Chart1.DataSource = ds

        Chart1.Series.Add("Producto")

        Chart1.Series("Producto").IsVisibleInLegend = False

        Chart1.Series("Producto").ChartType = DataVisualization.Charting.SeriesChartType.Column

        Chart1.Series("Producto").XValueMember = "Product"

        Chart1.Series("Producto").YValueMembers = "Total"

        Chart1.DataBind()

    End Sub

沒有留言:

張貼留言