Welcome to the Xceed Community | Help
Community Search  
More Search Options

Display 24 hours in X- axis (12.00AM to 12.00AM)

Sort Posts: Previous Next
  •  04-13-2009, 2:59 PM Post no. 20162

    Display 24 hours in X- axis (12.00AM to 12.00AM)

    I'm new to Xceed chart. I have a requirement that need to display the hours (12.00 AM to 12.00 AM) in x axis for selected day. In Y axis have to dispaly double value. I could able to use the examples from sample folders but X- axis not starting with 12.00 AM. It always starts with first available time. For example If I I use the following data to display in chart, the X- axis is starting with 5.30AM, but I want to start with 12.00AM and end with 12.00AM. How to acheive this?

            lineSeries.AddXY(11, new DateTime(2008, 1, 1, 5, 30, 20).ToOADate());
            lineSeries.AddXY(12, new DateTime(2008, 1, 1, 7, 50, 20).ToOADate());
            lineSeries.AddXY(13, new DateTime(2008, 1, 1, 9, 35, 20).ToOADate());
            lineSeries.AddXY(13, new DateTime(2008, 1, 1, 12, 15, 20).ToOADate());
            lineSeries.AddXY(12, new DateTime(2008, 1, 1, 17, 25, 20).ToOADate());
            lineSeries.AddXY(12, new DateTime(2008, 1, 1, 20, 17, 20).ToOADate());

    Thanks
    Sugumar

  •  04-14-2009, 4:53 PM Post no. 20212 in reply to 20162

    Re: Display 24 hours in X- axis (12.00AM to 12.00AM)

    Hi Sugumar,

    the syntax to achieve the desired display is the following:

    chart.Axis( StandardAxis.PrimaryX ).ScaleMode = AxisScaleMode.DateTime;

    chart.Axis( StandardAxis.PrimaryX ).DateTimeScale.AutoMin = false;

    chart.Axis( StandardAxis.PrimaryX ).DateTimeScale.AutoMax = false;

    chart.Axis( StandardAxis.PrimaryX ).DateTimeScale.Min = new DateTime( 2008, 1, 1, 0, 0, 0 ).ToOADate();

    chart.Axis( StandardAxis.PrimaryX ).DateTimeScale.Max = new DateTime( 2008, 1, 1, 23, 59, 59 ).ToOADate();

    chart.Axis( StandardAxis.PrimaryX ).ValueFormatting.Format = ValueFormat.Time;

    chart.Axis( StandardAxis.PrimaryX ).DateTimeScale.MajorTickMode = MajorTickModeDateTime.CustomStep;

    //set the time span to 1 hour, but it could be minutes or seconds

    DateTime span1 = new DateTime( 1, 1, 1, 1, 0, 0 );

    chart.Axis( StandardAxis.PrimaryX ).DateTimeScale.CustomStep = new TimeSpan( span1.Ticks );


    Xceed - Software Developer and Technical Support
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.