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

199
Views
¿Cómo aumentar el ancho del gráfico de líneas en ng2-charts?

Estoy tratando de representar un gráfico de líneas usando "ng2-charts": "^2.3.0" y "chart.js": "^2.8.0" ,. El gráfico se muestra como se esperaba, pero el único problema es que no puedo aumentar el ancho de línea con la propiedad borderWidth .

Código:

 import { SingleDataSet, Label, Color } from "ng2-charts"; import { ChartType, ChartOptions } from "chart.js"; public barChartType1: ChartType = "line"; public lineChartOptions: ChartOptions = { responsive: true, legend: { display: false }, scales: { yAxes: [ { display: false, ticks: { beginAtZero: false }, scaleLabel: { display: true, labelString: '', fontSize: 20, } }, ] }, elements: { point:{ radius: 0, borderWidth: 50 } }, }; public lineChartColors: Color[] = [ { borderColor: '#5081bd', backgroundColor: 'transparent', }, ];

Modelo:

 <canvas baseChart height="30vh" width="80vw" [colors]="lineChartColors" [datasets]="barChartDataSets1[customdata.index]" [labels]="barChartLabels1[customdata.index]" [options]="lineChartOptions" [chartType]="barChartType1" (chartHover)="chartHovered($event)" (chartClick)="chartClicked($event)"> </canvas>

Entradas:

 barChartDataSets1 [{"data":["2.00","2.00","2.00","2.00","2.00","2.00","2.00","2.00"] barChartLabels1 [" "," "," ","ans1"," "," "," ","ans2"]

Producción:

Producción

¿Hay alguna solución para esto y por qué cambiar la propiedad borderWidth no funciona?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Esto se debe a que colocó la opción en el espacio de nombres incorrecto en lugar de usar options.elements.point , debe colocarla en options.elements.line :

 elements: { point: { radius: 0, }, line: { borderWidth: 8 } },
over 4 years ago · Santiago Trujillo 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!