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
125
IgniteUI Line Chart, X Axis as Date and Time
posted

Hi,

How would I format dates as datetime, and how should the var data be formatted.  I understand they're two ways to handle dates, as numeric and as datetime?

Datetime                          Value1     Value2   Value3

09/10/2014 11:40:11        1            2           3

09/10/2014 11:41:11        1            2           3

09/10/2014 11:42:11        1            2           3

09/10/2014 11:43:11        1            2           3




...........Code Snippet....................

<script type="text/javascript">
 
    $(function () {
 
 
 
        var data = [          ???         ];
 
 
        $("#chart").igDataChart({
            width: "500px",
            height: "500px",
            dataSource: data,
            axes: [
                {
                name: "Datetime",
               type: "numericX"
                },
           
              {
                name: "yAxis",
                type: "numericY"
            }],
            series: [{
                name: "series1",
                title: "Test Series",
                type: "line",
                xAxis: "Date",
                yAxis: "yAxis",
                valueMemberPath: "Value1"
            }],
            horizontalZoomable: true,
            verticalZoomable: true,
            windowResponse: "immediate",
            overviewPlusDetailPaneVisibility: "visible"
        });
 
    });
script>
Parents
No Data
Reply
  • 15320
    Suggested Answer
    Offline posted

    Hello John,

    Thank you for contacting Infragistics community.

    I prepared a sample that demonstrates igDataChart with Date type displayed on X axis. Please note that in order to be able to format the Date label, your data source should be configured as following:

     var data = [
        { "Date": new Date(), "Value": 1000 },
        { "Date": new Date(), "Value": 995 },
        { "Date": new Date(), "Value": 925.5 },
        { "Date": new Date(), "Value": 940.25 },
        { "Date": new Date(), "Value": 1020.5 }
       ];

    And you can use formatLabel function to format the X axis label like demonstrated in the documentation: http://help.infragistics.com/jQuery/2014.1/ui.igDataChart#options:axes.formatLabel

    Please take a look at the attached sample and let me know if you have further questions.

    Regards,

    Tsanna

    chartDataFormat.zip
Children
No Data