How can I make the X axis (bottom) appear at 0 on the Y axis and vice versa, so I want x/y to intersect at 0,0. But for labels for the axis to appear still at the bottom or left of the chart.
Also even when switching automaticmin and max to false. setting min and max has no effect on the chart, does this need to done in a specific order?
Axis Positioning
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Luke,
If you want labels to be drawn at the edges of the chart drawing area I recommend you to set axes AxisPen.Visible=false and use ColorLine tool for drawing one vertical and one horizontal line at 0. Otherwise you could do something like what's shown here.How can I make the X axis (bottom) appear at 0 on the Y axis and vice versa, so I want x/y to intersect at 0,0. But for labels for the axis to appear still at the bottom or left of the chart.
Why don't you try using SetMinMax instead? It will handle everything automatically.Also even when switching automaticmin and max to false. setting min and max has no effect on the chart, does this need to done in a specific order?
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Luke,
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
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 |
tried
void tChart_AfterDraw(object sender, Graphics3D g)
{
tChart.Axes.Bottom.PositionUnits = PositionUnits.Pixels;
tChart.Axes.Bottom.RelativePosition = tChart.Axes.Bottom.Position - tChart.Axes.Left.CalcYPosValue(0);
}
but axes always flickers between origin 0,0 and bottom of graph where it was before when resizing
void tChart_AfterDraw(object sender, Graphics3D g)
{
tChart.Axes.Bottom.PositionUnits = PositionUnits.Pixels;
tChart.Axes.Bottom.RelativePosition = tChart.Axes.Bottom.Position - tChart.Axes.Left.CalcYPosValue(0);
}
but axes always flickers between origin 0,0 and bottom of graph where it was before when resizing
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Luke,
Sorry but I'm not sure about what you are trying to achieve here. How are your other axes and series set up? An example we can run "as-is" to reproduce the issue here would be very helpful. Also, have you tried using ColorLine tool as I suggested? If so, did you found any problem with that?
Thanks in advance.
Sorry but I'm not sure about what you are trying to achieve here. How are your other axes and series set up? An example we can run "as-is" to reproduce the issue here would be very helpful. Also, have you tried using ColorLine tool as I suggested? If so, did you found any problem with that?
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 |
using the shortcut you posted
http://www.teechart.net/support/viewtop ... xis+origin
The axes shifts between the 0 position and actual bottom.
Yep using the colour line, its better behaved. thx
http://www.teechart.net/support/viewtop ... xis+origin
The axes shifts between the 0 position and actual bottom.
Yep using the colour line, its better behaved. thx
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Luke,
You can translate that example to the .NET version like the code snippet below which works fine for me here.
You can translate that example to the .NET version like the code snippet below which works fine for me here.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private bool usePercentages;
private void InitializeChart()
{
usePercentages = false;
tChart1.Aspect.View3D = false;
tChart1.Dock = DockStyle.Fill;
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
for (int i = -5; i <= 10; i++)
{
line1.Add(i,i);
}
tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
tChart1.AfterDraw +=new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Resize += new EventHandler(tChart1_Resize);
tChart1.Draw();
}
void tChart1_Resize(object sender, EventArgs e)
{
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (usePercentages)
{
int chartWidth = tChart1.Axes.Right.Position - tChart1.Axes.Left.Position;
int horizZeroLoc = tChart1.Axes.Bottom.CalcXPosValue(0 - tChart1.Axes.Left.Position);
int horizPercentLoc = horizZeroLoc / chartWidth * 100;
tChart1.Axes.Left.PositionUnits = Steema.TeeChart.PositionUnits.Percent;
tChart1.Axes.Left.RelativePosition = horizPercentLoc;
int chartHeight = tChart1.Axes.Bottom.Position - tChart1.Axes.Top.Position;
int vertZeroLoc = tChart1.Axes.Left.CalcYPosValue(0 - tChart1.Axes.Top.Position);
int vertPercentLoc = vertZeroLoc / chartHeight * 100;
tChart1.Axes.Bottom.PositionUnits = Steema.TeeChart.PositionUnits.Percent;
tChart1.Axes.Bottom.RelativePosition = (100 - vertPercentLoc);
}
else
{
tChart1.Axes.Left.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
tChart1.Axes.Left.RelativePosition = tChart1.Axes.Bottom.CalcXPosValue(0) - tChart1.Axes.Left.Position;
tChart1.Axes.Bottom.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
tChart1.Axes.Bottom.RelativePosition = tChart1.Axes.Bottom.Position - tChart1.Axes.Left.CalcYPosValue(0);
}
}
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 |