Nevin
Nevin

Reputation: 3306

Chart plotting - No data for corresponding date issue

As you can see here, on the X-Axis the dates are equidistant inspite of the date's varying in range.

Chart screenshot [Right click->Open in a new tab if you can't see the pic]

But the X-axis distance is equivalent for both.

  1. I want the X-axis to show value 0, when there's no value for a particular date..

    Possible Solutions:

    • Is there any inbuilt parameter that am missing within AMcharts itself for this?
    • The other solution i had in mind was to input value 0 for date's having no corresponding data. [But this will lag the front end]
  2. The date format issue where:

    For a date, 2014-11-12 10:15, the "dataDateFormat": "YYYY-MM-DD JJ:NN" doesn't seem to work. Tried to do it in milliseconds as well, didn't work. Here's my fiddle

       "dataProvider": [{
                         "date": "1343364300000",
                         "value": 1
                        },{
                         "date": "1343364900000",
                         "value": 5
                        },{
                         "date": "1343365500000",
                         "value": 10
                        },{
                         "date": "1343366100000",
                         "value": 15
                        },{
                         "date": "1343366100000",
                         "value": 8
                        },{
                         "date": "1343369520000",
                         "value": 24
                        },]
    

This is the chart am using for this.

http://www.amcharts.com/demos/date-based-data/#

Upvotes: 5

Views: 459

Answers (1)

jmventar
jmventar

Reputation: 697

For first point I think if you need to display 0 on empty data the only way is to implement your zero fill function on server side or JS.

I ran with same issue months ago and had to implement on my server side because there isn't any built in function in the library to do that.

Second point. Your date formatter is running ok, the problem is you have pan and zoom activated together. Then you are not able to zoom and see formatted dates because categoryAxis.parseDates groups them in Months. I would suggest you disable chartCursor.pan and put a min period on category axis of mm or ss.

Here's your modified fiddle.

Upvotes: 0

Related Questions