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

89
Views
seleccionando leyendas usando el botón personalizado en highcharts angular

Hola chicos, he estado trabajando en los gráficos altos y me quedé atascado en una lógica en la que no puedo encontrar la manera. Si alguien puede ayudarme, será de gran ayuda.

HTML

 <highcharts-chart id="container" [Highcharts]="Highcharts" [options]="chartOptions" style="width: 100%; height: 400px; display: block;" > </highcharts-chart>

ARCHIVO TS

 chartoptions:Highchart.options chartOneRender() { this.chartoptions = { title : { text: "Chsart1", }, exporting : { sourceWidth: 1500, sourceHeight: 300, scale: 1, enabled: true, buttons: { contextButton: { menuItems: ["viewFullscreen", "downloadCSV", "downloadPNG", "downloadPDF"], theme: { stroke: '#adaaaa00', fill: '#adaaaa00', }, y: 10, x: 0, }, custom: this.buttonClicker(optionchart) } }, series : [ { name: "s1", type: 'column', data: [20,30,40,50] visible: true, }, { name: "s2", type: 'column', data: [90,98,76,54], visible: false, }, { name: "s3", type: 'column', data: [67,78,89,54], visible: false, }, { name: "s4", type: 'column', data: [89,78,65,45], visible: false, }, { name: "s5", type: 'column', data: [78,56,90,98], visible: false, } ], } } buttonClicker(chartOptions: any) { var button = { y: 10, x: -630, text: 'Select All', theme: { stroke: '#000', states: { hover: { stroke: '#298AFC', fill: '#fff' }, select: { stroke: '#298AFC', fill: '#fff' } } }, onclick: () => { this.chartOptions.series.update({ visible:true }) this.chartOneRender() } return button }

En lo anterior hay una función llamada buttonClicker() Quiero seleccionar todas las leyendas mientras hago clic en el botón. Si alguien sabe alguna solución que me ayude en esto por favor.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En su código this.chartOptions.series se refiere a todas las series en el gráfico. Debe iterar en todas las series y update() cada una de ellas por separado.

Demostración simplificada: https://jsfiddle.net/BlackLabel/oL45egh8/

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

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!