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

188
Vistas
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 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