0
我有變量填充我的程序和最後一個表格,我試圖顯示一個餅圖,顯示每個費用相對於總費用的部分。我現在所擁有的代碼如下:試圖創建餅圖
Sub Chart()
Chart1.Series("Expenses").ChartType = SeriesChartType.Pie
Chart1.Series("Expenses").Points.Add(GlobalVariables.cellphone/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.carinsurance/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.drappointments/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.grocery/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.healthinsurance/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.medications/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.misc/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.rent/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.therapysessions/totalexpenses * 100)
Chart1.Series("Expenses").Points.Add(GlobalVariables.travel/totalexpenses * 100)
'Chart1.Width = 700
Chart1.Legends.Add("Expenses")
Chart1.Legends("Expenses").LegendStyle = LegendStyle.Table
End Sub
當我運行該程序,包括調用子,圖表不會顯示在所有和傳說仍然只顯示「系列1」。我究竟做錯了什麼?我該如何做這項工作?