Semi Log Scale [Axis Labeling]

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Quant
Advanced
Posts: 142
Joined: Tue Dec 30, 2014 12:00 am

Semi Log Scale [Axis Labeling]

Post by Quant » Thu Mar 26, 2015 10:59 am

Hi,

We have one requirement wherein we need to show the Chart of Semi Log Scale (Logarithmic==True). The required final output should be as shown in following image:
Actual Semi Log Scale.JPG
Reuired Semi Log Scale
Actual Semi Log Scale.JPG (33.63 KiB) Viewed 4917 times
TeeChart works fine with Logarithmic Scale, but it does not show axis labels as shown in above image.
Following is the image showing TeeChart with Logarithmic=True:
TeeChart Semi Log Scale.JPG
TeeChart Semi Log Scale
TeeChart Semi Log Scale.JPG (26.61 KiB) Viewed 4914 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Semi Log Scale [Axis Labeling]

Post by Christopher » Thu Mar 26, 2015 12:18 pm

Hello,

There are several ways to control axis labelling, two of which are shown here:

Code: Select all

    FastLine series1 = new FastLine();
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      tChart1.Series.Add(series1);
      series1.VertAxis = VerticalAxis.Right;

      Random rnd = new Random();

      for (int i = 0; i < 200; i++)
      {
        series1.Add(i, rnd.Next(10000));
      }

      tChart1.Axes.Right.Increment = 500;
      //tChart1.GetNextAxisLabel += tChart1_GetNextAxisLabel;

      tChart1.Axes.Right.Logarithmic = true;
    }

    void tChart1_GetNextAxisLabel(object sender, GetNextAxisLabelEventArgs e)
    {
      if (((Steema.TeeChart.Axis)sender).Equals(tChart1.Axes.Right))
      {
        e.Stop = false;
        switch (e.LabelIndex)
        {
          case 0:
            e.LabelValue = 50;
            break;
          case 1:
            e.LabelValue = 100;
            break;
          case 2:
            e.LabelValue = 200;
            break;
          case 3:
            e.LabelValue = 500;
            break;
          case 4:
            e.LabelValue = 1000;
            break;
          case 5:
            e.LabelValue = 2000;
            break;
          case 6:
            e.LabelValue = 5000;
            break;
          case 7:
            e.LabelValue = 10000;
            break;
          default:
            e.Stop = true;
            break;
        }
      }
    }
Do either of these strategies help you?
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

Post Reply