Hi Steema,
We are facing one problem that is when we set axis labels in 10th power then labels values are not showing correct.
We have created plot in which we have set bottom axis Logarithmic. The minimum and maximum value of bottom axis are 0.1 and 100 respectively.
Case1
When we set label format in exponential then labels of bottom axis shown in below figure:
tChart1.Axes.Bottom.Labels.ValueFormat = " 0.####E+0";
Case2
When we want to show the bottom axis labels in 10th power.
for this we have set following properties
tChart1.Axes.Bottom.Labels.Exponent = true;
tChart1.Axes.Bottom.Labels.ValueFormat = "00e0";
But here in above figure, the labels of bottom axis are not showing correct values label.
Currently it is showing following labels: 10¯², 10¯¹, 10⁰, 10¹.
But the correct labels value should be: 10¯¹, 10⁰, 10¹, 10².
So we can see here the deference of multiply of 10 in all labels value.
Case3
Now we changed value format:
tChart1.Axes.Bottom.Labels.Exponent = true;
tChart1.Axes.Bottom.Labels.ValueFormat = "# "x10" E+0”;
then values are showing correct as shown in below figure:
But here we want to show labels in 10th power like case2.
So kindly assist us to give the solution.
Thanks & regards
PlanoResearch
Set axis labels in 10th power.
Re: Set axis labels in 10th power.
Hi Steema,
we have also attached a demo for your reference.
Thanks & regards
PlanoResearch
we have also attached a demo for your reference.
Thanks & regards
PlanoResearch
- Attachments
-
- Demo.rar
- (73.35 KiB) Downloaded 1909 times
Re: Set axis labels in 10th power.
Hi Steama,
We have posted one issue regarding the axis labels and we will still waiting for your response.
So kindly provide the any solution regarding this.
Thanks & regards
PlanoResearch
We have posted one issue regarding the axis labels and we will still waiting for your response.
So kindly provide the any solution regarding this.
Thanks & regards
PlanoResearch
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Set axis labels in 10th power.
Hello Amol,
When I run this code using the latest public version of TeeChart.dll (available here):
I obtain the following:
This chart is correct, as you can see - the strings we write out in Console.WriteLine using code which is independent of TeeChart match exactly the strings TeeChart writes out in the bottom axis.
Now when we use this code:
I obtain the following:
This chart is also correct - it has to be correct, because the previous chart was correct, which is to say that the label '10⁰' is correctly positioned.
I think confusion is occuring because TChart does not display the logarithmic value of the points on the labels - it displays their actual values but plots the values as logarithmic. Here's some code that explains what I mean:
and the result:
I think we can agree this is correct. Now if we use logarithmic both on the xvalue strings and on the bottom axis:
we obtain:
Here we can see that the chart plots the xvalues as logarithmic values, the values you can see in Console.WriteLine, but the labels are still the actual (non-logarithmic) value of each point.
When I run this code using the latest public version of TeeChart.dll (available here):
Code: Select all
public Form1()
{
InitializeComponent();
//FillData();
FillSeriesData();
this.Controls.Add(tChart1);
tChart1.Dock = DockStyle.Fill;
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Points line1 = new Points();
line1.ShowInLegend = false;
line1.VertAxis = VerticalAxis.Left;
line1.LinePen.Width = 2;
//line1.Smoothed = true;
line1.Add(lstX.ToArray(), lstY.ToArray());
string format = "00e0";
List<string> strings = lstX.Select(x => x.ToString(format)).ToList();
strings.ForEach(x => Console.WriteLine(x));
tChart1.Series.Add(line1);
//tChart1.Axes.Bottom.Logarithmic = true;
tChart1.Axes.Bottom.Labels.Exponent = true;
tChart1.Axes.Bottom.Labels.ValueFormat = format;
tChart1.MouseDoubleClick += TChart1_MouseDoubleClick;
}
This chart is correct, as you can see - the strings we write out in Console.WriteLine using code which is independent of TeeChart match exactly the strings TeeChart writes out in the bottom axis.
Now when we use this code:
Code: Select all
public Form1()
{
InitializeComponent();
//FillData();
FillSeriesData();
this.Controls.Add(tChart1);
tChart1.Dock = DockStyle.Fill;
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Points line1 = new Points();
line1.ShowInLegend = false;
line1.VertAxis = VerticalAxis.Left;
line1.LinePen.Width = 2;
//line1.Smoothed = true;
line1.Add(lstX.ToArray(), lstY.ToArray());
string format = "00e0";
List<string> strings = lstX.Select(x => x.ToString(format)).ToList();
strings.ForEach(x => Console.WriteLine(x));
tChart1.Series.Add(line1);
tChart1.Axes.Bottom.Logarithmic = true;
tChart1.Axes.Bottom.Labels.Exponent = true;
tChart1.Axes.Bottom.Labels.ValueFormat = format;
tChart1.MouseDoubleClick += TChart1_MouseDoubleClick;
}
This chart is also correct - it has to be correct, because the previous chart was correct, which is to say that the label '10⁰' is correctly positioned.
I think confusion is occuring because TChart does not display the logarithmic value of the points on the labels - it displays their actual values but plots the values as logarithmic. Here's some code that explains what I mean:
Code: Select all
public Form1()
{
InitializeComponent();
//FillData();
FillSeriesData();
FillXData();
this.Controls.Add(tChart1);
tChart1.Dock = DockStyle.Fill;
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Points line1 = new Points();
line1.ShowInLegend = false;
line1.VertAxis = VerticalAxis.Left;
line1.LinePen.Width = 2;
//line1.Smoothed = true;
line1.Add(lstX.ToArray(), lstY.ToArray());
string format = "00e+0";
List<string> strings = lstX.Select(x => x.ToString(format)).ToList();
strings.ForEach(x => Console.WriteLine(x));
tChart1.Series.Add(line1);
//tChart1.Axes.Bottom.Logarithmic = true;
//tChart1.Axes.Bottom.LogarithmicBase = 10;
//tChart1.Axes.Bottom.Labels.Exponent = true;
tChart1.Axes.Bottom.Labels.ValueFormat = format;
tChart1.MouseDoubleClick += TChart1_MouseDoubleClick;
}
private void FillXData()
{
lstX.Clear();
double ten = 1;
for (int i = 0; i < 17; i++)
{
ten *= 10;
lstX.Add(ten);
}
}
I think we can agree this is correct. Now if we use logarithmic both on the xvalue strings and on the bottom axis:
Code: Select all
public Form1()
{
InitializeComponent();
//FillData();
FillSeriesData();
FillXData();
this.Controls.Add(tChart1);
tChart1.Dock = DockStyle.Fill;
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Points line1 = new Points();
line1.ShowInLegend = false;
line1.VertAxis = VerticalAxis.Left;
line1.LinePen.Width = 2;
//line1.Smoothed = true;
line1.Add(lstX.ToArray(), lstY.ToArray());
string format = "00e+0";
List<string> strings = lstX.Select(x => Math.Log10(x).ToString(format)).ToList();
strings.ForEach(x => Console.WriteLine(x));
tChart1.Series.Add(line1);
tChart1.Axes.Bottom.Logarithmic = true;
tChart1.Axes.Bottom.LogarithmicBase = 10;
tChart1.Axes.Bottom.Labels.Exponent = true;
tChart1.Axes.Bottom.Labels.ValueFormat = format;
tChart1.MouseDoubleClick += TChart1_MouseDoubleClick;
}
private void FillXData()
{
lstX.Clear();
double ten = 1;
for (int i = 0; i < 17; i++)
{
ten *= 10;
lstX.Add(ten);
}
}
Here we can see that the chart plots the xvalues as logarithmic values, the values you can see in Console.WriteLine, but the labels are still the actual (non-logarithmic) value of each point.
Best Regards,
Christopher Ireland / 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 |