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 & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 StringAxisLabels
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

carlao

54 Posts

Posted - 23 Apr 2005 :  09:37:22  Show Profile  Reply with Quote
I have the following string labels
yAxisStrings = new string[]{"A","B","C","D","E","F","G","H","I","J","K"};
When I have 10 tick points in my Y axis I have the string labels displayed correctly. When I add more one tick point resulting in 11 tick points, then I have the following string order
"K","A","B","C","D","E","F","G","H","I","J"
That is, K is displayed as the first string in the Y axis. It seems that StringAxisLabels is using lexical order instead of use the exat order in the yAxisString array.
Is there a way to fix it?

quinncurtis

1164 Posts

Posted - 23 Apr 2005 :  11:22:55  Show Profile  Reply with Quote
Show the code that you used to create the 11 tick mark axis that recreates the problem.
Go to Top of Page

carlao

54 Posts

Posted - 23 Apr 2005 :  14:29:40  Show Profile  Reply with Quote
This is the snippet code.
When the app try to display the Y axis of number 4 using values from 1 to 12, the last string element, 4OD, is showed in the first place. If I use only 11 Y values then P element now is the first but 4OD is not displayed.

public override void SetYaxisLabel()
{
for( int i=0; i < nTraces; i++ )
{
if(2 == i || 3 == i || 4 == i || 6 == i || 7 == i)
{
String [] yAxisStrings=null;

if( 2 == i)
yAxisStrings = new string[]{"1","2","3","4"};
else if( 3 == i)
yAxisStrings = new string[]{"P","R","N","4","3","2","1"};
else if( 4 == i)
yAxisStrings = new string[]{"P","R","N","1","1OD","2","2OD","3","3OD","4","4OD"};
else
yAxisStrings = new string[]{"","","","","",""};
if(i == 2 || i == 3 || i == 4)
{
YAxis[i].SetAxisTickSpace(1);
YAxis[i].SetAxisMinorTicksPerMajor(1);
}
StringAxisLabels yAxisLab = new StringAxisLabels(YAxis[i]);
yAxisLab.SetAxisLabels(theFont, 0, ChartObj.AXIS_MIN, ChartObj.LABEL_ALL,
Color.Black, yAxisStrings, yAxisStrings.Length);
chartVu.AddChartObject(yAxisLab);
}
else
{
YAxisLab[i] = new NumericAxisLabels(YAxis[i]);
YAxisLab[i].SetTextFont(theFont);
YAxisLab[i].SetAxisLabelsFormat(ChartObj.BUSINESSFORMAT);
chartVu.AddChartObject(YAxisLab[i]);
}
}
chartVu.UpdateDraw();

}
Go to Top of Page

quinncurtis

1164 Posts

Posted - 23 Apr 2005 :  18:41:41  Show Profile  Reply with Quote
That's not what I wanted. I want to see how the y-axis is created. What are the mininum and maximum values for a y-axis where the problem occurs ?
Go to Top of Page

carlao

54 Posts

Posted - 24 Apr 2005 :  10:18:08  Show Profile  Reply with Quote
When I have 10 values for Y, that is, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, the last displayed string is "4". That is right. But when I add more one value, that is, when I use 11.0 or Y(11), my last string should be "4OD" but "4OD" goes to the first position in the Y axis. I changed my string array by "A", "B", "C".... "K" and K is displayed as the first string also.
Go to Top of Page

quinncurtis

1164 Posts

Posted - 24 Apr 2005 :  11:37:28  Show Profile  Reply with Quote
Show the code that creates the y-axis (third request), NOT the axis labels, but the actual y-axis.
Go to Top of Page

carlao

54 Posts

Posted - 24 Apr 2005 :  15:47:36  Show Profile  Reply with Quote
Here is the code.

for (int i=1; i < nPoints; i++)
{
x[i] = (ChartCalendar) currentdate.Clone();
((double[])YArray[0])[i] = ((double[])YArray[0])[i-1] + 250.0 * (0.55 - ChartSupport.GetRandomDouble());
((double[])YArray[1])[i] = (double)dummy_IntValuesWitNoZero(12);
currentdate.Add(ChartObj.MINUTE,5);
}

public static int dummy_IntValuesWitNoZero(int range)
{
int val=0;
do
{
val = (int)(range * ChartSupport.GetRandomDouble());
}while(val == 0);
return val;
}
Go to Top of Page

quinncurtis

1164 Posts

Posted - 24 Apr 2005 :  16:52:45  Show Profile  Reply with Quote
I see some values created, which are probably used for the axis endpoints, but I still see no axes being created.

If your y-axis starts on a negative value, then the string axis labels will START at the value of the LinearAxis.AxisTickOrigin value, which is probably 0. The tick mark labels will then be used in a positive direction until the end of the axis is reached, then go back to do the negative side of the axis with remaining string labels.

If you want the string axis labels to start at the first tick mark, even if it is negative, use the following code.

yAxis.AxisTickOrigin = yAxis.AxisMin;

If this doesn't solve the problem you will need to modify one of our exmaple programs to use exactly the same axis parameters you are using and send us that modified source file in order to debug it.



Go to Top of Page

carlao

54 Posts

Posted - 24 Apr 2005 :  17:14:44  Show Profile  Reply with Quote
This is the line that I use to generate the Y axis
((double[])YArray[1])[i] = (double)dummy_IntValuesWitNoZero(12);
As you can see I dont have negative values in Y axis. The minor number in Y axis is 1. Even so, your suggestion worked fine.

yAxis[i].AxisTickOrigin = yAxis[i].AxisMin;

Now 4OD is the last string in the Y axis and not the first one as I had before.
Thanks.
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