Reputation: 91
I've created a devexpress chart control from a designer
chartControl1
Then I pass this control to one of two classes
DailyChart(chartControl1, id)
In the class I do some magic ;) But then at a runtime I need to present second chart in same control after combobox selection changes. So it goes like
WeeklyChart(chartControl1, id)
But it doesnt restore chartControl's state, and the control doesnt have Reset function or anything like that. Found an advice to create new instance
So I do:
chartControl1 = new ChartControl()
chartControl1 = WeeklyChart(chartControl1,id)
But then I cant see any result I start with DailyChart, works fine Then do new instance and call WeeklyChart and I can see still DailyChart, but then button which were doing some actions on the charts doesnt do anything - it seems like the chart lost reference? Why is that and how to fix it?
IMO when assigning new instance to chartControl1 I shouldnt break reference, and after passing it to another class it should just reset all settings in this control
Upvotes: 1
Views: 94
Reputation: 10478
I'm afraid it doesn't work like that.
If chartControl1
is created from designer and in code you set the variable to a new ChartControl
instance then from then on it will point to that new instance, not the instance that was originally created.
I'm not very familiar with DevExpress chart control but I'm pretty sure you can programmatically make any changes you want in it. Ask on their support center, I'm sure someone can help you with that there.
Upvotes: 2