How to create a legend for each y-axis (left and right)

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
NREL
Newbie
Newbie
Posts: 10
Joined: Fri May 07, 2004 4:00 am

How to create a legend for each y-axis (left and right)

Post by NREL » Thu Jan 20, 2005 6:59 am

How do I create a separate legend for left and right y-axis in a line plot with n series tied to left axis and m series tied to right axis?

The legend only works for a chart and I do not see how to break apart based on axis. The new features demo show how to create a second legend but that is for series values.

I want the left axis to have a legend consisting of n items (left axis series) and I want the right axis to have a legend consisting of m items (right axis series). Is this possible? How?

NREL
Newbie
Newbie
Posts: 10
Joined: Fri May 07, 2004 4:00 am

Post by NREL » Mon Jan 24, 2005 11:28 pm

Specific example question:

I have a system S that has a property X which is an independent variable and a secon variable T which is an independent variable. So, I vary X and T and record the Output O(X,T) and the Cost C(X,T) (both are a function of X and T).

Given X={x1,x2,x3} and T=(t1,t2}
I construct the 2 LineSeries for Output
SOt1={O(x1,t1),O(x2,t1),O(x3,t1)}
SOt2={O(x1,t2),O(x2,t2),O(x3,t2)}

and the 2 LineSeries for Cost
COt1={C(x1,t1),C(x2,t1),C(x3,t1)}
COt2={C(x1,t2),C(x2,t2),C(x3,t2)}

Now, I add all series to a TChart and have the Output as the left axis and the cost as the right axis.

How do I create a separate legend for the Output series and a separate legend for the Cost series?

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

Post by Pep » Tue Jan 25, 2005 9:03 am

Hi,

in your case, as you want to create more than one Legend with filtered items (from more than one Series ) I think the best way to accomplish that could be by using the Canvas techniques, and draw the custom legend directly on the panel. You can see more info about the Canvas techniques in the TeeChart Pro Tutorials.

Post Reply