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 Java
 QCChart2D for Java
 Multiple Y - Axis Log Plot
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

KnightHawk

22 Posts

Posted - 16 Jul 2007 :  12:08:08  Show Profile  Reply with Quote
I am having a problem setting multiple Y-Axes on to a log X-Axis plot. I used the multipleaxes example as a template.

The problem arises when a different dataset with different min/max values need to be plotted that will use a different X-Axis scale.

The Y-Axes that did not have a .setAxisIntercept(0); are then placed in a different location becaues of the new dataset, and are not placed where they were intended. I've also tried using setAxisNormIntercept(), but that doesn't seem to be helping my situation either.

This problem is prevalent when I set the RTScrollFrame attached to this chart to .scrollScaleMode(RT_NO_AUTOSCALE_X); Does this have any influence on where the Y-Axis will be placed?

Is there any example on how to position multiple Y-Axes on a log X-Axis chart, or another method that will set the axis placement that is independent of the scale of the X-Axis plot?

I've found myself running around in circles reading the .pdf's and looking at the .htmls for each class. I hope you can help, or at least point me in the right direction. Thanks.

quinncurtis

1164 Posts

Posted - 16 Jul 2007 :  13:04:50  Show Profile  Reply with Quote
We have a hard time following what you describe because you seem to have so many things going on.

You should be able recalculate the new x-axis intercept for each of your y-axes, each time you do something that changes the x-axis scale, using what ever algorithm you do in the original graph. It is not clear from your text; are you or are you not explicitly changing the x-axis scale? That is when in your words "different dataset with different min/max values need to be plotted that will use a different X-Axis scale". If you change the x-axis scale then you must recalculate new x-axis positions for the y-axes.

Also, why are you using an RTScrollFrame? Are you updating the chart all at once, or one point at a time?





Go to Top of Page

KnightHawk

22 Posts

Posted - 16 Jul 2007 :  13:43:09  Show Profile  Reply with Quote
Sorry for being vague. I have built a real time chart that is updated every second with new data. Updating an RTProcessVar with a new data point does not change the location of any of the Y-Axes.

However, I have options available to the user that allows them to change the presentation of the data by way of two options.
The first option is Real time, where they can view the chart by means of showing all the data or the last n minutes of data.

The second option is a Fixed Interval Timespan, where I do not update the chart with any new data. I then let them either view all the data, or a fixed interval of data, from time n to time k (where n >= first data point, n < k, and k <= last datapoint).

Everytime they choose a new option, eg, go from Real Time to Fixed Interval, I rebuild all the chart components to fit the demands of their selection (I keep the RTProcessVars and their data).

Whenever the Real time is chosen and they switch between All Data and Fixed Interval, it does not seem to cause any problems in axis placement in terms of multiple axes on a log x plot.

When the Fixed Interval is chosen, and any of its options are selected, the Y-axis positions are skewed for any new data.

Every time a new option is selected, be it a Real Time option, or a Fixed Interval option, I re-calculate the intercept position for each y-axis.

The problem seems to be, by your response, that my formula for calculating the intercept position is not correct.
How does .setAxisIntercept() work? It seems to use the scale of the x-axis or the coordinates you provide. With a Log scale, it is proving tricky to calculate a proper offset based on the defined x-axis values or coordinate system. I keep on trying different ways, and different formulas but I can't seem to find one that will give the same offset for any log scale.

Is there anything to change the location of a Y-Axis on the chart without having to use offsets? If not, when I am creating a Y-Axis with a log X-Axis, what variables or objects should I be using in a formula to calculate the y-axis offset (the x-axis intercept, the coordinate system attached to the axis) and what should I keep in mind when creating the formula?
Go to Top of Page

quinncurtis

1164 Posts

Posted - 16 Jul 2007 :  14:46:38  Show Profile  Reply with Quote
You must specify the x-axis position of the y-axis using the coordinate system the y-axis uses. Given that you are unsure how to calculate the y-axis position in the x-axis log coordinates implies that this is where the problem is. You should be able to figure this out. It just involves some log/anti-log work.

For example, if the log x-scale is 1 to 10000, taking the log of those values to linearize things is 0 to 4.

Place y-axes to left with an interval approx. 1/4 of x-axis width.

The interval in log coordiantes is (maxLog - minLog) / 4 = (4 - 0)/4 = 1. So starting at minLog and subtracting this value from each previous position, you get the log values (0, -1, -2, and -3), Taking the anti-log (raising 10 to the power) of these values produces the y-axis intercept values 1.0, 0.1, 0.01, and 0.001.

If the range is 10 to 10000 the log range is 1 to 4. The interval in log coordinates is (maxLog - minLog) / 4 = (4 - 1) / 4 = 0.75. So your log values are 1.0, 1- 0.75 = 0.25, 1- 1.5 = -0.5, and 1 - 2.25 = -1.25. Taking the anti-log (raising 10 to the power) of these values gets you the corresponding y-axis intercept values:

10^1.0 = 10.
10^0.25 = 1.778
10^-0.5 = 0.316
10^-1.25 = 0.0562

If you are still unsure of how to caclulate these values you should probably just hire our special services group to write the code to do it for you.






Go to Top of Page

KnightHawk

22 Posts

Posted - 16 Jul 2007 :  15:22:12  Show Profile  Reply with Quote
Thanks so much, I'll give it a try.
Go to Top of Page

KnightHawk

22 Posts

Posted - 17 Jul 2007 :  23:42:59  Show Profile  Reply with Quote
I got it working, thanks again for the help!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07