Jump to content
Software FX Community

A Question about Min and Max of Y-Axis


Recommended Posts

I am making a 2D chart for a pit. As you see pit goes below the ground level, so I defined a constant line as ground level and made its to be zero. But I also do not want the top of the pit attach all the way to top of the chart. So I define the Max of the Y-Axis to be 1.0 in the code so that I can see the whole graph and at the same there will be a little space between the pit and the top of chart. But when I run the program, I found that the pit tightly attached to the roof of the chart. When I open the Properties -> Y-Axis -> Details -> Scale tab, I found minimum is a pretty reasonable value like -20 or something, but maximum is always 0. What did I do wrong? Will the values defined in the code overwritten the values defined in the Properties Window, or the vise versa? Thanks in advance for anyone who can give a bit of info for this.

the following is part of the code that try to do this job.

private void SetAxis() { double AxisXMin = 0.0; double AxisXMax = 0.0; double AxisYMin = 0.0; double AxisYMax = 0.0; // the Axis X is set to be the max length of headcut length // and tailcut length plus the pit length with 500 exta. AxisXMin = 0.0; AxisXMax = marginX + Lshmax + Lp + Lstmax + marginX; AxisYMin = 0 - (Yp + 1.0); AxisYMax = 1.0; //Initialization of the Axis object setting chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_X].AutoScale = true; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_Y].AutoScale = false; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_X].Min = AxisXMin; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_X].Max = AxisXMax; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_Y].Min = AxisYMin; //When in the debugging run, I see this line of code is executed, but its value is just not right!!  chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_Y].Max = AxisYMax; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_X].STEP = 100; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_X].MinorStep = 10; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_X].Decimals = 1; chartScour.Axis[ChartfxLib.CfxAxisIndex.AXIS_Y].Decimals = 1; .................................... }   
Link to post
Share on other sites

Hi, Frank

After the first post, I commented out four lines of code which are used to assign the min and max values for X-axis and Y-axis, and run the program again. The results are exactly same, so I doubt those four lines of code did not do anything, although they are executed. When I open the Properties -> Y-Axis -> Details -> Scale tab, I found the minimum is -20.0 and maximum is 0.0 for the Y-axis. They should be -21.0 and 1.0 respectively. Does this imply that the culprit is hiding somewhere else? It would be so nice appreciated if you can give a tip for fix!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...