データテーブルから値を取得する円グラフがあります。
これは私のコードです:
ASP.NET コード:
<asp:Chart ID="Chart1" runat="server" EnableViewState="True">
<Series>
<asp:Series ChartType="Pie" Legend="% Completed" Name="Series1" XAxisType="Secondary" XValueType="Double" YValueType="Double">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea BorderWidth="5" Name="ChartArea1">
<Area3DStyle Enable3D="True" WallWidth="15" />
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend Name="% Completed" Title="% Completed">
</asp:Legend>
</Legends>
<Titles>
<asp:Title Name="Completed" Text="Completed">
</asp:Title>
<asp:Title Name="Title1">
</asp:Title>
</Titles>
</asp:Chart>
VB.NET コード:
のセッション変数を設定します GetTable()
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load, Chart1.Load
Dim ProjectID As Integer = Session("project_id")
Session("ProjectID") = ProjectID
lblProjNameHeading.Text = "[ " + ProjectID.ToString + " ]"
Dim conn As New SqlConnection("Data Source=BRIAN-PC\SQLEXPRESS;Initial Catalog=master_db;Integrated Security=True")
Dim projComm As String = "SELECT project_id, project_start, project_finish, project_budget, project_cost FROM projects WHERE project_id=@parameter"
Dim projSQL As New SqlCommand
conn.Open()
projSQL = New SqlCommand(projComm, conn)
projSQL.Parameters.AddWithValue("@parameter", ProjectID.ToString)
Dim datareader As SqlDataReader = projSQL.ExecuteReader()
While datareader.Read
lblProjectCode.Text = datareader("project_id").ToString
lblProjectStart.Text = datareader("project_start").ToString
lblProjectStart2.Text = datareader("project_start").ToString
lblProjectEnd.Text = datareader("project_finish").ToString
lblProjectEnd2.Text = datareader("project_finish").ToString
lblProjectBudget.Text = datareader("project_budget").ToString
lblProjectBudget2.Text = datareader("project_budget").ToString
lblProjectCost.Text = datareader("project_cost").ToString
lblProjectCost2.Text = datareader("project_cost").ToString
' lblProjectLeader.Text = datareader("project_cost").ToString
'lblProjectExpenditures.Text = agdgssag
Dim StartDate As DateTime = datareader("project_start")
Dim FinishDate As DateTime = datareader("project_finish")
Dim today As DateTime = DateTime.Now
Dim sumDays = (FinishDate - StartDate).TotalDays
Dim daysToNow = (today - StartDate).TotalDays
Dim percentage = daysToNow / sumDays * 100
Dim percentageLeft = 100 - percentage
Session("PercentageCompleted") = percentage
Session("PercentageLeft") = percentageLeft
GetTable()
lblProjectPercentage.Text = percentage.ToString("N2") + "%"
End While
datareader.Close()
conn.Close()
If Not Page.IsPostBack Then
BindData()
End If
End Sub
問題は、コードを実行すると円グラフが表示されないことです。
誰かが何が悪いのか教えてもらえますか?