Hi
Ive a slight problem when displaying my line on a chart. Im developing in C# and a code outline is shown below.
What is happening is that some of the line is not visible and I have to right-click and drag to make the missing part visible.
I thought that TeeChart would automatically scale everything such that the whole line was visible. Most of the time it appears as though the part that is
not visible is a horizontal part that lies exactly on the Y=0 and/or y=maxm part of the chart. Can I fix this?
===============
Line myLine;
myLine = new Line(myChart.Chart);
myLine.Color = Color.Yellow;
double[] xcoord= new double[2500];
double[] ycoord = new double[2500];
int i = 0;
while(i < 2500)
{
xcoord = whatever;
ycoord = whatever;
}
myLine.Clear();
myLine.Add(xcoord, ycoord);
My Chart is Clipped Slightly
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: My Chart is Clipped Slightly
Hi Dave,
If this doesn't help please attach a simple example project we can run "as-is" or modify the code snippet above so that we can reproduce the problem here.
Thanks in advance.
Yes, this is default behaviour and works fine for me here using this code:I thought that TeeChart would automatically scale everything such that the whole line was visible.
Code: Select all
Steema.TeeChart.Styles.Line myLine = new Steema.TeeChart.Styles.Line(tChart1.Chart);
myLine.Color = Color.Yellow;
double[] xcoord = new double[2500];
double[] ycoord = new double[2500];
Random x = new Random();
Random y = new Random();
for (int i = 0; i < xcoord.Length; i++)
{
xcoord[i] = x.Next();
ycoord[i] = y.Next();
}
myLine.Clear();
myLine.Add(xcoord, ycoord);
In that case you may need to use minimum and maximum axes offset, for example:Most of the time it appears as though the part that is not visible is a horizontal part that lies exactly on the Y=0 and/or y=maxm part of the chart. Can I fix this?
Code: Select all
tChart1.Axes.Bottom.MinimumOffset = 50;
tChart1.Axes.Bottom.MaximumOffset = 50;
tChart1.Axes.Left.MinimumOffset = 50;
tChart1.Axes.Left.MaximumOffset = 50;
Thanks in advance.
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 |
Re: My Chart is Clipped Slightly
Hi Narcis
Try out this code. The first horizontal part of the line where y=0 is not displayed. You have to right-click and drag up to see this part of the line.
The version we are using is 3.5.3371.26406
Steema.TeeChart.Styles.Line myLine = new Steema.TeeChart.Styles.Line(tChart1.Chart);
myLine.Color = Color.Yellow;
double[] xcoord = new double[250];
double[] ycoord = new double[250];
Random x = new Random();
Random y = new Random();
for (int i = 0; i < xcoord.Length; i++) {
xcoord = i;
if (i < 100)
ycoord = 0;
else
ycoord = y.Next();
}
myLine.Clear();
myLine.Color = Color.DarkRed;
myLine.Add(xcoord, ycoord);
Try out this code. The first horizontal part of the line where y=0 is not displayed. You have to right-click and drag up to see this part of the line.
The version we are using is 3.5.3371.26406
Steema.TeeChart.Styles.Line myLine = new Steema.TeeChart.Styles.Line(tChart1.Chart);
myLine.Color = Color.Yellow;
double[] xcoord = new double[250];
double[] ycoord = new double[250];
Random x = new Random();
Random y = new Random();
for (int i = 0; i < xcoord.Length; i++) {
xcoord = i;
if (i < 100)
ycoord = 0;
else
ycoord = y.Next();
}
myLine.Clear();
myLine.Color = Color.DarkRed;
myLine.Add(xcoord, ycoord);
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: My Chart is Clipped Slightly
Hi Dave,
Is your chart in 2D? The line is painted but is painted but is painted over (or below) the bottom axis line. There are 2 solutions to this:
1. Set custom left axis minimum, for example:
2. Use axis offset, for example:
This is not working though due to a bug (TF02014628) which has just been discussed here. So that you'll have to use offset like this for now:
Hope this helps!
Is your chart in 2D? The line is painted but is painted but is painted over (or below) the bottom axis line. There are 2 solutions to this:
1. Set custom left axis minimum, for example:
Code: Select all
tChart1.Axes.Left.AutomaticMinimum = false;
tChart1.Axes.Left.Minimum = -y.Next();
Code: Select all
tChart1.Axes.Left.MinimumOffset = 30;
Code: Select all
tChart1.Axes.Left.SetMinMax(myLine.MinYValue(), myLine.MaxYValue());
tChart1.Axes.Left.MinimumOffset = 30;
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 |
Re: My Chart is Clipped Slightly
tChart1.Axes.Left.SetMinMax(myLine.MinYValue(), myLine.MaxYValue());
tChart1.Axes.Left.MinimumOffset = 30;
Narcis
The above code works perfectly. Thanks. I had the same problem at the top of the chart so added
tChart1.Axes.Left.MaximumOffset = 30;
which ensures the whole chart data is always visible.
tChart1.Axes.Left.MinimumOffset = 30;
Narcis
The above code works perfectly. Thanks. I had the same problem at the top of the chart so added
tChart1.Axes.Left.MaximumOffset = 30;
which ensures the whole chart data is always visible.