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 Windows
 ActiveX Controls
 Legend rendering with double Y axis plots
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jfgibson

10 Posts

Posted - 21 Nov 2004 :  21:56:33  Show Profile  Reply with Quote
I am using the WIN-ACX-100 charting ActiveX control with Visual Studio 6.0. I encountered a problem with the legend rendering as soon as I began using the second Y axis. The legend icons (color/shape) do not appear in the correct order.

I recreated the problem using the "Axes" C++ example that comes with the charting control. The example application has been modified to demonstrate the problem as follows: Dataset 2 data and Y Axis 2 scaling has been modified to make that data visible when assigned to either axis. Other than that, the only change is to add the necessary calls to create the legend. The problem is visible with the plot attributes unchanged. The legend icons are improperly placed such that all three are mismatched with the legend strings and with the dataset order.

By simply changing the axis assignment of Dataset 2 (the "scatter" plot) to AXES1, i.e.
m_GraphControl.SetSPlotRefAxes(2, AXES1);
all of the legend icons go to the correct order.

To complete the analysis I changed the Y axis assignments for all possible dataset combinations. One series of tests was done with the original line, bar, and scatter plots from the "Axes" example. The tests were repeated with the plot types all set to line plot. The same results were obtained in both tests, so the problem appears to be independent of plot type. For the eight possible combinations of axis assignment for the three datasets, four combinations produced correct legend icon order, and four produced incorrect icon order. In all cases the actual plots are identical and correct, and the legend strings are in the correct order. The permutations that produced incorrect icon ordering are as follows:
(1) AXES1: dataset[0], dataset[1] AXES2: dataset[2]
(2) AXES1: dataset[0], dataset[2] AXES2: dataset[1]
(3) AXES1: dataset[0] AXES2: dataset[1], dataset[2]
(4) AXES1: dataset[1] AXES2: dataset[0], dataset[2]

Is this a known bug in the control, or is it possible I could be leaving out necessary code? I can provide a code listing, and graph images if that would be helpful.

Jim Gibson

quinncurtis

1164 Posts

Posted - 22 Nov 2004 :  09:32:24  Show Profile  Reply with Quote
It is result of the software processing the legends for plots
tied to the second y-axis first, then processing the legends for the
first y-axis. The two groups are then combined.

The solution is to understand what the software is doing and to
enter the Legend strings in appropriately. If you have data where the
first two plots are tied the first y axis and the second two plots
tied to the second y axis, then the legend strings should follow the order "Three, Four, One, Two".
Go to Top of Page

jfgibson

10 Posts

Posted - 22 Nov 2004 :  18:59:57  Show Profile  Reply with Quote
Ok, thank you. I will look at it from that perspective. I have two related observations / questions that maybe also have solutions that require that kind of understanding:
(1) When using two Y axes, I can no longer set autoaxis to TRUE for Y Axis 1. The control "seems" to account for all datasets, instead of just datasets assigned to Y_AXIS1, in determining the axis limits. Is there in fact a way to use the autoaxis feature in a two-Y-axis plot?
(2) The Y Axis 2 axis markers and labels do not appear unless X Axis 2 is enabled, even though the documentation refers to using 2 Y axes against one X axis. I determined this experimentally when trying to find out why the Y Axis 2 elements were not appearing. Is this a correct observation, or is there a way to display Y Axis 2 with X Axis 2 disabled? Enabling X Axis 2 is not a problem, but I just want to know if it is definitely required.

Jim Gibson
Go to Top of Page

quinncurtis

1164 Posts

Posted - 23 Nov 2004 :  09:46:54  Show Profile  Reply with Quote
The auto-axes routines only work with a single y-axis. This is a limitation of the software.
You can have two different y-axes without enabling the second x-axis. This is exactly what our example program Axes does. Take a look at that program to see where it is different than your own.
Go to Top of Page

jfgibson

10 Posts

Posted - 24 Nov 2004 :  17:15:28  Show Profile  Reply with Quote
It turns out that the "Axes" example application renders Y_AXIS2 (without configuring X_AXIS2) because the axis is anchored manually by the SetAxisIntercept() method. My application was using the SetAxisInterceptTrack() method to automatically compute the X axis intercept. This does not work for Y_AXIS2 if X_AXIS2 is not configured. There is apparently a hard-coded dependency for that particular method. I am now computing my intercept value and using the SetAxisIntercept() method in my application, and it is working correctly.

Jim Gibson
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