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
Try setting these properties on the x axis:TickmarkStyle = AxisTickStyle.DataIntervalTickmarkInterval = 1TickmarkIntervalType = AxisIntervalType.YearsIf your x axis uses date time values then you should see one label for each year.
Sorry for the late reply. I caught up with other projects so I could not test it. I did what you said, but still I am not getting X-axis lables. I did everything. Here is my UltraChart
<igchart:UltraChart ID="UltraChart1" runat="server" ChartType="LineChart" DataSourceID="ObjectDataSource1" Version="8.1" Width="250px" Height="150px" EmptyChartText="Data Not Available. " Section508Compliant="True" BackgroundImageFileName=""> <TitleBottom Visible="False" HorizontalAlign="Far" Location="Bottom" Extent="0"> <Margins Top="0" Left="0" Right="0" Bottom="0"></Margins> </TitleBottom> <Data SwapRowsAndColumns="True" RowLabelsColumn="0"> <EmptyStyle LegendDisplayType="Point"> <PointStyle CharacterFont="Microsoft Sans Serif, 7.8pt"> </PointStyle> <LineStyle DrawStyle="Dash" /> </EmptyStyle> </Data> <Border CornerRadius="5"></Border> <TitleLeft Location="Left" Extent="33" Visible="True"> </TitleLeft> <TitleRight Location="Right" Extent="33" Visible="True"> </TitleRight> <ColorModel AlphaLevel="150" ColorBegin="Red" ColorEnd="Black" ModelStyle="CustomSkin" Scaling="Increasing"> <Skin ApplyRowWise="False"> <PEs> <igchartprop:PaintElement Fill="0, 51, 102" FillStopColor="Green"> </igchartprop:PaintElement> <igchartprop:PaintElement Fill="102, 102, 51" FillGradientStyle="Horizontal" FillStopColor="Goldenrod"> </igchartprop:PaintElement> <igchartprop:PaintElement Fill="153, 51, 51" FillGradientStyle="Horizontal" FillStopColor="Black"> </igchartprop:PaintElement> </PEs> </Skin> </ColorModel> <Axis> <Y Extent="30" LineThickness="1" TickmarkInterval="100" TickmarkStyle="Smart" Visible="True"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Far" ItemFormatString="<DATA_VALUE:##,###,###>" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" FormatString="" HorizontalAlign="Far" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y> <PE ElementType="None" Fill="Cornsilk" /> <X Extent="20" LineThickness="1" TickmarkInterval="1" TickmarkStyle="DataInterval" Visible="True" TickmarkIntervalType="Years"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" HorizontalAlign="Near" ItemFormatString="<ITEM_LABEL:MM/YY>" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" HorizontalAlign="Near" Orientation="VerticalLeftFacing" VerticalAlign="Center" FormatString="<ITEM_LABEL>" Visible="False"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="UseCollection"> <BehaviorCollection> <igchartprop:FontScalingAxisLabelLayoutBehavior EnableRollback="False"> </igchartprop:FontScalingAxisLabelLayoutBehavior> <igchartprop:WrapTextAxisLabelLayoutBehavior> </igchartprop:WrapTextAxisLabelLayoutBehavior> <igchartprop:StaggerAxisLabelLayoutBehavior> </igchartprop:StaggerAxisLabelLayoutBehavior> <igchartprop:RotateAxisLabelLayoutBehavior> </igchartprop:RotateAxisLabelLayoutBehavior> <igchartprop:FontScalingAxisLabelLayoutBehavior EnableRollback="False" MinimumSize="5.9"> </igchartprop:FontScalingAxisLabelLayoutBehavior> <igchartprop:WrapTextAxisLabelLayoutBehavior> </igchartprop:WrapTextAxisLabelLayoutBehavior> <igchartprop:StaggerAxisLabelLayoutBehavior> </igchartprop:StaggerAxisLabelLayoutBehavior> <igchartprop:RotateAxisLabelLayoutBehavior> </igchartprop:RotateAxisLabelLayoutBehavior> <igchartprop:ClipTextAxisLabelLayoutBehavior> </igchartprop:ClipTextAxisLabelLayoutBehavior> </BehaviorCollection> </Layout> </Labels> </X> <Y2 LineThickness="1" TickmarkInterval="100" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" ItemFormatString="<DATA_VALUE:00.##>" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" FormatString="" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y2> <X2 LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Far" ItemFormatString="<ITEM_LABEL>" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" FormatString="" HorizontalAlign="Far" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </X2> <Z LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Near" ItemFormatString="" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Z> <Z2 LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" ItemFormatString="" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Z2> </Axis> <LineChart EndStyle="ArrowAnchor" HighLightLines="True" MidPointAnchors="False" Thickness="10"> </LineChart> <Legend FormatString="<SERIES_LABEL>"></Legend> <Tooltips Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" FormatString="<DATA_VALUE:##,###,###>" Padding="3" /> <ClientSideEvents ClientOnMouseClick="UltraChart1_ClientOnMouseClick" /> </igchart:UltraChart>
and my data looks like
COL1 COL2
2000-01-15 00:00:00.000 702000-02-15 00:00:00.000 802000-03-15 00:00:00.000 802000-04-15 00:00:00.000 802000-05-15 00:00:00.000 902000-06-15 00:00:00.000 902000-07-15 00:00:00.000 100 ...
....
2008-03-15 00:00:00.000 1242008-04-15 00:00:00.000 133
this document might help: http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/Chart_Display_Data_on_a_Time_Scale_Axis.html
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.
Anybody any idea on this one? Any help appreciated. Thanks uli
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.
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