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
185
DateTimes in X Axis
posted

Is it possible right now or are there any plans in the future to support DateTimes as the "Label" of a DataPoint in a Series in the xamWebChart rather than only allowing a String?  It would be nice then if  the "AutoRange" functionality would work with the raw DateTimes.  I know the Silverlight Toolkit Chart and the Infragistics WinForms Chart support this concept.

Thanks.

Parents
No Data
Reply
  • 27093
    Suggested Answer
    posted

    Hello,

    There is such functionality included in our Silverlight Scatter chart. You simply have to place DateTime data in the ValueX type ChartParameter like so:

                     <igChart:Series ChartType="Scatter" >

                        <igChart:Series.DataPoints>                       

                            <igChart:DataPoint>

                                <igChart:DataPoint.ChartParameters>

                                    <igChart:ChartParameter Type="ValueX" Value="02/02/2000" />

                                    <igChart:ChartParameter Type="ValueY" Value="6" />

                                </igChart:DataPoint.ChartParameters>

                            </igChart:DataPoint>...

    and you can easily set the Minimum and Maximum range properties using a converter or from the code behind like so:

                 xamWebChart1.Axes[0].Minimum = new DateTime(1999, 1, 1).ToOADate();

                xamWebChart1.Axes[0].Maximum = new DateTime(2001, 1, 1).ToOADate();

                double unit = new DateTime(1999, 2, 1).ToOADate() - new DateTime(1999, 1, 1).ToOADate();

                //double unit = new TimeSpan(31 * 3 + 30 * 2 + 28).Ticks;

                xamWebChart1.Axes[0].Unit = unit;

                xamWebChart1.Axes[0].AutoRange = false;

    Hope this makes things clearer.

    Please let me know if I can assist you further on this matter.

    Sincerely,

    Petar Monov,

    DS Engineer,

    Infragistics Bulgaria

     

Children
No Data