Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
How to manipulate and access nested json data file with "beforedatavalidated" option in amCharts?

I tried to manipulate with the option "beforedatavalidated" this json data:

      [("air":{
            "indicateur": 4
            },
      "date": "2021-09-10"

       },{
      "air":{
            "indicateur": 3
            },
      "date": "2021-09-11"

      },{
      "air":{
            "indicateur": 1
            },
      "date": "2021-09-12"

      },{
      "air":{
            "indicateur": 1
            },
      "date": "2021-09-08"

    }]

Here is a part of the configuration of the charts:

// Create axes
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "date";
categoryAxis.renderer.grid.template.location = 0;
categoryAxis.renderer.minGridDistance = 150;
categoryAxis.tooltip.disabled = "visible";

categoryAxis.renderer.labels.template.adapter.add("dy", function(dy, target) {
  if (target.dataItem && target.dataItem.index & 2 == 2) {
    return dy + 0;
  }
  return dy;
})

var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.renderer.minWidth = 50;
valueAxis.min = 0;
valueAxis.cursorTooltipEnabled = false;

// Create series
var series = chart.series.push(new am4charts.ColumnSeries());
series.sequencedInterpolation = "visible";
//series.data.value = air;
series.dataFields.valueY = "air";
series.dataFields.categoryX = "date";
series.tooltipText = "[{categoryX}: bold]{valueY}[/]";
series.columns.template.strokeWidth = 0;
series.columns.template.column.cornerRadiusTopLeft = 10;
series.columns.template.column.cornerRadiusTopRight = 10;
//series.fill = am4core.color("#50f0e6");





series.data.events.on("beforedatavalidated", function(ev){
  var source = ev.target.chart.data;
    if (source.air) {
      ev.target.chart.data = source.air.indicateur;

      }   
    });

I tried to access "indicateur" value but fail at all. I tried to look all over amcharts documentation and could not still understand how to do it in this situation.

Big thanks in advance

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda