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

183
Visualizações
Amchart XYchart with multiple series and string-based Y-axis

Using amchart4, I have problems to draw a XYChat with Y-axis as a category-axis (string values), and having multiple series for that.

When I only have one seri which I can set yAxis.dataFields.category there is no problem. Also if I have two series with y-axis as a value-axis (numerical value) there is no problem. The problem happened with Y-category-axis and multiple series.

Here is my code:

  let myData = [
    {
      title: "2",
      //y:6,
      //y1:9,
      customer1: "Internet_BB",
      customer2: "Space",
    },
    {
      title: "1",
      //y:12,
      //y1:6,
      customer1: "Cloud_transmission_BB",
      customer2: "Internet_BB",
    },
    {
      title: "rhs",
      //y:5,
      //y1:7,
      customer1: "COLOCATION",
      customer2: "InternalData_BB_(NIN)",
    }

  ];

    am4core.useTheme(am4themes_animated);

    var chart = am4core.create("XYChartDiv", am4charts.XYChart);

    chart.data = myData;

    var xAxis = chart.xAxes.push(new am4charts.CategoryAxis());
    xAxis.dataFields.category = "title";

    var yAxis = chart.yAxes.push(new am4charts.CategoryAxis());
    // var yAxis = chart.yAxes.push(new am4charts.ValueAxis());

    // Create series
    var series1 = chart.series.push(new am4charts.LineSeries());
    series1.dataFields.categoryY = "customer1";
    // series1.dataFields.valueY = "y"
    series1.dataFields.categoryX = "title";
    series1.name = "customer1";
    series1.strokeWidth = 3;
    series1.tooltipText = "{name} in {categoryX}: {categoryY}";
    series1.legendSettings.valueText = "{categoryY}";

    var series2 = chart.series.push(new am4charts.LineSeries());
    series2.dataFields.categoryY = "customer2";
    // series2.dataFields.valueY = "y1"
    series2.dataFields.categoryX = "title";
    series2.name = "customer2";
    series2.strokeWidth = 3;
    series2.tooltipText = "{name} in {categoryX}: {categoryY}";
    series2.legendSettings.valueText = "{categoryY}";

    chart.cursor = new am4charts.XYCursor();
    chart.cursor.behavior = "zoomY";
    chart.legend = new am4charts.Legend();
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