Formatting dates on x-axis

Answered (Not Verified) This post has 0 verified answers | 7 Replies | 2 Followers Thread's RSS feed.

jordan_martinez
Points 80
Replied On: Wed, Nov 30 2011 3:21 PM Reply

I'm having an issue with getting text formatted on the x-axis of my composite chart.

Here's the snippet in question:

            AxisItem axisX = new AxisItem();
            axisX.DataType = AxisDataType.String;
            axisX.OrientationType = AxisNumber.X_Axis;
            axisX.SetLabelAxisType = SetLabelAxisType.ContinuousData;
           

            axisX.Labels.Orientation = TextOrientation.Custom;
            axisX.Labels.OrientationAngle = 45;

            axisX.Labels.HorizontalAlign = System.Drawing.StringAlignment.Far;
           
            axisX.Labels.ItemFormat = AxisItemLabelFormat.Custom;
            axisX.Labels.ItemFormatString = "<ITEM_LABEL:MM/dd hh:mm>";

My axis orientationangle works fine, but the itemformat and itemformatstring have no affect on what's displayed on the chart at runtime.

First:

How do I get the text displayed on the x-axis to be in the MM/dd hh:mm format?

Second:

How do I get the dates to not bunch up together so closely? The linechart handles this part nicely, the composite chart doesn't. I have to use the composite chart because I need separate y-axis that share the same x.

 


  • Post Points: 20

All Replies

[Infragistics]Hristo
Points 41,491
Infragistics Employee
Replied On: Thu, Dec 1 2011 8:48 AM Reply

Hello,

 

You should use “<DATA_VALUE:MM/dd hh:mm>” for the ItemFormatString  of axisX, instead of "<ITEM_LABEL:MM/dd hh:mm>". On the following link you could find information about label formatting:

http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Chart_Label_Formatting.html

 

if you want to make the space ,between the label of the axisX,  bigger you could setting:

 

           axisX.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Percentage;

            axisX.TickmarkPercentage = 20;

 

more information about those properties you could  find at:

 

http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinChart.v11.1~Infragistics.UltraChart.Resources.Appearance.AxisAppearance~TickmarkPercentage.html

 

Please let me know if you have any further questions

Sincerely,
Hristo
Developer Support Engineer
Infragistics, Inc.

  • Post Points: 20
jordan_martinez
Points 80
Replied On: Thu, Dec 1 2011 9:35 AM Reply

Using: “<DATA_VALUE:MM/dd hh:mm>” just returns the string MM/dd hh:mm on screen. Also changing the following properities caused the axis x labels to overlap.

axisX.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Percentage;
axisX.TickmarkPercentage = 20;

 


  • Post Points: 20
[Infragistics]Hristo
Points 41,491
Infragistics Employee
Answered (Not Verified) Replied On: Fri, Dec 2 2011 10:10 AM Reply
Suggested by [Infragistics]Hristo

Hello,

 

I have created a small sample which sets LabelFormatString of X and Y axis and also adjust the space between labels.

 

Please run the sample and let me know if this is what you are looking for.

 

 

Please let me know if you have any further questions or I am missing something.

Sincerely,
Hristo
Developer Support Engineer
Infragistics, Inc.

  • Post Points: 20
jordan_martinez
Points 80
Replied On: Fri, Dec 2 2011 4:09 PM Reply

I'm having to change my databinding method to test what you are doing. I change chart types from line to composite depending on the data. And the section where you have:

AxisItem axisX = this.ultraChart1.CompositeChart.ChartLayers[0].AxisX;

causes an out of range exception. Once I figure out what I need to do to get that to go away I'll post back.

 

Thanks

  • Post Points: 35
[Infragistics]Hristo
Points 41,491
Infragistics Employee
Answered (Not Verified) Replied On: Mon, Dec 5 2011 4:45 AM Reply
Suggested by [Infragistics]Hristo

Hello,

One possible way to avoid this error is to access chart axises based on the ChartType, which you are using.

Please let me know if you have any  further questions.

Sincerely,
Hristo
Developer Support Engineer
Infragistics, Inc.

  • Post Points: 5
[Infragistics]Hristo
Points 41,491
Infragistics Employee
Replied On: Tue, Dec 13 2011 10:11 AM Reply

Hello, ­­­­­

 

I am just checking about the progress of this issue. Let me know If you need my further assistance on this  issue?

 

Thank you for using Infragistics Components.

Sincerely,
Hristo
Developer Support Engineer
Infragistics, Inc.

  • Post Points: 20
jordan_martinez
Points 80
Replied On: Mon, Apr 16 2012 4:40 PM Reply

Sorry it took me a while to get back on this. It had driven me nuts for months, but didn't have time to return to this issue.

What I had to do was change my data bind method for the series. I had originally set it to a NumericSeries, but had to change it to a NumericTimeSeries. I also had to change the x-axis data type from string to time and label type to datedata.

Thanks for the help.

  • Post Points: 5
Page 1 of 1 (8 items) | RSS