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
  • 105
    posted

    I am not sure about the format, but one way to solve this problem would be to add the points with the desired format. Something like this:

    Chart.Points.Add(new NumericDataPoint(value, DateTime.Today.ToString("dd-MM-yyyy"), false)

     or if you are doing direct databinding then change your source data to desired format.

Children