Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net
 Real-Time Graphics Tools for .Net (VB and C#)
 SetAxisIntercept Problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

BarryRobertson

USA
21 Posts

Posted - 02 May 2012 :  15:29:40  Show Profile  Reply with Quote
My setup is much like the one described in http://www.quinn-curtis.com/qxy/topic.asp?TOPIC_ID=706, however, I have a different issue.

I have 4 Y-axes and their placement is wrong if they are disabled and later re-enabled. If I update a scale limit afterwards, it will put it in the correct location.

Anyway, I am able to reproduce it with your RTStockDisplay example so you have code to play with. I can send you the .cs file if you let me know where. I basically added two buttons, "hide" and "unhide" the right y-axis and moved some parameter variables out to have access to them. The extra code is below.

Depending on how long it takes between hiding and unhiding, it seems like the position of the axis varies. If you wait 10 seconds or so, it will be off screen apparently.


To reproduce (see extra code below): Click "Hide". Wait 1 second. Click "Unhide". The axis will be offset further to the right than expected (should not move). If you click "Unhide" again, it will reposition it and it is where I would expect it to be in the first place.


Note: earlier in intial set-up, I offset the Y-axes as follows:
yaxis2.SetAxisIntercept(xaxis.AxisMax + 500);

Added a hide and unhide button similar to the zoom/restore buttons.

        private void hide_Button_Click(object sender, System.EventArgs e)
        {
            EnableAxisY2(false);
            
            this.UpdateDraw();
        }

        private void unhide_Button_Click(object sender, System.EventArgs e)
        {
            pTransform2.SetScaleStartY(1960);
            pTransform2.SetScaleStopY(1980);
            yaxis2.CalcAutoAxis();
            yAxisLab2.CalcAutoAxisLabels();
            yaxis2.SetAxisIntercept(xaxis.AxisMax + 500);

            EnableAxisY2(true);

            this.UpdateDraw();
        }

        private void EnableAxisY2(bool isEnable)
        {
            int chartEnable = (isEnable) ? ChartObj.OBJECT_ENABLE : ChartObj.OBJECT_DISABLE;
            
            scrollFrame2.SetChartObjEnable(chartEnable);
            lineplot2.SetChartObjEnable(chartEnable);
            rtPlot2.SetChartObjEnable(chartEnable);
            yaxis2.SetChartObjEnable(chartEnable);
            yAxisLab2.SetChartObjEnable(chartEnable);
        }



Thank you for your help. This is the source of much frustration.

BarryRobertson

USA
21 Posts

Posted - 02 May 2012 :  15:37:06  Show Profile  Reply with Quote
Please excuse the naming, EnableAxisY2, as it obviously does more than enable/disable the Y axis... Essentially, anything related to a plot is hidden or displayed depending on real-time user configuration of what is plotted in 1 of 4 "slots".
Go to Top of Page

quinncurtis

1586 Posts

Posted - 02 May 2012 :  19:00:01  Show Profile  Reply with Quote
When you disable the scrollFrame2, you are detaching the relationship we between the x-axis, which is attached to the first coordinate system, and continues to update, and the x-scale of the second coordinate system, which no longer updates. But you are positioning the yaxis2 with respect the value of the x-axis of the first coordinate system, and the x-scale of the two coordinate systems no longer match. Once you enable scrollFrame2 and start updating it again, the x-scales of the two coordinate system will once again be in sync, assuming the x-values for each set of data match.

Better to use pTransform2.ScaleMaxX + 500 to try and set the y-axis intercept.

pTransform2.SetScaleStartY(1960);
pTransform2.SetScaleStopY(1980);
yaxis2.CalcAutoAxis();
yAxisLab2.CalcAutoAxisLabels();
yaxis2.SetAxisIntercept(pTransform2.ScaleMaxX + 500);


Also, I'm not sure you acutally need to disable scrollFrame2. If you have disabled all of the graphical object associated with it, you don't actually need to disable it. That way the x-scale of the pTransform2 will not fall out of sync with the x-scale of pTransform1. Try it both ways.
Go to Top of Page

BarryRobertson

USA
21 Posts

Posted - 04 May 2012 :  16:03:40  Show Profile  Reply with Quote
Thank you!

The transform maximum as you suggested solved my problem. I have not tried leaving the scroll frame enabled yet.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07