.NET Framework Bookmark and Share   
 index > Chart Controls for .NET Framework > ChartArea.AxisX.CustomLabels: vertical position of label when AxisY.IsReversed = true;
 

ChartArea.AxisX.CustomLabels: vertical position of label when AxisY.IsReversed = true;

It's no problem when my y-axis is not reversed. Meaning when my yaxis goes from 0 to 100.
When I add custom label(s) to the AxisX for this chartArea, interestingly, the custom labels appear on top (above the chartarea). That's good.
But some of my chartAreas have AxisY.IsReversed = true; That is, they go from Y=+20 (at the bottom) to y=-60.0 (at the top). That's because it's a dB scale, linear.
However, when I add the same customLabels to this chartArea, they appear at the BOTTOM of my chartArea. I would like them at the top. I've tried about everything to do so, including adding the customLabels to the AxisX2 (that didn't work either).
Is there a way to simply tell the ChartArea please put my custom labels on the TOP no matter what the Yscale is?
Thanks
-Dave
DaveMexico
Anyone have an idea on this one?

It seems that there's a bug in the system:

conditions:
add custom label to row1 of AxisX2 (top).
However, then your AxisX.Title doesn't show up any more.
I even tried setting both the AxisX.Title and the AxisX2.Title to the axis label.

OK - then the axis label shows up ALSO on top in the AxisX2 position.
I need it at the bottom, and the custom labels at the top.

AND

If you have AxisY.IsReversed = true

Then your axis numbering is at the top, and you axis title is at the top.
BUT in this case, I want the axis title at the bottom.

I have searched and there are no other threads on this, except some partially related (that mostly deal with logarithmic scales).

Is there any way to add a small image example to the forum posts?

-Dave

DaveMexico
Dave, Anyone...
Ever figure this out? Experiencing a similar issue...I have labels on my X Axis and when I reverse my Y Axis..Poof, X Axis labels are gone...
SanjayU
When you reverse your Y axis the position of the X axis changes from bottom to top. You can adjust that using AxisY.Crossing property.

In any case X axis labels should not dissapear and I was not able to reproduce that. Please make sure ChartArea InnerPlotPosition is set to Auto in your case.

Alex.
http://blogs.msdn.com/alexgor
Alex Gorev
Currently my chart is in dB and goes from +20.0 at the bottom, to -40.0 (dB) at the top.
My label(s) for the AxisX appear on the bottom (I would like them on top),
and my AxisX Title is also at the bottom (where I want it). [I wish I could attached a small .jpg]

I ran the program under the debugger, and I found that the Crossing had a default value of NaN.
double crossing = ca.AxisY.Crossing; (ca in this code sample is my local variable for a ChartArea).

So I first tried setting it to the Maximum.
ca.AxisY.Crossing = ca.AxisY.Maximum;
The result was no change to my Chart.

So, tried it the other way:
ca.AxisY.Crossing = ca.AxisY.Minimum;

That DID something:
The AxisX title stayed at the bottom - good.
It put my custom label "near" the top, but not all the way on top of the ChartArea.
[I actually only have one label, the letter "L" meaning Left].
The label appears somewhere between -30 and -40dB, in the ChartArea itself (along with the data, and the striplines).

So, I tried this:
ca.AxisY.Crossing = ca.AxisY.Minimum - ca.AxisY.Interval;
That made ca.AxisY.Crossing equal to -50, which should be 10 units above the last placement of the label.
Nope - it didn't move.

I tried using both Row1 and Row2 of the custom labels.

Here's my custom label code snippet,

CustomLabel cl1 = new CustomLabel();
// to get the label to show up, you cannot place it from X to X.
// it must be at least X-0.5 to X+0.5
cl1.FromPosition = tickMark.TickValue - 0.5;
cl1.ToPosition = tickMark.TickValue + 0.5;
cl1.Text = tickMark.DisplayValue; //"L";
cl1.RowIndex = 1;
cl1.LabelMark = LabelMarkStyle.None;
ca.AxisX.CustomLabels.Add(cl1);


So, close, but no cookie, yet.

-Dave
DaveMexico
You can try using secondary X axis to display labels which will be automatically placed on top. UseSeries.XAxisType property for that.

Axis title should be still set on the primary X axis. Because there will be no series associated with it you need to make sure that this axis is visible by setting Axis.Enabled property. You may also need to ide the labels on the primary X axis.

Alex.
http://blogs.msdn.com/alexgor
Alex Gorev

You can use google to search for other answers

Custom Search

More Threads

• Bar Charts Question
• clearing png files / column chart label formatting
• Deploying charts with older Framework versions
• Does the install touch the .Net framework?
• How to show StackedGroupName of dundas chart
• StackedColumn diffrent series (columns to begin at Y-Axel 0)
• Using MS Chart assemblies in ASP.NET Application without installation
• How to fix margin and padding of chart when dinamic resize occurs
• Superscript in datapoint label?
• chart animation