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

102
Views
La última etiqueta en xaxis desaparece al cambiar el tamaño

Estoy tratando de forzar a los gráficos altos para que muestren la última etiqueta en el eje x cuando el "paso" está habilitado. El código a continuación funciona, pero oculta la última etiqueta cuando cambio el ancho del dispositivo (digamos que abra la consola de Chrome). El problema surge en los dispositivos móviles cuando me desplazo hacia abajo después del gráfico, la última etiqueta desaparece.

 chart: { renderTo: "container", type: "line", events:{ load:function(){ var ticks = $.map(this.axes[0].ticks, function(t){return t;}); ticks[ticks.length-2].render(0); } } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En primer lugar, aparece la última etiqueta 2020 debido a su lógica en el evento de load . Idealmente, esa etiqueta no debería aparecer porque su valor de paso es 3. De todos modos, debe agregar la misma lógica de load en el evento de redraw para obtener la última etiqueta en el cambio de tamaño.

 const df = [ { Period: 2009, value: 1056043 }, { Period: 2010, value: 1278495 }, { Period: 2011, value: 1482508 }, { Period: 2012, value: 1545703 }, { Period: 2013, value: 1579593 }, { Period: 2014, value: 1620531.9 }, { Period: 2015, value: 1502572.2 }, { Period: 2016, value: 1451010.7 }, { Period: 2017, value: 1546273 }, { Period: 2018, value: 1663982.3 }, { Period: 2019, value: 1643160.9 }, { Period: 2020, value: 1431638.4 } ]; var chart = new Highcharts.Chart({ chart: { renderTo: "container", height: 300, type: "areaspline", events: { load: function () { var ticks = $.map(this.axes[0].ticks, function (t) { return t; }); ticks[ticks.length - 2].render(0); }, redraw: function () { var ticks = $.map(this.axes[0].ticks, function (t) { return t; }); ticks[ticks.length - 2].render(0); } } }, title: { text: "Emissions of CO2 - from Fossil Fuels - Total (CDIAC)" }, xAxis: { categories: df.map((o) => o.Period), labels: { step: 3, style: { fontFamily: "Arial, Helvetica, sans-serif;", fontSize: "0.8rem", fontWeight: "600", background: "#000000", whiteSpace: "nowrap", textOverflow: "none" } }, showLastLabel: true, endOnTick: true, overflow: "allow" }, yAxis: { min: 0 }, series: [ { data: df.map((o) => o.value), name: "Germany" } ] });
about 4 years ago · Juan Pablo Isaza Report
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!