Ticket Q289189
Visible to All Users

If you modify the values in the table the chart is not updated

created 12 years ago (modified 12 years ago)

Find attached the sample in Q382044 with a modification in the main view: I added a DataGrid and a ListBox that show the same data as the chart, and disabled the timer. Now, if I change any value of the "Date" or "Value" columns, the changes are reflected in both the grid and the listbox, but not in the chart. I expected the chart to be aware of the changes in the objects of the collection, just as the listbox and the grid are.
In the end I want an "Excel like" interface, in which you have a table with data and a chart next to it, and as you modify the values in the table the chart is updated.
Any way I can achieve this?
Thank you again, I really appreciate all your effort,
JM

Answers

created 12 years ago (modified 12 years ago)

I have discussed this behavior with our developers. Chart drawing is a more resource-intensive operation than updating a text in DataGrid cells. So, we do not update the Chart control automatically when you edit an element of the collection, for performance reasons. You can update your Chart manually by using the UpdateData() method.
Alternatively, you can accomplish this task at the level of the ObservableCollection. Handle the PropertyChanged event of the collection items to call the OnCollectionChanged method:

C#
internal class A : ObservableCollection<FinancialPoint> { protected override void InsertItem(int index, FinancialPoint item) { base.InsertItem(index, item); ((INotifyPropertyChanged)item).PropertyChanged += new PropertyChangedEventHandler(A_PropertyChanged); } protected override void RemoveItem(int index) { ((INotifyPropertyChanged)this[index]).PropertyChanged -= new PropertyChangedEventHandler(A_PropertyChanged); base.RemoveItem(index); } void A_PropertyChanged(object sender, PropertyChangedEventArgs e) { OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null)); } }
    Show previous comments (1)
    DevExpress Support Team 12 years ago

      Thank you for the suggestion. We appreciate your input. Once we make any decision in this regard, we will update this ticket accordingly. However, I cannot guarantee that we will implement this feature in the near future.

        Thank you for evaluating my suggestion. Just to let you know, I implemented the derived ObservableCollection you suggested and it works perfectly! :-)

        DevExpress Support Team 12 years ago

          Thank you for informing us that the issue has been resolved. We are glad to hear that you have found a solution for this task.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.