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

257
Vistas
Highcharts: Dynamically update export filename

I am using highcharts to create various charts, and I also have a monthpicker so that the user can choose the month for which data will be shown on the chart. Each time the user picks a different date, a new chart is loaded. Since the 'exporting: filename' is set only once during the initialization of the chart, each time the user uses the export as CSV option the downloaded file has the name that has been set during the initialization of the chart.

I have added a var in the 'exporting: filename' option to read the value of the monthpicker, using this:

var Name = $("#date_picker").val();

exporting: {enabled: true,
            filename: "Monthly Report: - " + Name + ""
           }

but it does not update the filename when the user picks a different month from the one that is set during the initial page load.

I have also tried adding a button to run the downloadCSV script and update the filename this way:

var Name = $("#date_picker").val();
document.getElementById('button1').addEventListener('click', function () {
        highcharts.chart("report_chart").update({
                events: {
                    load: function () {
                        this.update({
                            exporting: {
                                filename: "Monthly Report - " + Name + ""
                            }
                        });
                    }
                }
             });
    });

but it has not worked out the way I want it to.

Is there a way to update dynamically the filename of the CSV that is exported so that it includes the month that the user has picked in the date picker?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You just need to change the filename in chart.update:

  chart.update({
    exporting: {
      filename: "Monthly Report: 2"
    }
  });

Live demo: http://jsfiddle.net/BlackLabel/1qyL0sej/

API Reference: https://api.highcharts.com/class-reference/Highcharts.Chart#update

about 4 years ago · Santiago Trujillo Denunciar
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