Using strings as X axis reference with DBTeechart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
luminex248
Newbie
Newbie
Posts: 2
Joined: Tue Jan 30, 2007 12:00 am

Using strings as X axis reference with DBTeechart

Post by luminex248 » Tue Feb 06, 2007 9:15 pm

Using DBTeeChart 7.08, I have to generate a chart that represents Total Sales per Magazine issue. The problem is that the issues are represented by strings, example 'Vol 1, no. 1', 'Vol 1, no. 2', the 'Special issue 3', etc...

My query retrieves records in the proper order. How can I design the chart to have the issue string in the X axis?

PS. I am using the chart inside ReportBuilder 10.5.

Thanks

Salim

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Feb 07, 2007 12:07 pm

Hi Salim,

You could assign the issues strings as Labels, and total sales per issue as Values. That way, the chart will automatically add sequential x values (0, 1, 2, ...) but labels will be displayed in the bottom axis.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

luminex248
Newbie
Newbie
Posts: 2
Joined: Tue Jan 30, 2007 12:00 am

Post by luminex248 » Wed Feb 07, 2007 12:35 pm

This is great, I thought that the X values in series were mandatory.

Thanks and Best Regards

Salim

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Feb 07, 2007 12:45 pm

Hi Salim,

You're very welcome! I'm glad to hear this helped.

No, mandatory values are Y values. If no X values are provided TeeChart automatically adds them.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Dautm
Newbie
Newbie
Posts: 18
Joined: Sat Oct 04, 2003 4:00 am
Location: Dalmine

Post by Dautm » Fri Mar 02, 2007 4:34 am

Hi, I did what you said but I have to face a new problem: the marks are automatically setting to the label's value:

And this is my code:

FastLine fl1 = new FastLine();
fl1.YValues.DataMember = ds.Tables[0].Columns[1].ToString();
fl1.LabelMember = ds.Tables[0].Columns[0].ToString();
fl1.DataSource = ds.Tables[0];
fl1.Marks.Visible = true;
///////////////////////////////////////////////

Plz help me.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 02, 2007 8:10 am

Hi Dautm,

You can set marks to display values like this:

Code: Select all

  Series1.Marks.Style := smsValue;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Dautm
Newbie
Newbie
Posts: 18
Joined: Sat Oct 04, 2003 4:00 am
Location: Dalmine

Post by Dautm » Fri Mar 02, 2007 4:59 pm

Thank you so much. I put: fl1.Marks.Style=MarksStyles.Value; and it worked :D .

One more question please, I need to know how to modify the left axis scale because the default scale for my data (values between 0-70), is 10, so I see the following labels: 0,10,20...70 and I want for example to change the scale to 35 and see only 0,35,70.

Thx in advanced!!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 02, 2007 5:02 pm

Hi Dautm,

You're welcome.

To achieve what you request you need to set left axis increment:

Code: Select all

  Chart1.Axes.Left.Increment:=75;
More information on how to work with axes is available in Tutorial 4 - Axis Control. You'll find the tutorials at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Dautm
Newbie
Newbie
Posts: 18
Joined: Sat Oct 04, 2003 4:00 am
Location: Dalmine

Post by Dautm » Fri Mar 02, 2007 6:15 pm

Thx so much again. I have just read that tutorial and it was useful to solve other issues about Axes but now I have a Mark issue. How can I set the format to my Marks because I need to show 4 decimals and the default is only 3 decimals

Thx in advanced.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Mar 12, 2007 9:27 am

Hi Dautm,

you can format the value using :
Series1.ValueFormat := '###,###,###.###';

Post Reply