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

203
Views
¿Cómo representar valores booleanos y de enumeración en un gráfico lineal usando ng-apexcharts?

He conseguido que se muestren los valores, pero que no se comporte correctamente con respecto al eje

HTML:

 <apx-chart [series]="chartOptions.series" [chart]="chartOptions.chart" [xaxis]="chartOptions.xaxis" [colors]="chartOptions.colors" [dataLabels]="chartOptions.dataLabels" [markers]="chartOptions.markers" [yaxis]="chartOptions.yaxis" [title]="chartOptions.title" ></apx-chart>

TS:

 let matrix = {}; const data = this.data.map((point, index) => { matrix[index] = point[this.data.type + 'Value']; let value = this.data.type === 'number' ? point[this.data.type + 'Value'] : index; return { x: this.transformDate(point.createdAt), y: value } }); this.chartOptions = { series: [ { name: this.data.name, data }, ], chart: { height: this.chartHeight, width: this.chartWith, type: "line", dropShadow: { enabled: true, color: "#000", top: 18, left: 7, blur: 10, opacity: 0.2 }, toolbar: { show: false } }, colors: ["#77B6EA", "#545454"], dataLabels: { enabled: true, formatter: (val, index) => { return this.data.type === 'number' ? val : matrix[val]; } }, title: { text: this.data.name, align: "left" }, markers: { size: 1 }, xaxis: { title: { text: "Date" } }, yaxis: { labels: { show: true, formatter: (value, index) => { return this.data.type === 'number' ? value : matrix[value]; } }, title: { text: this.data?.unit || 'Values' }, }, };

Cuando los valores son numéricos no hay problema, el problema es con el booleano y el tipo enum, estos se representan pero mal siempre crecen en el eje y y los valores se repiten

Ejemplos: gráfico con valores de enumeración

Gráfico con valores booleanos

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