Adding legend to series
-
- Newbie
- Posts: 35
- Joined: Wed Feb 25, 2004 5:00 am
- Location: WL| Delft Hydraulics, Holland
- Contact:
Adding legend to series
Hi,
I would ike to add strings for the legend of my series.
My code looks like:
Steema.TeeChart.Styles.Line line;
for (int iPar=0;iPar<noPars;iPar++)
{
// parameter iPar
iTime= 0; // only first time level
float[] xValues = new float[noLocs];
float[] yValues = new float[noLocs];
line = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
for (int iLoc=0;iLoc<noLocs;iLoc++)
{
// location iLoc
xValues[iLoc] = iLoc;
yValues[iLoc] = gsSeries[iPar,iLoc,iTime];
}
tChart1.Series[iPar].Add(xValues,yValues);
tChart1.Series[iPar].Chart = tChart1.Chart;
tChart1.BackColor = Color.Azure;
}
but how and where to add the legend *gsParameters[iPar]* defined in
string[] gsParameters;
So, *gsParameters[iPar]* is the legend string for series with number *iPar*.
Thanks,
Antoon Koster
Netherlands
I would ike to add strings for the legend of my series.
My code looks like:
Steema.TeeChart.Styles.Line line;
for (int iPar=0;iPar<noPars;iPar++)
{
// parameter iPar
iTime= 0; // only first time level
float[] xValues = new float[noLocs];
float[] yValues = new float[noLocs];
line = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
for (int iLoc=0;iLoc<noLocs;iLoc++)
{
// location iLoc
xValues[iLoc] = iLoc;
yValues[iLoc] = gsSeries[iPar,iLoc,iTime];
}
tChart1.Series[iPar].Add(xValues,yValues);
tChart1.Series[iPar].Chart = tChart1.Chart;
tChart1.BackColor = Color.Azure;
}
but how and where to add the legend *gsParameters[iPar]* defined in
string[] gsParameters;
So, *gsParameters[iPar]* is the legend string for series with number *iPar*.
Thanks,
Antoon Koster
Netherlands
Hi Antoon,
how about using :
tChart1.Series[iPar].Add(xValues,yValues,gsParameters[iPar]);
?
how about using :
tChart1.Series[iPar].Add(xValues,yValues,gsParameters[iPar]);
?
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 35
- Joined: Wed Feb 25, 2004 5:00 am
- Location: WL| Delft Hydraulics, Holland
- Contact:
Hi Pep,
Thanks for your quick reply, but it did not work.
The compiler complained about invalid arg 1,2 and 3. I guess, because there is no overloaded method taking System.Array, System.Array and string (legend) as arguments.
I found some overloaded method taking a string, but that's is the string connected to a data point in series, but not the legend for the complete series.
Some *further* help would be nice !
Thanks,
Antoon
Thanks for your quick reply, but it did not work.
The compiler complained about invalid arg 1,2 and 3. I guess, because there is no overloaded method taking System.Array, System.Array and string (legend) as arguments.
I found some overloaded method taking a string, but that's is the string connected to a data point in series, but not the legend for the complete series.
Some *further* help would be nice !
Thanks,
Antoon
Hi Antoon,
I'm sorry, I mistake me. In that case, using Arrays you should use the StringList as in the following example :
I'm sorry, I mistake me. In that case, using Arrays you should use the StringList as in the following example :
Code: Select all
private void Form1_Load(object sender, System.EventArgs e)
{
float[] xValues = new float[5];
float[] yValues = new float[5];
Steema.TeeChart.Styles.StringList labels = new Steema.TeeChart.Styles.StringList(5);
labels[0] = "a1";
labels[1] = "a2";
labels[2] = "a3";
labels[3] = "a4";
labels[4] = "a5";
line1.Add(xValues,yValues);
line1.Labels = labels;
}
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Anthony,
As you have already populated your series it may be enough for you using:
As you have already populated your series it may be enough for you using:
Code: Select all
tChart1.Series[iPar].Title=gsParameters[iPar];
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 |
-
- Newbie
- Posts: 35
- Joined: Wed Feb 25, 2004 5:00 am
- Location: WL| Delft Hydraulics, Holland
- Contact:
Hi,
It works great !
BTW, last 2 questions ..
1) If I maximize my window including the TeeChart component, the TeeChart component is not resized . Why ??
2) Normally I have two or more series connected to both vertical axes, but sometimes there is only one single series to display. In that case I only see one (left) axis. How can I establish that I always see two vertical axis ?
Thanks.
Antoon Koster
Netherlands
It works great !
BTW, last 2 questions ..
1) If I maximize my window including the TeeChart component, the TeeChart component is not resized . Why ??
2) Normally I have two or more series connected to both vertical axes, but sometimes there is only one single series to display. In that case I only see one (left) axis. How can I establish that I always see two vertical axis ?
Thanks.
Antoon Koster
Netherlands
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Anthony,
You should set TChart anchors editing it's properties in view designer mode.
1) If I maximize my window including the TeeChart component, the TeeChart component is not resized . Why ??
You should set TChart anchors editing it's properties in view designer mode.
You can force both vertical axis to appear using the code above for the remaining series.2) Normally I have two or more series connected to both vertical axes, but sometimes there is only one single series to display. In that case I only see one (left) axis. How can I establish that I always see two vertical axis ?
Code: Select all
tChart1.Series[1].VertAxis=Steema.TeeChart.Styles.VerticalAxis.Both;
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 |
-
- Newbie
- Posts: 35
- Joined: Wed Feb 25, 2004 5:00 am
- Location: WL| Delft Hydraulics, Holland
- Contact:
Hi,
Still a question about the TChart' s anchor properties you mentioned.
If I am in design mode with the form including my TChart component, and then right-click and go to Properties in the Context Menu, then the TeeChart editor is launched. In this case I expect a Property Window, with an attribute *anchor* for editing, or is the *anchor* part of TeeChart editor ? And if so, where (on which tab page) can I find that property ??
Thanks again.
Antoon Koster
WL|Delft Hydraulics
Netherlands
Still a question about the TChart' s anchor properties you mentioned.
If I am in design mode with the form including my TChart component, and then right-click and go to Properties in the Context Menu, then the TeeChart editor is launched. In this case I expect a Property Window, with an attribute *anchor* for editing, or is the *anchor* part of TeeChart editor ? And if so, where (on which tab page) can I find that property ??
Thanks again.
Antoon Koster
WL|Delft Hydraulics
Netherlands
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Antoon,
You will find the anchor property in the VS.NET property editor for the TChart component you dropped in your form, not in the TeeChart Editor.
You will find the anchor property in the VS.NET property editor for the TChart component you dropped in your form, not in the TeeChart Editor.
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 |