Page 1 of 1

Semi Log Scale [Axis Labeling]

Posted: Thu Mar 26, 2015 10:59 am
by 16071129
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 4940 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 4937 times

Re: Semi Log Scale [Axis Labeling]

Posted: Thu Mar 26, 2015 12:18 pm
by Christopher
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?