TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
eidola
- Newbie
- Posts: 4
- Joined: Wed Oct 19, 2011 12:00 am
Post
by eidola » Tue Nov 08, 2011 6:56 am
Hi, there.
I got a problem with the following code:
Code: Select all
Line line = new Line();
double max = 1E303;
tChart1.Axes.Left.Automatic = false;
tChart1.Axes.Left.Minimum = 0;
tChart1.Axes.Left.Maximum = max;
tChart1.Axes.Left.Logarithmic = true;
tChart1.Axes.Left.LogarithmicBase = 10;
tChart1.Axes.Left.Labels.ValueFormat = "0.00#E+00";
int step = 100;
double interval = max / step;
for (int i = 0; i < step; i++)
{
line.Add((double)(i * 10), (double)(i * interval));
}
tChart1.Series.Add(line);
The problem is that the labels are overlapped on rendered chart while I expect the overlapped labels can be skipped. Any idea? Thanks a lot.
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Tue Nov 08, 2011 12:52 pm
Hello eidola,
I think your problem is that the scale of your axes are not correct. Please see next code and tell us if it works as you expected or you need it do something special?
Code: Select all
private void InitializeChart()
{
Line line = new Line();
tChart1.Aspect.View3D = false;
double max = 1E303;
tChart1.Axes.Left.Logarithmic = true;
tChart1.Axes.Left.LogarithmicBase = 10;
tChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series;
tChart1.Axes.Left.Labels.ValueFormat = "0.00#E+00";
int step = 100;
double interval = max / step;
for (int i = 1; i < step; i++)
{
line.Add((double)(i * 10), (double)(i * interval));
}
tChart1.Series.Add(line);
tChart1.Axes.Left.Minimum = interval;
tChart1.Axes.Left.Maximum = max;
}
I hope will helps.
Thanks,
-
eidola
- Newbie
- Posts: 4
- Joined: Wed Oct 19, 2011 12:00 am
Post
by eidola » Wed Nov 09, 2011 1:17 am
Hi, Sandra,
First of all, thanks for your reply. Actually I expect something else.
I noticed the data range on Y axis has been changed in your sample. But unfortunately for my case, the data range is from 0 ~ 1E+303. If I set back the data range, you sample code result will be like this:
[img]Screenshot.png[/img]
If I am not wrong, there are 303 labels rendered on Y axis but I hoped it can be less. To avoid overlapping, is there a way to hide some labels on Y axis?
-
Attachments
-
- Screenshot.png (50.69 KiB) Viewed 3847 times
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Wed Nov 09, 2011 12:09 pm
Hello eidola,
You are right. In this case, I think that would be useful for you, take a look in the Demo Project, concretely in All Features\Welcome !\Axes\Labels\Custom logarithmic axis where you can find how do to setup custom logarithmic increment.
I hope will helps.
Thanks,