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

204
Visualizações
How do I export the current styling of a HighChart series chart to PNG, JPG or PDF?

I am developing a series chart of efficiencies (in percentage) over time.

I have specific requirements for the legend:

  • Clicking on a legend item leaves the series on the chart but fades the line, markers and legend item so that they appear as ‘inactive’
  • Clicking on an ‘inactive’ legend item undoes the fade, so the line, markers and legend item appear as ‘active’
  • Add checkboxes for each legend item – deselecting and selecting a checkbox have the same effect as clicking on the associated legend item
  • Group series by a category header (in the fiddle that is the ‘Chrystalline Si Cells’) – clicking on this header or it’s associated checkbox makes the entire series group ‘active’ or ‘inactive’

All of this is working in a fiddle - https://jsfiddle.net/slaws/0wjpcaqt/138/ - which uses styledMode and a custom legend and dynamically sets the opacity of the chart and custom legend elements:

      $('.highcharts-legend-item.highcharts-series-' + value).css('opacity', new_opacity);
      $('.highcharts-series.highcharts-series-' + value).css('opacity', new_opacity);
      $('.highcharts-markers.highcharts-series-' + value).css('opacity', new_opacity);

However I am struggling with one more key requirement, which is to export the current state of the chart to an image or PDF, with all of series exported with their current 'active' or 'inactive' state. So, if a series is faded, it should be exported as faded to the image or PDF.

Here are screenshots to illustrate:

  • This is the display of chart in the browser with the Multichrystalline series inactive
  • This is how that chart is exported to PNG - I want the Multichrystalline series to be exported to look like it did in the browser, with it's line, markers and legend item faded to make it appear ‘inactive’

Any suggestions how I export the chart with it’s styling currently in effect?

PS The legend in the fiddle may start off misaligned, but rerunning it corrects that.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should not use the CSS to achieve it, but do a series update to keep those changes in the chart config.

events: {
    checkboxClick() {               
        this.update({
            opacity: 0.5
        })
    }
},

Take a look at this approach: https://jsfiddle.net/BlackLabel/b4n0z5k8/

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

about 4 years ago · Juan Pablo Isaza Relatório
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