Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Format X axis labels as dd-MM-yyyy not working
posted

Hi,

I've added a WebChart which is bound to a datatable populated from an SQL stored procedure. The datatable has one column that is a DateTime and a second that is a Double. However using the chart definition below I do not get the X axis labels formated as 'dd-MM-YYYY'. Any ideas which attribute is worng?

I'm sett ing the X axis labels  ItemFormat="Custom" ItemFormatString="<DATA_VALUE:dd-MM-yyyy>" ?

Thanks

Paul

<igchart:UltraChart ID="HistoryChart" runat="server" Width="100%"
      BackgroundImageFileName="" BorderColor="Black" BorderWidth="1px"
      ChartType="ScatterLineChart"
      EmptyChartText="No data available for graph."
      Version="8.3">
      <TitleTop Font="Tahoma, 12pt">
      </TitleTop>
      <Tooltips Font-Bold="False" Font-Italic="False" Font-Overline="False"
        Font-Strikeout="False" Font-Underline="False" />
      <Data SwapRowsAndColumns="True">
      </Data>
      <ColorModel AlphaLevel="150" ColorBegin="MediumBlue" ColorEnd="DarkRed"
        ModelStyle="Office2007Style" Scaling="Decreasing"></ColorModel>
      <Axis>
        <PE ElementType="None" Fill="Cornsilk" />
        <X LineThickness="1" TickmarkInterval="10" 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="Near"
             ItemFormat="Custom" ItemFormatString="&lt;DATA_VALUE:dd-MM-yyyy&gt;" Orientation="VerticalLeftFacing"
            VerticalAlign="Center">
            <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" FormatString=""
              HorizontalAlign="Near" Orientation="VerticalLeftFacing" VerticalAlign="Center">
              <Layout Behavior="Auto">
              </Layout>
            </SeriesLabels>
            <Layout Behavior="Auto">
            </Layout>
          </Labels>
        </X>
        <Y LineThickness="1" TickmarkInterval="20" 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="&lt;DATA_VALUE:00.##&gt;" 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>
      </Axis>
    </igchart:UltraChart>

Parents
No Data
Reply
  • 28496
    Offline posted

     To create a scatter chart with time values on the x-axis, use the Series collection with one or more NumericTimeSeries.

    http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/Chart_Display_Data_on_a_Time_Scale_Axis.html

                DataTable table = new DataTable();
                table.Columns.Add("Date", typeof(DateTime));
                table.Columns.Add("Value", typeof(double));
                table.Rows.Add(new object[ { DateTime.Now.AddDays(0.0), 0.0 });
                table.Rows.Add(new object[ { DateTime.Now.AddDays(1.0), 1.0 });
                table.Rows.Add(new object[ { DateTime.Now.AddDays(2.0), 2.0 });
                table.Rows.Add(new object[ { DateTime.Now.AddDays(3.0), 3.0 });
                table.Rows.Add(new object[ { DateTime.Now.AddDays(4.0), 4.0 });

                NumericTimeSeries series = new NumericTimeSeries();
                series.Data.DataSource = table;
                series.Data.TimeValueColumn = "Date";
                series.Data.ValueColumn = "Value";
                series.DataBind();
                this.ultraChart1.Series.Add(series);

                this.ultraChart1.ChartType = ChartType.ScatterChart;
                this.ultraChart1.ScatterChart.ConnectWithLines = true;
                this.ultraChart1.Axis.X.Labels.ItemFormatString = "<DATA_VALUE:dd-MM-yyyy>";
     

Children
No Data