Visualize data with bar chart - GDP data

Visualize data with bar chart - GDP data


The chart seems to work but I am having trouble with formatting the x-axis(dates) and the dates in tooltip. I have used moment js to convert dates into UNIX timestamp but running into issues with data that is before Jan 1st,1970 (EPOCH time).
I am using Zingcharts to render the data.



Can you let us know what you are trying to convert the dates to?


convert dates into UNIX timestamp


Forgive me, I was confused by your post. Is your issue formatting dates? Dealing with Unix timestamps before 1970? Does it have anything to do with Zingcharts? Really, why bring that up? It seems like a red herring. And in the future, a meaningful title might be a good suggestion.

It appeared to me that the issue was formatting and the “convert dates into UNIX timestamp” was some step in that process, with which you were having a problem.

In the future, if you state exactly what you want, show exactly what you tried, and explain exactly how the results are not what you want - you’ll get better results.

I gather from your mocking reply that it is the Unix Timestamp that is foremost on you mind. As far as dealing with Unix Timestamps before 1970, I wasn’t aware that it was an issue. As I understand it, you just use negative numbers. I’ve never used MomentJs, but a few minutes in the docs and I found how to convert back and forth from Unix:

var a = moment('1950-01-01')
// -631123200

var b = moment(-631123200, 'X')
// 1950-01-01T00:00:00-08:00

If you need more help than that, you’ll need to be more specific?


Thanks. I will try this and let you know. I will try to specify more clearly next time.