Hi guys!
I'm trying to format the label displayed on my chart (DateTime value), but somehow the component is ignoring my configuration. I'd like to know if there's any flag the we need to set on or off to do the component consider our custom formatting?
Here's an exemple of my code:
ultraChart.LineChart.TreatDateTimeAsString = false;ultraChart.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;ultraChart.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL:dd/MM/yy>";
Even with that configuration my date it's been shown like JUL/23/2012 instead of 23/07/12.
What did I miss?
Regards
Hi,
Did you try to set ItemFormt property to custom ?
ultraChart1.Axis.X.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.Custom;
ultraChart1.Axis.X.Labels.ItemFormatString ="<ITEM_LABEL:dd/MM/yy>";
Please try this suggestion and let me know what is the result. If you have any questions, feel free to ask me
I've tried that too without success.
Even doing like the following code, I'm not able to set the date format properly.
ultraChart.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.None;
// or ultraChart.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
ultraChart.Axis.X.Labels.ItemFormat = AxisItemLabelFormat.Custom;
ultraChart.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL:dd/MM/yy>";
ultraChart.Axis.X.RangeType = AxisRangeType.Custom;
For sure I'm missing something.
Regards.
hi inspite of following above steps, I m not getting proper result
code is
chartInfragistic.ChartType = ChartType.LineChart;
chartInfragistic.Series.Clear();
//chartInfragistic.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
//chartInfragistic.LineChart.TreatDateTimeAsString = false;
//chartInfragistic.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL:dd/MM/yy>";
chartInfragistic.Axis.X.Labels.Orientation = TextOrientation.VerticalLeftFacing;
int i = 0;
foreach (UltraListViewItem item in statList.CheckedListBox.CheckedItems)
{
string key = item.Key;
string title = item.Text;
if (table.Columns.Contains(key) && table.Rows[0][key] != null)
NumericSeries s = new NumericSeries();
s.Label = title;
s.DataBind(table, key, Fields.Name.COB_DATE);
s.PEs.Add(new PaintElement(colors[i % colors.Count]));
chartInfragistic.Series.Add(s);
i++;
}
chartInfragistic.Tooltips.Display = Infragistics.UltraChart.Shared.Styles.TooltipDisplay.MouseClick;
chartInfragistic.Tooltips.Format = Infragistics.UltraChart.Shared.Styles.TooltipStyle.LabelPlusDataValue;
chartInfragistic.Tooltips.Overflow = TooltipOverflow.ChartArea;
chartInfragistic.Tooltips.BackColor = Color.Yellow;
chartInfragistic.Tooltips.FontColor = Color.Blue;
chartInfragistic.Tooltips.BorderColor = Color.Red;
chartInfragistic.Tooltips.BorderThickness = 3;
chartInfragistic.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
chartInfragistic.Axis.X.Labels.SeriesLabels.FormatString = "";
chartInfragistic.Axis.X.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
chartInfragistic.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL:dd/MM/yy>";
chartInfragistic.Axis.X.Visible = true;
chartInfragistic.Axis.X.Labels.Visible = true;
chartInfragistic.Axis.X.Labels.SeriesLabels.Visible = true;
//chartInfragistic.Axis.X.Labels.Layout.Behavior =
// Infragistics.UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.None;
chartInfragistic.Axis.X.Extent = 20;
in above screenshot, the x axis labels are getting truncated. how to avoid it
I just discovered what I missed! I was setting the chart type after changing my Axis.X configuration. This was causing a reset of my configurations. To work I just moved the line where I set my ChartType to the first place on my code.
this.ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart;
ultraChart.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
ultraChart.Axis.X.Labels.Orientation = TextOrientation.VerticalLeftFacing;
ultraChart.Axis.X.Labels.SeriesLabels.FormatString = "";
ultraChart.Axis.X.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
Kind regards.