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#)
 Semi-autoscaling of y-axis
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

findejs

12 Posts

Posted - 19 Apr 2006 :  03:59:26  Show Profile  Reply with Quote
I want to have one side of y-axis fixed and the opposite one autoscaled, so I have set a scroll frame properties like this:
Frame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MIN;
reps.
Frame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MAX;
In both cases the autoscaled side is calculated correctly, but the fixed side is also rescaled and moreover is rescaling after every UpdateDraw().

You can see this behavior in Polygraph demo if you modify the following line:
beatingHeartScrollFrame.ScrollScaleModeY = ChartObj.RT_NO_AUTOSCALE_Y;
to
beatingHeartScrollFrame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MIN;
or
beatingHeartScrollFrame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MAX;

and you significantly move slider position on the first graph in run-time.

quinncurtis

1585 Posts

Posted - 19 Apr 2006 :  09:37:31  Show Profile  Reply with Quote
Their is no semi-autoscaling mode in the scroll frame. All y-axes within a given scroll frame are going to be treated the same. The proper coding of the Polygraph example would use RT_NO_AUTOSCALE_Y and manually autoscale the axes in the trackbar click event. The use of the manual gain adjust trackbar in the example infers that there is NO auto-scaling of y-axes in the examples

private void voiceStressGainTrackBar_Click(object sender, System.EventArgs e)
{
	double newgainvalue = voiceStressGainTrackbar.RTValue;
	voiceStressScrollFrame.ChartObjScale.ScaleStartY = 0;
	voiceStressScrollFrame.ChartObjScale.ScaleStopY = newgainvalue;
	// Rescale axes to match new scale
			voiceStressScrollFrame.RescaleAxesToCurrentTransform();
	yaxis51.CalcAutoAxis();
	//Right axis
	yaxis52.CalcAutoAxis();
	// Must re-establish the x-intercept of the right y-axis
	yaxis52.AxisIntercept = voiceStressScrollFrame.ChartObjScale.ScaleMaxX;
	this.UpdateDraw();
}


We don't see how two different y-axes, tied to a single coordinate system, can be controlled by two different, independent re-scale methods, one based on the data, and the other the track bar.

Are your two y-axes supposed to represent the same coordinate system, or different coordinate systems. If they are supposed to represent the same coordinate system, why do you want them look different ?

A possible solution may be to use a second, overlapping, coordinate system, and possibly a second ScrollFrame. But we really do not understand the logic of what you are trying to do and can't take it any further.

Go to Top of Page

findejs

12 Posts

Posted - 19 Apr 2006 :  10:16:05  Show Profile  Reply with Quote
I have one transform, one y-axis and one scroll frame. I need to cover the following scenarios:

a) full autoscale, both minimum and maximum value on y-axis is calculated automatically from the data.
Frame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MINMAX

b) semi-autoscale, minimum of y-axis is fixed, maximum is calculated automatically from the data.
Transform.ScaleStartY = SomeValue;
Axis.CalcAutoAxis();
Frame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MAX;

c) semi-autoscale, maximum of y-axis is fixed, minimum is calculated automatically from the data.
Transform.ScaleStopY = SomeValue;
Axis.CalcAutoAxis();
Frame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MIN;

d) no autoscaling, both minimum and maximum of y-axis are fixed.
Transform.ScaleStartY = SomeValue;
Transform.ScaleStopY = SomeOtherValue;
Axis.CalcAutoAxis();
Frame.ScrollScaleModeY = ChartObj.RT_NO_AUTOSCALE_Y;

Scenarios a) and d) work OK. In case of b) and c), the scroll frame rescales both minimum and maximum and the scale is extended in every UpdateDraw() call.
I used Polygraph demo as an example, because the trackbar in the demo sets ScaleStartY and ScaleStopY properties, which is exactly what I'm doing. So, modification of the example seemed to me as the easiest way to show you what I mean.
Go to Top of Page

quinncurtis

1585 Posts

Posted - 19 Apr 2006 :  10:52:13  Show Profile  Reply with Quote
Ok, so we are back to a single y-axis.

We are still not sure what you want. So lets concentrate on scenario B, RT_AUTOSCALE_Y_MAX.

Is it that you want the maximum to be automatically calculated from the data, but you want to arbitrarily go in and change the value of the axis mimimum at any time, and have the axis stick with the new axis minimum until changed again ?

Go to Top of Page

findejs

12 Posts

Posted - 19 Apr 2006 :  10:58:19  Show Profile  Reply with Quote
Yes, it is what I need. The new axis minimum is entered from GUI by a user, the data are coming in independently to the RTProcessVar object.
Go to Top of Page

quinncurtis

1585 Posts

Posted - 19 Apr 2006 :  11:15:22  Show Profile  Reply with Quote
Now, is it critical that you allow the minimum y-axis scale value to be changed at any time by the GUI, after the ScrollFrame has already been setup, or is the intended minimum value known in advance of creating the ScrollFrame.
Go to Top of Page

quinncurtis

1585 Posts

Posted - 19 Apr 2006 :  12:00:45  Show Profile  Reply with Quote
We cannot reproduce your statement concerning scenario B: "the scroll frame re-scales both minimum and maximum and the scale is extended in every UpdateDraw() call.

Our own tests show that that the minimum y-axis scale value maintains its set value, and only the maximum value is auto-scaled. Even when we change the minimum value of the y-axis scale with a trackbar, the new minimum value sticks and only the maximum value is auto-scaled.

private void voiceStressGainTrackBar_Click(object sender, System.EventArgs e)
{
	double newgainvalue = voiceStressGainTrackbar.RTValue;
	voiceStressScrollFrame.ChartObjScale.ScaleStartY =  100 - newgainvalue;
	//voiceStressScrollFrame.ChartObjScale.ScaleStopY = newgainvalue;
	// Rescale axes to match new scale
	voiceStressScrollFrame.RescaleAxesToCurrentTransform();
	yaxis51.CalcAutoAxis();
	//Right axis
	yaxis52.CalcAutoAxis();
	// Must re-establish the x-intercept of the right y-axis
	yaxis52.AxisIntercept = voiceStressScrollFrame.ChartObjScale.ScaleMaxX;
	this.UpdateDraw();
}
Go to Top of Page

findejs

12 Posts

Posted - 19 Apr 2006 :  12:22:34  Show Profile  Reply with Quote
OK, please try to change the code like this

voiceStressScrollFrame.ChartObjScale.ScaleStartY = - newgainvalue;

run application, move a trackbar and wait couple seconds. Thanks.
Go to Top of Page

quinncurtis

1585 Posts

Posted - 19 Apr 2006 :  12:27:55  Show Profile  Reply with Quote
That is exactly what the previous example we posted does. The minimum y-values sticks at the value set using

voiceStressScrollFrame.ChartObjScale.ScaleStartY = 100 - newgainvalue;

What happens when you use the voiceStressGainTrackBar_Click code exactly as we present it in the previous post. The scroll frame is setup in the InitializeVoiceStressScrollGraph using:

voiceStressScrollFrame = new RTScrollFrame(this, voiceStress, pTransform1, ChartObj.RT_FIXEDEXTENT_MOVINGSTART_AUTOSCROLL);
		
voiceStressScrollFrame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MAX;
voiceStressScrollFrame.ScrollRescaleMargin = 0.05;
chartVu.AddChartObject(voiceStressScrollFrame);	


Go to Top of Page

findejs

12 Posts

Posted - 19 Apr 2006 :  12:36:19  Show Profile  Reply with Quote
If I use the posted code everything works OK. To get the wrong behavior I have to set ScaleStartY property to "- newvalue", in your post is "100 - newvalue".
Go to Top of Page

quinncurtis

1585 Posts

Posted - 19 Apr 2006 :  13:00:21  Show Profile  Reply with Quote
OK, it seems that it is only negative values for the scale minimum that cause the problem.
The auto-scale routine seems to constantly be rounding the axis scaling larger. We will have to look into that.

In the meantime you can set the scroll frame AutoScaleRoundYMode to AUTOAXES_EACT. That should prevent the expansion of the scale.

voiceStressScrollFrame = new RTScrollFrame(this, voiceStress, pTransform1, ChartObj.RT_FIXEDEXTENT_MOVINGSTART_AUTOSCROLL);

voiceStressScrollFrame.ScrollScaleModeY = ChartObj.RT_AUTOSCALE_Y_MAX;
voiceStressScrollFrame.AutoScaleRoundYMode = ChartObj.AUTOAXES_EXACT;
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