JavaScript google charts json date react google charts json example,google charts json to datatable,google

I've been trying to use Google charts with react. It works well, but I've moved the data from a local file to a mongoDB, which gives me a date-issue. With my test-data I added a correct data-format in the google-charts using new Date(...). After moving the data, I'm getting the data from DB as JSON and this gives me a problem with the dates, that are just being printed as strings on my charts.

I've read on google's chart docs, that they automatically rebuild the date object from JSON-strings, if I keep the data in the following order 'Date(2015, 3, 3)'.

My data looks like this:

{ data: 
  [ [ 'Dato', 'Place1', 'Place2' ],
  [ 'Date(2015-9-2)', 100, 0 ],
  [ 'Date(2015-9-3)', 850, 0 ],
  [ 'Date(2015-9-4)', 1125, 0 ],
  [ 'Date(2015-9-5)', 0, 1900 ] ],
  path: 'Gennemsnitlig liggetid fordelt på kommuner' 
}

It's still being interpreted as Strings in the google chart. I've seen other examples, where they're using Rows and Columns. Don't know if that's my mistake. Here's an example from Stackoverflow:

 {"rows":[{"c":[{"v":"Date(year, month)"},{"v":"2095"}]}],"cols":
[{"type":"datetime","label":"DTU"},{"type":"number","label":"COUNT"}]}

So, to sum it up. Everything works when using my testdata. The graph still works, when I'm getting data from DB. But the String dates I'm receiving from DB, isn't being recognized by the google charts as dates.

Hoping for some help or feedback

Regards

Martin

Answer:1

Currently i have the following structure <OverlayTrigger trigger={["hover", "focus", "click"]} placement="bottom" overlay={( <Popover className="timeline-popover-container" id="tpc-1"&...

Currently i have the following structure <OverlayTrigger trigger={["hover", "focus", "click"]} placement="bottom" overlay={( <Popover className="timeline-popover-container" id="tpc-1"&...

  1. popover hide when click outside
  2. popover hide on click
  3. popover hide on body click
  4. popover hide on blur
  5. bootstrap popover hide when click outside
  6. hide popover on mouse leave
  7. hide popover on scroll
  8. hide popover on button click
  9. hide popover on mouse out
  10. hide popover on click inside
  11. popover on hide
  12. hide popover on drag

So I am building a drag and drop form builder and I want to make a particular field on all the inputs readOnly. This can be Select Dropdown Text input Number input Date input Date input All these ...

So I am building a drag and drop form builder and I want to make a particular field on all the inputs readOnly. This can be Select Dropdown Text input Number input Date input Date input All these ...

  1. make only inputs with type 'text'
  2. make a sentence with inputs

tl;dr: How can I chain onto Javascript's map() with my own function? Like - stuff.map(i => i.key).avg() where avg() is my own function to compute the average of the array returned by map? In ...

tl;dr: How can I chain onto Javascript's map() with my own function? Like - stuff.map(i => i.key).avg() where avg() is my own function to compute the average of the array returned by map? In ...

I am working on google bar charts but I am not able to change the background color of google barcharts. Here is my code: <script type="text/javascript"> google.load('visualization', '1', {...

I am working on google bar charts but I am not able to change the background color of google barcharts. Here is my code: <script type="text/javascript"> google.load('visualization', '1', {...

  1. change background google docs
  2. change background google slides
  3. change background google chrome
  4. change background google drawing
  5. change background google calendar
  6. change background google hangouts
  7. change background google slides app
  8. change background google sites
  9. change background google drive
  10. change background google search page
  11. change background google home hub
  12. change background google sheets
  13. change background google hub
  14. change background google slides ipad
  15. change background google earth
  16. change background google forms
  17. change background google chromecast
  18. change background google account