Line movement
Re: Line movement
Hi Yeray,
The code you provided is working fine except following:
By seeing it we can observe that the slope of the line it slightly changing as soon as we start moving it, from the position it was initially drawn. Means the slope of line at very first time is different from when we first start movement .
Here we need same slope (45°) of line during initial state and while movement too.
Please help me to finalize this task.
Thanks in Advance.
Best regards
Ashish Pandey
The code you provided is working fine except following:
By seeing it we can observe that the slope of the line it slightly changing as soon as we start moving it, from the position it was initially drawn. Means the slope of line at very first time is different from when we first start movement .
Here we need same slope (45°) of line during initial state and while movement too.
Please help me to finalize this task.
Thanks in Advance.
Best regards
Ashish Pandey
Re: Line movement
Hello Amol,
Another tip you may be interested in. Note that there is a ClickedPointer function for the Line series as well. So, if you want the slope to be dragged only through the pointer, you can use it:
That's what I meant when I said:Amol wrote:The code you provided is working fine except following:
By seeing it we can observe that the slope of the line it slightly changing as soon as we start moving it, from the position it was initially drawn. Means the slope of line at very first time is different from when we first start movement .
Here we need same slope (45°) of line during initial state and while movement too.
Please help me to finalize this task.
I'm not sure about the reason why the values aren't correct the first time the chart is drawn but Narcís made me note that moving the slope initialization to the form Shown event, it seems to work as expected:Yeray wrote:The only thing I'm not sure why it isn't working as I'd expect is how the line looks the first time it is drawn. Maybe you can find what I'm missing.
But it seems to work as I'd expect when you drag it, isn't it?
Code: Select all
private void CreateChart()
{
//...
//List<double> XDATA = new List<double>();
//List<double> YDATA = new List<double>();
//CreateDataForHalfSlopeLine(80, 30, ref XDATA, ref YDATA);
//m_lnHalfSlope.Add(XDATA.ToArray(), YDATA.ToArray());
//...
this.Shown += new EventHandler(Form1_Shown);
}
void Form1_Shown(object sender, EventArgs e)
{
List<double> XDATA = new List<double>();
List<double> YDATA = new List<double>();
CreateDataForHalfSlopeLine(80, 30, ref XDATA, ref YDATA);
m_lnHalfSlope.Add(XDATA.ToArray(), YDATA.ToArray());
}
Code: Select all
private void tChart1_MouseDown(object sender, MouseEventArgs e)
{
//...
//indexOfHalfSlopeLine = m_lnHalfSlope.Clicked(e.X, e.Y);
indexOfHalfSlopeLine = m_lnHalfSlope.ClickedPointer(e.X, e.Y);
//...
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Line movement
Hello Amol,
I've done some tests more and I've seen that the order of the series seems to be relevant for the slope to be correctly drawn. So, instead of creating the slope series at the form Shown event, you can simply add the slope series before adding the other two line series:Yeray wrote:I'm not sure about the reason why the values aren't correct the first time the chart is drawn but Narcís made me note that moving the slope initialization to the form Shown event, it seems to work as expected:
Code: Select all
private void CreateChart()
{
//...
tChart1.Series.Add(m_lnHalfSlope);
tChart1.Series.Add(Line1);
tChart1.Series.Add(Line2);
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Line movement
Hi Yeray,
Thank you very much for your kind and precious support. It was very great experience with Steema’s support. Also send my regards to Narcís.
Yes, the solution you provided this time is working as desired. You know my immediate manger is really very happy with this.
I am sure you will be happy to provide me your kind support in future too.
Thanks and regards
Ashish Pandey
Thank you very much for your kind and precious support. It was very great experience with Steema’s support. Also send my regards to Narcís.
Yes, the solution you provided this time is working as desired. You know my immediate manger is really very happy with this.
Yes I know about this function. It returns the index of clicked pointer. But in our project we are not showing pointer and user have to click anywhere on the line to move it. In this case only “Clicked” function helped me. However thanks for the tip.Yeray wrote:
Another tip you may be interested in. Note that there is a “ClickedPointer” function for the Line series as well. So, if you want the slope to be dragged only through the pointer.
I am sure you will be happy to provide me your kind support in future too.
Thanks and regards
Ashish Pandey
Re: Line movement
Hi Yeray,
Sorry I did not see your last post before posting last post of mine. Thanks for the suggestion you provided in your last post.
But we found what we are looking for, with the tip (Form Shown event) you provide in your second last post. Anyway thank you very much for your last post.
Expecting your kind support in future too!
Thanks and regards
Ashish Pandey
Sorry I did not see your last post before posting last post of mine. Thanks for the suggestion you provided in your last post.
I have quickly used this code, by seeing it we can observe that the slope of the line it little changing, this time too, as soon as we start moving it, from the position it was initially drawn.Yeray wrote:
I've done some tests more and I've seen that the order of the series seems to be relevant for the slope to be correctly drawn. So, instead of creating the slope series at the form Shown event, you can simply add the slope series before adding the other two line series
But we found what we are looking for, with the tip (Form Shown event) you provide in your second last post. Anyway thank you very much for your last post.
Expecting your kind support in future too!
Thanks and regards
Ashish Pandey
Re: Line movement
Hi Yeray,
Thanks for your precious support so far.
I am afraid to say I have got one more problem. Our project has a dockable interface so the charts are frequently resized. And I saw that when I resize the chart, and try to move the line it affect slope of the line. This happens each and every time when chart get resized.
To overcome this I add bellow code on Chart’s Resize event. But it doesn't seem to be work.
Anticipating your kind support soon.
Thanks and regards
Ashish Pandey
Thanks for your precious support so far.
I am afraid to say I have got one more problem. Our project has a dockable interface so the charts are frequently resized. And I saw that when I resize the chart, and try to move the line it affect slope of the line. This happens each and every time when chart get resized.
To overcome this I add bellow code on Chart’s Resize event. But it doesn't seem to be work.
Code: Select all
void tChart1_Resize(object sender, EventArgs e)
{
if (m_bIsFormShown) //Do bellow only when form is shown.
{
tChart1.Draw();
CentralPointPix.X = tChart1.Axes.Bottom.CalcPosValue(m_lnHalfSlope[1].X);
CentralPointPix.Y = tChart1.Axes.Bottom.CalcPosValue(m_lnHalfSlope[1].Y);
for (int i = 0; i < 3; i++)
{
PointD tmpPoint = FindPointOfGivenIndex(i);
m_lnHalfSlope[i].X = tmpPoint.X;
m_lnHalfSlope[i].Y = tmpPoint.Y;
}
m_lnHalfSlope.Repaint();
}
}
Thanks and regards
Ashish Pandey
Re: Line movement
Hi Yeray
I am still trying to get rid of this issue at my end. I am also very much optimistic with your forthcoming solution.
Thanks in advance.
Thanks and Regards
Ashish Pandey
I am still trying to get rid of this issue at my end. I am also very much optimistic with your forthcoming solution.
Thanks in advance.
Thanks and Regards
Ashish Pandey
Re: Line movement
Hi Ashish,
Steema technical support mission is assisting Steema customers with TeeChart usage, not implementing their charting projects. Also note that we always try to reply on a timely fashion to all technical support inquiries in this support forums, if you are looking for priority technical support you might be interested in Steema's Pro-Support plan.
Regarding your technical inquiry, I see you use the Bottom axis CalcPosValue to translate both X and Y values to pixels. Note that you need to use the Bottom axis function to get X coordinates in pixels and the Left axis function to get Y coordinates in pixels. So changing your code for this I think solves the problem:
Or maybe easier:
Can you please check if that solves the problem for you?
Thanks in advance.
Steema technical support mission is assisting Steema customers with TeeChart usage, not implementing their charting projects. Also note that we always try to reply on a timely fashion to all technical support inquiries in this support forums, if you are looking for priority technical support you might be interested in Steema's Pro-Support plan.
Regarding your technical inquiry, I see you use the Bottom axis CalcPosValue to translate both X and Y values to pixels. Note that you need to use the Bottom axis function to get X coordinates in pixels and the Left axis function to get Y coordinates in pixels. So changing your code for this I think solves the problem:
Code: Select all
CentralPointPix.X = tChart1.Axes.Bottom.CalcPosValue(m_lnHalfSlope[1].X);
CentralPointPix.Y = tChart1.Axes.Left.CalcPosValue(m_lnHalfSlope[1].Y);
Code: Select all
CentralPointPix.X = m_lnHalfSlope.CalcXPos(1);
CentralPointPix.Y = m_lnHalfSlope.CalcYPos(1);
Thanks in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Line movement
Hi Yeray
Thanks for support and code you provided is working at my end.
It’s sad that you understood me wrongly. I always tried first to explore tee chart help, forums and examples and use our best efforts before posting queries. Generally 70-75 % I got success. I posted only those issues in which I failed. If you observe queries posted, then you will find that I didn’t ask same type of queries again.
Still TeeChart is learning phase for me and i am exploring it as much as possible.
However I am very thankful for Steema support and will try to post fewer queries.
Thanks and Regards
Ashish Pandey
Thanks for support and code you provided is working at my end.
It’s sad that you understood me wrongly. I always tried first to explore tee chart help, forums and examples and use our best efforts before posting queries. Generally 70-75 % I got success. I posted only those issues in which I failed. If you observe queries posted, then you will find that I didn’t ask same type of queries again.
Still TeeChart is learning phase for me and i am exploring it as much as possible.
However I am very thankful for Steema support and will try to post fewer queries.
Thanks and Regards
Ashish Pandey
Re: Line movement
Hello Amol,
Don't take me wrong. We are pleased to try to help our customers on using TeeChart. But sometimes the line between what one can or can't consider to be TeeChart related isn't clear, or at least it is subjective. In other words, Steema's Support Team purpose is teaching how to fish more than giving fishes.
Don't take me wrong. We are pleased to try to help our customers on using TeeChart. But sometimes the line between what one can or can't consider to be TeeChart related isn't clear, or at least it is subjective. In other words, Steema's Support Team purpose is teaching how to fish more than giving fishes.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Line movement
Hi Yeray
I am very much pleased with your the quick response and support. I can understand this.
Thank for all your technical support.
Thanks and Regards
Ashish Pandey
I am very much pleased with your the quick response and support. I can understand this.
Thank for all your technical support.
Thanks and Regards
Ashish Pandey