Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda