protected void Page_Load(object sender, EventArgs e)
{
int count = 0;
string[] categories = new string[100];
double[] yValues = new double[100];
SqlConnection conBudget = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
SqlCommand cmdCount = new SqlCommand("SELECT COUNT(*) AS COUNT FROM DailyBudget WHERE (Username=@username)", conBudget);
SqlCommand cmdBudget = new SqlCommand("SELECT Foods, Clothes, Drinks, Entertaiment FROM DailyBudget WHERE (Username=@username)", conBudget);
SqlCommand cmdColumnName = new SqlCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='DailyBudget' ORDER BY ORDINAL_POSITION", conBudget);
conBudget.Open();
cmdCount.Parameters.AddWithValue("@username", Master.getUsername);
cmdBudget.Parameters.AddWithValue("@username", Master.getUsername);
SqlDataReader dtrCount = cmdCount.ExecuteReader();
if (dtrCount.Read())
count = Convert.ToInt32(dtrCount["COUNT"].ToString());
dtrCount.Close();
SqlDataReader dtrColumnName = cmdColumnName.ExecuteReader();
if (dtrColumnName.Read())
//for (int i = 0, x = 1; i < count; i++,x++)
// categories[i] = dtrColumnName[x].ToString();
dtrColumnName.Close();
SqlDataReader dtrBudget = cmdBudget.ExecuteReader();
if (dtrBudget.Read())
for(int i = 0; i < count; i++)
yValues[i] = Convert.ToDouble(dtrBudget[i].ToString());
dtrBudget.Close();
conBudget.Close();
double[] yValuess = {0, 75.54, 60.45, 34.73, 85.42};
string[] xValues = {"France", "Canada", "Germany", "USA", "Italy"};
insertChart(xValues, yValuess);
}
protected void insertChart(string[] xValues, double[] yValues)
{
pcBudget.Series["Series1"]["PieLabelStyle"] = "Outside";
pcBudget.Series["Series1"].Points.DataBindXY(xValues, yValues);
pcBudget.Series["Series1"].EmptyPointStyle.IsValueShownAsLabel = false;
pcBudget.Series["Series1"].EmptyPointStyle.IsVisibleInLegend = false;
pcBudget.Series["Series1"].LegendText = "#VALX #PERCENT{P2}";
pcBudget.DataManipulator.Sort(PointSortOrder.Descending, pcBudget.Series["Series1"]);
}
i hope my statement not wrong, but when i execute the label is still visible same as the legend.
which mean it doesn't work for me. P/S: dummy values used for testing.