Solved

DB Chart Axis Components from ADO

Posted on 2006-11-22
3
409 Views
Last Modified: 2010-04-05
Hi all,

I found an article on about.com that helped me figure out how to set the series to a field that does not appear in the code - however, they have a line of code that I do not understand and cannot figure out the equivalent in my app:

with DBChart1.SeriesList.Series[0] do begin
 DataSource := ADOQuery1;
 XLabelsSource := ADOQuery1Company.FieldName;
 XValues.ValueSource := ADOQuery1SumItems.FieldName;
 YValues.ValueSource := '';
 Marks.Style := smsXValue;
 CheckDataSource;


My Query is ADOQuerySalesman and my field is u_name
It does not have full source, so I am not sure what ADOQuery1Company.FieldName is supposed to represent.  I tried using ADOQuerySalesman.u_name, I tried using ADOQuerySalesmanu_name.Fieldname - I'm not sure what that line represents - can anyone help?  Either with this specifically - or any help with DBChart and how to set it up via code

Thanks all!
0
Comment
Question by:Chipmunk77
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
calinutz earned 125 total points
Comment Utility
ADOQuery1Company is the name of the field assigned by delphi when you access the ADOQuery in the Object Treeview and on right click select Add all fields.
When you do that all the fields returned by your query (written in design time) will appear there in a fieldname, that usually looks like this:
queryfieldname1, queryfieldname2... and so on... depending on what fields you return with your query.


So a short example:
Query name='myquery'
Query= 'select name, address, date, day from table1'
// now when you go to Object treeview and right click on your query component, choose Add All Fields, and your automatic fields will appear bellow in the treeview as follows:
myqueryname,myqueryaddress,myquerydate,myqueryday

Do you understand now?

0
 
LVL 11

Expert Comment

by:calinutz
Comment Utility
Instead of using the exact demo of the tutorial you could use an alternative to that assignment such as:


with DBChart1.SeriesList.Series[0] do begin
 DataSource := ADOQuery1;
 XLabelsSource :=ADOQuery1.Fields[0].DisplayName;
 XValues.ValueSource := ADOQuery1.Fields[1].DisplayName;
 YValues.ValueSource := '';
 Marks.Style := smsXValue;
 CheckDataSource;



It should work
0
 

Author Comment

by:Chipmunk77
Comment Utility
Thanks!  I understand now, that will be very helpful!  :-)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now