Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
Django Pushing JSON formatted data to TimeLine Google Chart visual - converted date to New Date()

I've seen some posts about this but it's still unclear to me how to get this done. I have a Django application that queries a SQL database. I bring this data in and convert it from a pandas dataframe to a JSON format:

tempdata = json.dumps(d, cls=DjangoJSONEncoder)
        return render(request, 'notes/gantt.html', {'data': tempdata})

JSON looks like this:

[["id", "title", "created", "est_completion"], ["3", "Add new Security Group", "2022-04-25", "2022-05-05"]]

I tried to pass this into the google chart visual but I'm getting an error:

Invalid data table format: column #2 must be of type 'date,number,datetime'.

Its my understanding the date format is specific to google charts and needs to be set to new Date(2016, 11, 31)

My question is how can i do that? Is there a for loop I have to run? or is there an easier more straightforward way to do it?

        google.charts.load("current", {packages: ["timeline"]});
        google.charts.setOnLoadCallback(drawChart);
function drawChart() {
            var container = document.getElementById("timeline");
            var chart = new google.visualization.Timeline(container);
            var dataTable = google.visualization.arrayToDataTable({{ data|safe }});
            
            var options = {
                timeline: {showRowLabels: false},
                animation: {
                    startup: true,
                    duration: 1000,
                    easing: "in"
                },
                avoidOverlappingGridLines: true,
                backgroundColor: "#e8e7e7",
            };
            chart.draw(dataTable, options);

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!