Hi,
I am using the eval version for TChart.Net with Delphi 2006 on a Windows XP pc. I am working with ASP.NET and I can get a chart to display. If I setup a series in designtime, when I run the ASP.NET app the chart is blank. When I inpect the seriescount in the debugges, it is 0.
Also, I tried creating the series at runtime. This works, but none of the axis appear. It seems like they do not exist. Is there a setting that makes designtime settings persist into the actual runtime? I am a longtime user of TChart for Win32, but have struggled with implementing the chart in ASP.NET. I am disappointed at the lack of any examples in Delphi. I am trying to use the C# examples, but even one Delphi code based example would be invaluable. If I can get this to work, I will show my superior to justify purchasing, but right now I can't figure out what is wrong. Any help would be appreciated.
Here is my code:
.pas
pqisdb := TORA_PQISDB.Create;
//build datatable
chartdt := DataTable.Create('charteff');
dc := DataColumn.Create('XFIELD', TypeOf(string));
chartdt.Columns.Add(dc);
dc := DataColumn.Create('BEGTIME', TypeOf(DateTime));
adc[0] := dc;
chartdt.Columns.Add(dc);
chartdt.PrimaryKey := adc;
chartdt.PrimaryKey := adc;
for i := 1 to 4 do
begin
dc := DataColumn.Create('YFIELD'+i.ToString, TypeOf(system.double));
chartdt.Columns.Add(dc);
end;
pdate := fromdate+0.25;
while pdate <= todate do
begin
dr := chartdt.NewRow;
case Convert.ToInt32( ddlTimeBasis.SelectedValue) of
1: begin //daily
dr['XFIELD'] := pdate.ToString;
dr['BEGTIME'] := pdate.ToString;
pdate := pdate + 1;
ptype := 'D';
end;
2: begin //monthly
dr['XFIELD'] := pdate.Month.ToString + '/' + pdate.Year.ToString;
dr['BEGTIME'] := pdate.ToString;
pdate := pdate.AddMonth(1);
ptype := 'M';
end;
3: begin //yearly
dr['XFIELD'] := pdate.Year.ToString;
dr['BEGTIME'] := pdate.ToString;
pdate := pdate.AddMonth(12);
ptype := 'T';
end;
end;
chartdt.Rows.Add(dr);
end;
//get prop_row
if ListBox1.SelectedValue <> '' then
begin
dr := effdt.Rows.Find(ListBox1.SelectedValue);
heading := dr['HEADING'].ToString;
prop_row := dr['PROP_ROW'].ToString;
for i := 1 to 4 do
begin
pqisdb.cctype := millinfo.cctype;
pqisdb.OpenConnection;
asql := pqisdb.BuildSQL_DailyEffByDateRange(true, true,
millinfo.lineno.ToString, fromdate, todate, ptype, prop_row);
bdpdr := pqisdb.GetDataReader(asql);
while bdpdr.Read do
begin
//update each row with the correct value
dr := chartdt.Rows.Find(bdpdr.Item['BEGTIME']);
if bdpdr.Item['FAVG'].ToString <> '' then
dr['YFIELD'+i.ToString] := bdpdr.Item['FAVG']
else
dr['YFIELD'+i.ToString] := '0';
end;
end;
for i := 1 to 4 do
begin
WebChart1.Chart.Series.Add(Steema.TeeChart.Styles.Bar.Create);
WebChart1.Chart.Series[i-1].Title := heading;
WebChart1.Chart.Series[i-1].DataSource := chartdt;
WebChart1.Chart.Series[i-1].XValues.DateTime := true;
WebChart1.Chart.Series[i-1].XValues.DataMember := 'BEGTIME';
WebChart1.Chart.Series[i-1].YValues.DataMember := 'YFIELD'+i.ToString;
WebChart1.Chart.Series[i-1].LabelMember := 'XFIELD';
WebChart1.Chart.Series[i-1].ShowInLegend := true;
WebChart1.Chart.Series[i-1].Marks.Visible := false;
WebChart1.Chart.Series[i-1].HorizAxis := Steema.TeeChart.Styles.HorizontalAxis.Bottom;
WebChart1.Chart.Series[i-1].VertAxis := Steema.TeeChart.Styles.VerticalAxis.Right;
end;
end;
pqisdb.CloseConnection;
.aspx code
<form runat="server">
<p>
<uc1:UPM_Header id="UserControl1" runat="server"></uc1:UPM_Header>
</p>
<p>
<ASP:Panel id="Panel1" style="POSITION: relative" runat="server" width="537px" height="49px">Choose Time Period:
<ASP:DropDownList id="ddlTimePeriod" runat="server">
<ASP:ListItem value="1" selected="True">Last 30 days</ASP:ListItem>
<ASP:ListItem value="2">Last 6 months</ASP:ListItem>
<ASP:ListItem value="3">Last 12 months</ASP:ListItem>
<ASP:ListItem value="4">Last 2 years</ASP:ListItem>
<ASP:ListItem value="5">Last 5 years</ASP:ListItem>
</ASP:DropDownList> Choose Time Basis:
<ASP:DropDownList id="ddlTimeBasis" runat="server">
<ASP:ListItem value="1" selected="True">By Day</ASP:ListItem>
<ASP:ListItem value="2">By Month</ASP:ListItem>
<ASP:ListItem value="3">By Year</ASP:ListItem>
</ASP:DropDownList></ASP:Panel><br>
<ASP:ListBox id="ListBox1" runat="server" autopostback="True" height="383px"></ASP:ListBox>
<tchart:WebChart id="WebChart1" runat="server" tempchart="File" clickedy="0" clickedx="0" getchartfile="GetChart.aspx" autopostback="False" width="634px" height="370px" config=""></tchart:WebChart>
</p>
</form>
Trouble with eval version designtime properties fail to work
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Kimberly,
You may want to use Borland's BabelCode client to translate C#code to Delphi code.
If your problem persists could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
I've also posted a Delphi 2006 WebForms example at the above newsgroup.
Yes, this is a known problem on our defect list to be fixed for future releases. In the meantime, you'll have to set your chart programmatically at run-time.I am using the eval version for TChart.Net with Delphi 2006 on a Windows XP pc. I am working with ASP.NET and I can get a chart to display. If I setup a series in designtime, when I run the ASP.NET app the chart is blank. When I inpect the seriescount in the debugges, it is 0.
Also, I tried creating the series at runtime. This works, but none of the axis appear. It seems like they do not exist. Is there a setting that makes designtime settings persist into the actual runtime? I am a longtime user of TChart for Win32, but have struggled with implementing the chart in ASP.NET. I am disappointed at the lack of any examples in Delphi. I am trying to use the C# examples, but even one Delphi code based example would be invaluable. If I can get this to work, I will show my superior to justify purchasing, but right now I can't figure out what is wrong. Any help would be appreciated.
You may want to use Borland's BabelCode client to translate C#code to Delphi code.
If your problem persists could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
I've also posted a Delphi 2006 WebForms example at the above newsgroup.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Trouble with eval version designtime properties fail to work
Thank you for the example. I figured out the problem. The chart gets goofy is you make the following assignment in the code:
WebChart1.Chart.Series[0].Title := '<a href="DailEff_Hints.aspx?prop_row=5" onClick="BetterPopup(this.href, ''fixed'', 300, 300); return false;">Testing</a>';
You will need more than one series in the chart and the legend showing the series titles. When the above code is used, the chart axis disappear or are offset in a way that makes them unreadable. I did not intend to use the text being assigned to the title. I was using the same info that was in my grid where the user can click on the property to get more info. Everything is fine now for me since I changed the title to not include the html syntax.
Thanks again,
Kimberly
WebChart1.Chart.Series[0].Title := '<a href="DailEff_Hints.aspx?prop_row=5" onClick="BetterPopup(this.href, ''fixed'', 300, 300); return false;">Testing</a>';
You will need more than one series in the chart and the legend showing the series titles. When the above code is used, the chart axis disappear or are offset in a way that makes them unreadable. I did not intend to use the text being assigned to the title. I was using the same info that was in my grid where the user can click on the property to get more info. Everything is fine now for me since I changed the title to not include the html syntax.
Thanks again,
Kimberly