I have two integer values ta and thc and I'm making the percentage calculation for these two values and pass these values to asp chart labels on each column as shown in the below code.
while (myread2.Read())
{
while (myread.Read())
{
string ta1 = myread["totalapplied"].ToString();
string thc1 = myread2["THC"].ToString();
Int32 ta = Convert.ToInt32(ta1);
Int32 thc = Convert.ToInt32(thc1);
var calc = (((double)ta / (double)thc) * 100);
string percentCalc = Convert.ToString(String.Format("{0:0.00}", calc)); // I want to pass this value for each column for each read on the loop
lblcount.Text = myread["totalapplied"].ToString();
this.Chart1.Series["Series1"].Points.AddXY(myread["categ"], myread["totalapplied"]);
this.Chart1.Series["Series1"].Legend = "Leg";
Chart1.Series["Series1"].IsValueShownAsLabel = true;
Chart1.Series["Series1"].Label = percentCalc; //I need the calculated value here
Chart1.Series["Series1"].ToolTip = "Shift: #VALX \\nCount: #VALY";
Chart1.Legends.Clear();
Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
}
this.Chart1.Series["Series2"].Points.AddXY(myread2["date1"], myread2["THC"]);
this.Chart1.Series["Series2"].Legend = "Leg";
Chart1.Series["Series2"].IsValueShownAsLabel = true;
Chart1.Series["Series2"].Label = "100%";
Chart1.Series["Series2"].ToolTip = "Shift: #VALX \\nCount: #VALY";
Chart1.Legends.Clear();
Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Angle = -45;
}
con.Close();
So from the above code, it repeats the very last value of the loop to each and every column of the chart. How can I pass the individual calculations to the label? Thanks in advance...
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)