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

122
Views
ngx-charts lines disappear when chart drawn in PrimeNG dialog that is closed and reopened

I am currently using PrimeNG for my typescript angular application. I am using the dialog component provided by PrimeNG to have a pop up that draws charts via ngx-charts (specifically ngx-charts-line-chart). When I first open the dialog the chart draws fine. However, when I close the dialog and then reopen it the lines from the chart disappear with no error outputted. When the chart is in this state I am still able to hover over it and see the points via the tooltip but the lines have completely vanished. The only potential reason for this I can thing of is that when the dialog is closed it is resizing and causing ngx-charts to do something weird.

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

0

Found the answer to this through testing. I used the onHide property of the dialog component to set the chart data to an empty array and then reset the chart data when reopening it.

In your component HTML do

<p-dialog (onHide)="onHide()">-chart stuff here-</p-dialog>

And then in your component ts do

onHide(){ let o = [] as any; this.chartData = [...o]}

I imagine it has to be done this was as when the dialog minimized the chart resizes based on the minimized size and it bugs out with the lines on the chart. But if there are no lines then it doesn't try to draw when minimized.

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!