Hi all,
I am facing a problem while managing axes programmatically. Axes in my chart are logarithmic. I have some series on my chart. I can move these series over the chart by just clicking and dragging over the chart with mouse. My problem is when I move any series out of the boundaries it became invisible as it crosses the boundaries of the chart. To prevent this I started managing the axes on each and every move of series. But, as it is logarithmic axes, I am facing some problem. Hope you can understand what I am trying to do. One thing I want to let you know that I‘ve already done it for Linear Axes.
For more explanation I am attaching a project which contain a example which is created to do above task. It has two forms, LogAxis.cs and LinAxis.cs. In LogAxis.cs I tried to implement above task in logarithmic axes while in LinAxis.cs I tried to implement above in linear axes.
(There may be problem while running the project, since this project was too large, I have removed TeeChart DLL(version 4.1.2011) from bin folder. Please paste this dll at bin folder to run it.)
Hope you can understand what I am looking for.
Thanks in advance for solving this query.
Thanks and Regards
Ashish Pandey
Managing axes
Managing axes
- Attachments
-
- ManagingAxes.rar
- (54.59 KiB) Downloaded 595 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Managing axes
Hi Ashish,
If I understand your problem correctly it occurs when moving a point towards the minimum of the logarithmic axis, is that correct? If that's the case, I have observed that the problem occurs when point values are less than 1. You can check that adding the line below to tChart1_MouseMove.
Given that Log(1) = 0, logarithmic axes can not plot values smaller than one and hence your values disappearing. That being the case you should restrict that movement, for example, implementing tChart1_MouseMove like this:
Can you please confirm that's the problem you are experiencing?
Thanks in advance.
If I understand your problem correctly it occurs when moving a point towards the minimum of the logarithmic axis, is that correct? If that's the case, I have observed that the problem occurs when point values are less than 1. You can check that adding the line below to tChart1_MouseMove.
Code: Select all
tChart1.Header.Text = m_pCurrent.ToString();
Code: Select all
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
double tmpX = tChart1.Axes.Bottom.CalcPosPoint(e.X);
double tmpY = tChart1.Axes.Left.CalcPosPoint(e.Y);
m_pCurrent.X = (tmpX < 1) ? 1 : (float)tmpX;
m_pCurrent.Y = (tmpY < 1) ? 1 : (float)tmpY;
tChart1.Header.Text = m_pCurrent.ToString();
if (isMouseDownOnChart)
{
if (isMouseDownOnPoint1)
{
pointSeries1[0].X = m_pCurrent.X;
pointSeries1[0].Y = m_pCurrent.Y;
}
if (isMouseDownOnPoint2)
{
pointSeries2[0].X = m_pCurrent.X;
pointSeries2[0].Y = m_pCurrent.Y;
}
if (isMouseDownOnLine1)
{
line1[indexOfClickedPoint].X = m_pCurrent.X;
line1[indexOfClickedPoint].Y = m_pCurrent.Y;
}
}
}
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 |