Line Chart Start and End Problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Paul Saxton
Newbie
Newbie
Posts: 6
Joined: Tue Nov 04, 2003 5:00 am
Location: UK

Line Chart Start and End Problem

Post by Paul Saxton » Tue Dec 16, 2003 1:01 pm

Hello!

I have a strange problem where the line of my line/bar chart does not start and finish on the axis lines.

What property do I use to do this?

With my bar series I just did

TBarSeries(objChart.Chart.Series[0]).SideMargins:=False;

I have posted an image onto the attachments newsgroup

Cheers

Paul

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue Dec 16, 2003 8:50 pm

Hi, Paul.

Is the line series Pointer.Visible property set to true meaning are you using line series with visible pointers ? If this is the case the you can use the following code to prevent automatic axis offset for pointers:

Code: Select all

(Chart1.Series[0] as TLineSeries).Pointer.InflateMargins := False;
Marjan Slatinek,
http://www.steema.com

Paul Saxton
Newbie
Newbie
Posts: 6
Joined: Tue Nov 04, 2003 5:00 am
Location: UK

No Difference

Post by Paul Saxton » Wed Dec 17, 2003 9:46 am

Hi Marjan

That property was false, I pasted your code in anyway and it made no difference grrrrrrr!

I have put a new screen shot on the attachments group.

I have just noticed that the first label on the X axis starts part way along the line, not at the origin. The line starts level with the the label

Cheers

Paul

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Dec 17, 2003 8:50 pm

Hi, Paul.

Looking at picture in attachments newsgroup, only one thing comes to my mind: if line and bar series x values are the same, then the "problem" is bar series by definition shows bars, which have specific width. So, if you're plotting bar series with x value 1 and 2, then two bars with center points at 1,2 and with speicific (%, defined by bar series property) bar width will be drawn. For line series this is not the case i.e. only lines with no additional "bar width" are drawn.

To treat bar series in the same manner as line series i.e. don't let TeeChart adjust horizontal axis by bar width, simply override default minimum/maximum calculating algorithm and manually set axis range to exactly series XValues minimum and maximum value. Something like this

Code: Select all

  With Series1.GetHorizAxis do
    SetMinMax(Series1.XValues.MinValue, Series1.XValues.MaxValue);
Marjan Slatinek,
http://www.steema.com

Post Reply