Replies: 2 comments
-
same problem. did you find a solution?
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I suspect your solution is not working because you're using As a rule, you should never use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How do I update the data of a
Chart
?I'm using MAUI and I have a
ChartView
that has a renderedChart
, but at a later point in time, the data changes.I can't bind the
Entries
of any type ofChart
, so I opted to bind theChartView.ChartProperty
and generate a completely new chart, but this method will not clear the canvas before redrawing, it will simply draw an additional copy of the chart somewhere on the canvas, it does in fact seem to attempt to avoid drawing over the previous chart if possible.The canvas is not accessible, so I can't manually erase it.
In the context where the update comes in, I do not know the exact subclass of the current
Chart
.Chart
itself has noEntries
property, so I can't change that.Even if I first change the
ChartView.Chart
tonull
, the canvas is not erased.UPDATE:
Turns out the canvas is only erased when you set the
Chart
tonull
. However when you use MVVM and bindings in MAUI, it won't work well together:null
to clear canvasI tried a different step 2 where I set the
ChartView.Graph
tonull
, but that doesn't work either.I managed to get it to work when I introduced a delay between 2 and 3, but that's ugly and not guaranteed to work.
Beta Was this translation helpful? Give feedback.
All reactions