Peter Chan
asked on
Problem to Chart
Hi,
The chart in the beginning part of page, is not being shown properly with the data from the table
http://my-friend.co/HouseList4/Default.aspx?userid=mc1
what can be the reason of problem? Here are the codes to create the chart
The chart in the beginning part of page, is not being shown properly with the data from the table
http://my-friend.co/HouseList4/Default.aspx?userid=mc1
what can be the reason of problem? Here are the codes to create the chart
string query = "select [house_sch].dbo.getletter(ROW_NUMBER() OVER (ORDER BY house_id)) house_name, price from [house_sch].[dbo].[house_tab] order by house_id";
DataTable dt = GetData(query);
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.ChartTitle = "房价的起伏与升跌";
ASKER
Thanks a lot. What did you adjust to show the chart?
There is no error to the chart.
There is no error to the chart.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Appreciated. What can be reason that chart is not shown properly, to my case?
What can be reason that chart is not shown properly, to my case?
try to put some break points in your codes and then check and make sure your DataTable dt returns something?
Yes, query is returning records
ok, try make sure:
you got ScriptManager in front end?
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
and make break point(s) in code behind, probably at line:
string[] x = new string[dt.Rows.Count];
and see if you can find out the abnormally?
ASKER
Yes, details are fine. There was no problem at all, before this, and I do not know why problem arose, without applying any change/adjustment.
ok, no idea too.
try to re-build your solution and see if there's any errors
also use simple method as shown in ID: 42482247, perhaps on a new page file and see if you can generate that chart successfully.
try to re-build your solution and see if there's any errors
also use simple method as shown in ID: 42482247, perhaps on a new page file and see if you can generate that chart successfully.
ASKER
Sorry to that I want to see if there is any clue now, to current issue.
think need apply some debugging techniques (like putting the break points, etc) in order to find out the exact issues from your codes.
but unfortunately we can't remotely login to your System for debugging, so we only can provide guidance how we usually solve similar issues.
but unfortunately we can't remotely login to your System for debugging, so we only can provide guidance how we usually solve similar issues.
ASKER
I am checking the deployed Web page and how to detect the reason of current problem?
I am checking the deployed Web page and how to detect the reason of current problem?another way will be write the log to a file and debug from it.
have you heard about log4net library before?
you can easily integrate it to your VS project via Nuget:
log4net 2.0.8
https://www.nuget.org/packages/log4net/
ASKER
Hi Ryan,
I did also show you the query last time. Do you think which column value (of query) can give any clue of the issue?
I did also show you the query last time. Do you think which column value (of query) can give any clue of the issue?
Do you think which column value (of query) can give any clue of the issue?if your query did return records then your chart should show the results...
i would suggest to use the techniques mentioned (putting breakpoints and write to log, etc) for debugging.
else you probably can start doing a basic one and then use it to examine your existing one.
what error have you encountered?