Reputation: 155
I am new to core plot. I had drawn a bar chart using core plot. I want to remove the bar chart which I drawn using core plot once the view disappeared and draw once again with the new values when the view appears.
Can anyone suggest me a solution to this?
Thanks in advance, Abilash.G
Upvotes: 1
Views: 1242
Reputation: 27381
You have several options, depending on the effect you want to achieve.
You can remove the graph from the hosting view. When the new data is ready, call [graph reloadData]
and add the graph back to the hosting view. Or throw the graph away and make a new one when needed.
A better solution would be to set the visible
property of the graph to NO to hide it and back to YES when you want it to reappear. Reload the data as above.
To hide only the bar chart leaving the rest of the graph visible, you can call [barPlot reloadData]
and don't return any data (number of records for plot == 0). Call -reloadData
again when the new data is ready.
You can also remove the bar plot from the graph and add a new one again when you're ready to display the new data, although #3 above will give you better performance.
Eric
Upvotes: 1