Page 1 of 1

Logarthmic datapoints in Tchart

Posted: Mon May 18, 2009 9:33 pm
by 9640703
Hi,

In my appliication. I use custom axis . The scale of left axes is different than y axis. I have a problem that data on left axis have value which are comparatively smaller than that of right axes as a result the data drawn on left axes appear quite smaller than right axes. so i decided to convert values to log10 but i found that the axes coordinates also showed converted values which were of no significance to users.

Is it possible that i can have the data plotted on logarthmic scale but the axes coordinates still display real unconverted values.

Thanks,
Sachin

Posted: Tue May 19, 2009 2:16 pm
by narcis
Hi Sachin,

Yes, you can set labels format and also customize them using GetAxisLabel event. For more information please read Tutorial 4 - Axis Control. Tutorials are available at TeeChart's program group.

Hope this helps!

Logarthmic datapoints in Tchart

Posted: Tue May 19, 2009 2:43 pm
by 9640703
Hi Narcis,

I think you misunderstood me. I am not concerned about label format but the values on the axes are logarthmic values which are plotted on the chart. I wanted the chart should be drawn using the logarthmic values & Axis should display real values.

for eg ( consider I draw a line with 3 points on chart for log(10), log(15) and log(20). I want the scale values on axis to be 10,15 and 20 but the line to be drawn with their logarthmic value.
I hope this is clear.

Thanks,
Sachin

Posted: Tue May 19, 2009 3:02 pm
by narcis
Hi Sachin,

In that case you can use the GetAxisLabel event like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;
			
			tChart1.Axes.Left.Logarithmic = true;
			tChart1.Axes.Left.LogarithmicBase = Math.E;
			tChart1.Axes.Left.Increment = 0.1;
			tChart1.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;

			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			line1.Add(Math.Log(10));
			line1.Add(Math.Log(15));
			line1.Add(Math.Log(20));

			tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);
		}

		void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
		{
			if (sender.Equals(tChart1.Axes.Left))
			{
				double tmp = Convert.ToDouble(e.LabelText);
				e.LabelText = Math.Pow(Math.E, tmp).ToString("##");				
			}
		}