Managing Axis Increment
Managing Axis Increment
Hi Steema support,
We have prepared the demo for managing the axis scaling in TChart . In this demo we have given the following inputs for X-axis ,Y-axis and Y-Alternate axis are mentioned below:-
tChart1.Axes.Bottom.Automatic = false;
tChart1.Axes.Bottom.Minimum = -50.0;
tChart1.Axes.Bottom.Maximum = 650;
tChart1.Axes.Bottom.Increment = 50;
tChart1.Axes.Bottom.MinorTicks.Length = 4;
tChart1.Axes.Left.Automatic = false;
tChart1.Axes.Left.Minimum = 3870;
tChart1.Axes.Left.Maximum = 4010;
tChart1.Axes.Left.Increment = 50;
tChart1.Axes.Left.MinorTicks.Length = 4;
tChart1.Axes.Right.Automatic = false;
tChart1.Axes.Right.Minimum = -50.0;
tChart1.Axes.Right.Maximum = 550;
tChart1.Axes.Right.Increment = 50;
tChart1.Axes.Right.MinorTicks.Length = 4;
tChart1.Axes.Right.Grid.Visible = false;
The below figure(1) shows according to all above input but not same as below figure (2).
Our max, min, tick increment and total no of tick are same but minor per major tick are not. So kindly let us know how to implement minor per major ticks in TChart 2012. In figure-2, each minor tick has increment of 50, so is there any way in Steema Tchart to set increment of axis with respect to minor tick.
So, kindly suggest how to manage bottom axis of (Fig-1) according to (Fig-2) in TChart 2012 version, with respect to labels, ticks, minimum value, maximum value and grid lines of the axis.
Thanks
PlanoResearch
We have prepared the demo for managing the axis scaling in TChart . In this demo we have given the following inputs for X-axis ,Y-axis and Y-Alternate axis are mentioned below:-
tChart1.Axes.Bottom.Automatic = false;
tChart1.Axes.Bottom.Minimum = -50.0;
tChart1.Axes.Bottom.Maximum = 650;
tChart1.Axes.Bottom.Increment = 50;
tChart1.Axes.Bottom.MinorTicks.Length = 4;
tChart1.Axes.Left.Automatic = false;
tChart1.Axes.Left.Minimum = 3870;
tChart1.Axes.Left.Maximum = 4010;
tChart1.Axes.Left.Increment = 50;
tChart1.Axes.Left.MinorTicks.Length = 4;
tChart1.Axes.Right.Automatic = false;
tChart1.Axes.Right.Minimum = -50.0;
tChart1.Axes.Right.Maximum = 550;
tChart1.Axes.Right.Increment = 50;
tChart1.Axes.Right.MinorTicks.Length = 4;
tChart1.Axes.Right.Grid.Visible = false;
The below figure(1) shows according to all above input but not same as below figure (2).
Our max, min, tick increment and total no of tick are same but minor per major tick are not. So kindly let us know how to implement minor per major ticks in TChart 2012. In figure-2, each minor tick has increment of 50, so is there any way in Steema Tchart to set increment of axis with respect to minor tick.
So, kindly suggest how to manage bottom axis of (Fig-1) according to (Fig-2) in TChart 2012 version, with respect to labels, ticks, minimum value, maximum value and grid lines of the axis.
Thanks
PlanoResearch
- Attachments
-
- ManageAxis.rar
- DemoProject
- (97.7 KiB) Downloaded 962 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Managing Axis Increment
Hi PlanoResearch,
I'm not sure about which is your exact question. However, you can have bottom axis in the example you sent (figure1) as in figure2 example using this code:
You can set Increment relative to the number of minor ticks using something like this:
Is this what you were looking for? Otherwise please provide more detailed information about your exact requirements.
I'm not sure about which is your exact question. However, you can have bottom axis in the example you sent (figure1) as in figure2 example using this code:
Code: Select all
tChart1.Axes.Bottom.SetMinMax(-50.0, 650);
tChart1.Axes.Bottom.Increment = 200;
tChart1.Axes.Bottom.IncrementOffset = 50;
tChart1.Axes.Bottom.Labels.OnAxis = true;
tChart1.Axes.Bottom.MinorTicks.Length = 4;
Code: Select all
tChart1.Axes.Bottom.Increment = (tChart1.Axes.Bottom.MinorTickCount + 1) * 50;
Best Regards,
Narcís Calvet / 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 |
Managing Axis Increment
Thanks for reply,
But we have one more query regarding Axis management.
We are using the following inputs for X-axis,Y-axis and Y-Alternate axis are mentioned below:-
tChart1.Axes.Bottom.Minimum = 200;
tChart1.Axes.Bottom.Maximum = 3000;
tChart1.Axes.Bottom.IncrementOffset = 200;
tChart1.Axes.Bottom.Increment = 1000;
tChart1.Axes.Bottom.MinorTickCount = 4;
tChart1.Axes.Left.Minimum = 3870;
tChart1.Axes.Left.Maximum = 4010;
tChart1.Axes.Left.Increment = 10;
tChart1.Axes.Left.MinorTicks.Length = 5;
tChart1.Axes.Right.Minimum = -50;
tChart1.Axes.Right.Maximum = 550;
tChart1.Axes.Right.Increment = 50;
tChart1.Axes.Right.MinorTicks.Length 4;
tChart1.Axes.Right.Grid.Visible = false;
The below figure(1) shows according to all above input but not same as below figure (2).
As shown in below figure-1, the left Axis label start showing from initial position which looks correct but on the other hand labels of bottom axis not start showing from initial position of axis.
We want to show axis labels of all axis from initial position as shown in Fig.2
But we have one more query regarding Axis management.
We are using the following inputs for X-axis,Y-axis and Y-Alternate axis are mentioned below:-
tChart1.Axes.Bottom.Minimum = 200;
tChart1.Axes.Bottom.Maximum = 3000;
tChart1.Axes.Bottom.IncrementOffset = 200;
tChart1.Axes.Bottom.Increment = 1000;
tChart1.Axes.Bottom.MinorTickCount = 4;
tChart1.Axes.Left.Minimum = 3870;
tChart1.Axes.Left.Maximum = 4010;
tChart1.Axes.Left.Increment = 10;
tChart1.Axes.Left.MinorTicks.Length = 5;
tChart1.Axes.Right.Minimum = -50;
tChart1.Axes.Right.Maximum = 550;
tChart1.Axes.Right.Increment = 50;
tChart1.Axes.Right.MinorTicks.Length 4;
tChart1.Axes.Right.Grid.Visible = false;
The below figure(1) shows according to all above input but not same as below figure (2).
As shown in below figure-1, the left Axis label start showing from initial position which looks correct but on the other hand labels of bottom axis not start showing from initial position of axis.
We want to show axis labels of all axis from initial position as shown in Fig.2
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Managing Axis Increment
Hello,
What about setting this?
I can not reproduce the problem with the project you sent and modifying axes settings according to your last post, complete code available below.
If problem persists please attach a simple example project we can run "as-is" to reproduce the problem here.
What about setting this?
Code: Select all
tChart1.Axes.Bottom.Labels.OnAxis = true;
Code: Select all
public partial class Form1 : Form
{
double x0 = -15, x1 = 15, x2 = 22.5, x3 = 600, y0 = -15, y1 = 25, y2 = 35, y3 = 650;
Line line;
Line lineFlow;
public Form1()
{
InitializeComponent();
InitializeChart();
}
/// <summary>
/// creates chart components
/// </summary>
private void InitializeChart()
{
tChart1.Panel.Gradient.StartColor = Color.MistyRose;
tChart1.Panel.Gradient.MiddleColor = Color.MistyRose;
tChart1.Aspect.View3D = false;
line = new Line(tChart1.Chart);
lineFlow = new Line(tChart1.Chart);
line.Add(x0, y0);
line.Add(x1, y1);
line.Add(x2, y2);
line.Add(x3, y3);
lineFlow.Add(x0, y0);
lineFlow.Add(x1, y1);
lineFlow.Add(x2, y2);
lineFlow.Add(x3, y3);
lineFlow.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;
lineFlow.Color = Color.Red;
line.Color = Color.Red;
tChart1.Legend.Visible = true;
tChart1.Axes.Bottom.SetMinMax(200, 3000);
tChart1.Axes.Bottom.Increment = 200;
tChart1.Axes.Bottom.IncrementOffset = 1000;
tChart1.Axes.Bottom.Labels.OnAxis = true;
tChart1.Axes.Bottom.MinorTicks.Length = 4;
tChart1.Axes.Left.SetMinMax(3870, 4010);
tChart1.Axes.Left.Increment = 10;
tChart1.Axes.Left.MinorTicks.Length = 5;
tChart1.Axes.Right.SetMinMax(- 50.0, 550);
tChart1.Axes.Right.Increment = 50;
tChart1.Axes.Right.MinorTicks.Length = 4;
tChart1.Axes.Right.Grid.Visible = false;
#region TeeChart Properties
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
tChart1.Panel.Color = Color.White;
tChart1.Panel.Gradient.Visible = false;
tChart1.Walls.Back.Gradient.Visible = false;
tChart1.Walls.Back.Color = tChart1.Panel.Color;
tChart1.Walls.Back.Transparency = 0;
tChart1.Chart.Panning.Allow = Steema.TeeChart.ScrollModes.None;
tChart1.Zoom.Direction = Steema.TeeChart.ZoomDirections.None;
tChart1.Header.TextAlign = StringAlignment.Center;
tChart1.Walls.Back.Visible = false;
tChart1.Walls.Back.Visible = false;
tChart1.Axes.Left.Title.Text = "Y-Axis";
tChart1.Axes.Bottom.Title.Text = "X-Axis";
#endregion
}
private void tChart1_DoubleClick(object sender, EventArgs e)
{
tChart1.ShowEditor();
}
}
Best Regards,
Narcís Calvet / 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 |
Managing Axis Increment
Hi Steema Support,
Thanks for your reply.
We are using the "OnAxis" property as shown below but it does not do anything.
tChart1.Axes.Bottom.Labels.OnAxis = true; We are attaching a new demo for better understanding.Please provide any solution asap.
Thanks in advance. Thanks
PlanoResearch
Thanks for your reply.
We are using the "OnAxis" property as shown below but it does not do anything.
tChart1.Axes.Bottom.Labels.OnAxis = true; We are attaching a new demo for better understanding.Please provide any solution asap.
Thanks in advance. Thanks
PlanoResearch
Re: Managing Axis Increment
Hello,
OnAxis won't work in this case as it is looking to plot a regularly incremented label. I've added a feature request, http://bugs.teechart.net/show_bug.cgi?id=1272.
In the meantime there are other options to better control the Label output for non-standard requirements. Here are a couple:
This will add the label you require. It uses the TChart AfterDraw event:
This option allows you to set the exact labels you require from scratch, overriding TeeChart's own choice for labels:
I hope that may be of help.
Regards,
Marc Meumann
OnAxis won't work in this case as it is looking to plot a regularly incremented label. I've added a feature request, http://bugs.teechart.net/show_bug.cgi?id=1272.
In the meantime there are other options to better control the Label output for non-standard requirements. Here are a couple:
This will add the label you require. It uses the TChart AfterDraw event:
Code: Select all
using Steema.TeeChart;
using System.Reflection;
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
//set x position for new label
int x = tChart1.Axes.Bottom.CalcPosValue(tChart1.Axes.Bottom.Minimum);
//tChart1.Axes.Bottom.Labels.position (here the Label y coordinate) is protected so need alternative technique for y...
//(We'll add publicly scoped access for this variable for future releases)
AxisLabels tmpLabels = new AxisLabels(tChart1.Axes.Bottom);
FieldInfo privateField = tmpLabels.GetType().GetField("position", BindingFlags.NonPublic | BindingFlags.Instance);
int y = (int)privateField.GetValue(tChart1.Axes.Bottom.Labels);
string label = tChart1.Axes.Bottom.Minimum.ToString("#");
//output text
g.TextOut(x - ((int)Math.Round(g.TextWidth(label) / 2)), y, label);
}
Code: Select all
tChart1.Axes.Bottom.Labels.Items.Add(tChart1.Axes.Bottom.Minimum, tChart1.Axes.Bottom.Minimum.ToString());
double incr = 500;
double labelvalue = tChart1.Axes.Bottom.Minimum + incr; //increment in steps of 500
while ((tChart1.Axes.Bottom.Minimum + labelvalue + incr) < tChart1.Axes.Bottom.Maximum)
{
tChart1.Axes.Bottom.Labels.Items.Add(labelvalue, labelvalue.ToString());
labelvalue += incr;
}
Regards,
Marc Meumann
Steema Support
Re: Managing Axis Increment
Hi Steema Support,
Thanks for your reply. its works fine for the labels.
But we are facing one more problem i.e. shown in Figure 1. It shows small space between axis line and Grid line(Starting grid line) why? we are using MinimumOffset, MaximumOffset and IncrementOffset value 0(zero). We want no space there as shown in figure 2 below.there is no space shown and grid line created with uniform interval.
please provide any solution. Thanks in advance.
Thanks
PlanoResearch
Thanks for your reply. its works fine for the labels.
But we are facing one more problem i.e. shown in Figure 1. It shows small space between axis line and Grid line(Starting grid line) why? we are using MinimumOffset, MaximumOffset and IncrementOffset value 0(zero). We want no space there as shown in figure 2 below.there is no space shown and grid line created with uniform interval.
please provide any solution. Thanks in advance.
Thanks
PlanoResearch
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Managing Axis Increment
Hello,
Could you please attach a simple example project we can run "as-is" to reproduce the problem here?
Thanks in advance.
Could you please attach a simple example project we can run "as-is" to reproduce the problem here?
Thanks in advance.
Best Regards,
Narcís Calvet / 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: Managing Axis Increment
Hi Steema Support,
We are attaching a Demo project for the same and will reproduce the problem(It shows small space between axis line and Grid line).
According to my understanding When we set line.Pointer.visible=True; then it shows the problem as given in demo.
Kindly provide any solution asap.
Thanks in advance.
Thanks
PlanoResearch
We are attaching a Demo project for the same and will reproduce the problem(It shows small space between axis line and Grid line).
According to my understanding When we set line.Pointer.visible=True; then it shows the problem as given in demo.
Kindly provide any solution asap.
Thanks in advance.
Thanks
PlanoResearch
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Managing Axis Increment
Hello,
I think you can resolve this with:amol wrote:According to my understanding When we set line.Pointer.visible=True; then it shows the problem as given in demo.
Kindly provide any solution asap.
Code: Select all
line.Pointer.InflateMargins = false;
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: Managing Axis Increment
Thanks!!! Christopher it works.