john kanyora

john kanyora

  • 1.7k
  • 242
  • 24.7k

bar chart not fitting in the web page

Dec 14 2017 5:27 AM
my bar is no fitting on my web page inside the table define.kindly asking for help on how to do it.below is my code for the taable definition and the code for the bar.
this is the code for the definition of the table
<table id="table6" cellspacing="1" cellpadding="1" class="SmartPanelsTable" style="width: 90%">
<sp6:CollectionAlerts ID="CollectionAlertsPanel" runat="server"></sp6:CollectionAlerts>
this is the code for the bar
string connect=TraceBizCommon.Configuration.ConfigSettings.ConnectionString;
SqlConnection conn = new SqlConnection(connect);
SqlCommand cmd = new SqlCommand("select Customer,[Total Amount] from CustomerDebts ", conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
string[] x = new string[dt.Rows.Count];
decimal[] y = new decimal[dt.Rows.Count];
for (int i = 0; i<dt.Rows.Count; i++)
x[i] = dt.Rows[i][0].ToString();
y[i] = Convert.ToInt32(dt.Rows[i][1]);
BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = y});
BarChart1.CategoriesAxis = string.Join(",", x);
BarChart1.ChartWidth = (x.Length * 100).ToString();
BarChart1.ChartHeight = (y.Length * 75).ToString();
<body >
<asp:BarChart ID="BarChart1" ChartType="bar" runat="server"></asp:BarChart>

Brought to you by:

Answers (1)