在饼图图例中显示文本

时间:2019-07-15 12:46:51

标签: asp.net vb.net

我想在饼图中显示百分比,在图例中我想以不同的颜色显示饼图中每个切片的文本。当前百分比在饼图中显示,图例也显示百分比,但我不希望这样。

Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("##").ConnectionString)

            Using cmd As New SqlCommand("SELECT Code, COUNT(MedicalResultsID) AS 'Total Completed Medical'  FROM tblMedicalResults WHERE MONTH(DateTested) = MONTH(GETDATE()) AND completed = 1 group by Code ", conn)

                Dim series As Series = PieChartMonthToDate.Series("Series1")
                conn.Open()

                Dim rdr As SqlDataReader = cmd.ExecuteReader()

                While rdr.Read()

                    series.Points.AddXY(rdr("Code").ToString(), rdr("Total Completed Medical".ToString()))
                    PieChartMonthToDate.Series("Series1").Label = "#PERCENT{P2}"
                    PieChartMonthToDate.Series("Series1").LegendText = "#VALX"
                    PieChartMonthToDate.Legends(0).LegendStyle = LegendStyle.Column
                    PieChartMonthToDate.Legends(0).Docking = Docking.Right
                    PieChartMonthToDate.Legends(0).Alignment = System.Drawing.StringAlignment.Center

                End While
                rdr.Close()

            End Using

0 个答案:

没有答案