Hi Steema Support,
we want to create minor ticks of axis like that(as shown in image below).
As shown in image minor ticks shown some upside and downside the axis at same time. Is it possible to show minorticks like this.
In teechart if we set length of minor ticks >0 then minor ticks shown down side of the axis and if length of minor ticks <0 then minor ticks shown upside of the axis.
But in my case i want to show minorticks upside and down side at the same time as shown in image above.
Please provide any solution asap.
Thanks in advance.
Thanks,
Want to set minorTicks inside/outside the axis at sametime
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Want to set minorTicks inside/outside the axis at sametime
Hello,
You could try code similar to this:
You could try code similar to this:
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Line line1 = new Line(tChart1.Chart);
line1.Add(2, 2);
line1.Add(8, 8);
tChart1.Axes.Bottom.Increment = 1;
tChart1.Axes.Bottom.MinorTicks.Length = 3;
tChart1.Axes.Bottom.MinorTicks.Color = Color.Red;
tChart1.Axes.Bottom.MinorTicks.Visible = false;
tChart1.AfterDraw += AfterDraw;
}
private void AfterDraw(object sender, Graphics3D g)
{
Axis bottom = tChart1.Axes.Bottom;
double min = bottom.Minimum;
double max = bottom.Maximum;
double inc = bottom.Increment;
double delta = inc / ( bottom.MinorTickCount + 1);
g.Pen = bottom.MinorTicks;
g.Pen.Visible = true;
for (double i = min; i < max; i += inc)
{
for (int j = 0; j < bottom.MinorTickCount; j++)
{
g.VerticalLine(bottom.CalcXPosValue(i + (delta * (j + 1))), bottom.Position - bottom.MinorTicks.Length, bottom.Position + bottom.MinorTicks.Length);
}
}
}
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 |
Re: Want to set minorTicks inside/outside the axis at sametime
Thanks Steema support for your prompt reply and valuable feedback.
This code works well for Linear axis. But if use logarithmic axis, in that case increment is setted by chart automatically.
So how we calculate Delta value(that you are calculating in after draw event).
Thanks,
This code works well for Linear axis. But if use logarithmic axis, in that case increment is setted by chart automatically.
So how we calculate Delta value(that you are calculating in after draw event).
Thanks,
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Want to set minorTicks inside/outside the axis at sametime
This code requires that the Increment property is set manually either for linear or logarithmic axes.amol wrote: This code works well for Linear axis. But if use logarithmic axis, in that case increment is setted by chart automatically.
So how we calculate Delta value(that you are calculating in after draw event).
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 |