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.
How do I get the text displayed on the x-axis to be in the MM/dd hh:mm format?
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.
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:
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:
Please let me know if you have any further questions
Sincerely,HristoDeveloper Support EngineerInfragistics, Inc.
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;
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.
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.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.
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.
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.
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.