Hi,
I have a small problem, I have a series of data from 1990 to 2008, with each year contains 12 months of record. so my data looks like
1990 01 100
1990 02 125
..... so on
2008 12 300
but I want to display in the line chart only the years like 1990 , 1991.....2008 on x-axis. and also year should not repeat. Currently I am getting for each year I am getting twelve number of Year points on x-axis. I know I can sum this data and take an average and put that data for that year from SQL side, but I dont want to do that. Please help me out here
It turned out that your were right. It seems to happen because I use a dataset that I bind to and I asign a label column. Here the labels are strings and not as in the dataset DateTime objects. I ended up inserting a new "label" column in the dataset. Here I'm using different format strings to get the format of choise.
Thanks Uli
oh, and if you do want to implement IRenderLabel, that might turn out to be the easiest solution:
string IRenderLabel.ToString(Hashtable context)
{
string dateString = context["ITEM_LABEL"].ToString();
return DateTime.Parse(dateString).ToString("MMM-dd-yyyy");
}
perhaps the column's DataType from your datasource is string and not DateTime?
I think I need more information to diagnose the problem, perhaps a screenshot and a description of your datasource, or better yet, a sample project.
Anybody any idea on this one? Any help appreciated. Thanks uli
I got the same problem, but I couldn't fix it by setting
TreatDateTimeAsString = false;
I'm using a line chart on a composite chart with a DateTime x-Axis with:
xAxis.Labels.ItemFormat = AxisItemLabelFormat.Custom;
xAxis.Labels.ItemFormatString =
"<ITEM_LABEL:MMM-dd-yyyy>"; //I tried different FormatStrings
xAxis.TickmarkStyle = AxisTickStyle.Smart;
xAxis.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.None;
Am I doing something wrong? Did I forget something? Or does this just not work with Smart-TickStyle? Do I have to Implement a IRenderLabel?
What I try to do is to display the weekdays if they are meaningful.