tag:blogger.com,1999:blog-2691777204722317361.post8730464930869509711..comments2014-04-16T15:44:18.678-07:00Comments on Poco a Poco: Customising the Bubble Series to have Piechart-like Datapoints: Part 2Charleyhttp://www.blogger.com/profile/12609580492024600252noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-2691777204722317361.post-85170916371647328982014-04-16T15:44:18.678-07:002014-04-16T15:44:18.678-07:00You need to set the getter of the X and Y Properti...You need to set the getter of the X and Y Properties to return the value in the underlying field. Eg. Do this "get { return x; }" instead of "get;"<br />Doing this will ensure that when property change notification is triggered, the UI will retrieve the new value that was set to the field x.<br /><br />Then ensure that the List which contains the items you are modifying is the one set as the itemssource of the BubbleSeries.<br /><br />Let me know how it goes.Charleyhttps://www.blogger.com/profile/12609580492024600252noreply@blogger.comtag:blogger.com,1999:blog-2691777204722317361.post-7379455648149347902014-04-16T06:26:43.568-07:002014-04-16T06:26:43.568-07:00Hi, I modified TestDataItem class now it looks lik...Hi, I modified TestDataItem class now it looks like:<br />public class TestDataItem : INotifyPropertyChanged<br /> {<br /> public string Label { get; set; }<br /> public double Total { get; set; }<br /> <br /> private double x; <br /> public double X <br /> { <br /> get; <br /> set<br /> {<br /> x = value;<br /> OnPropertyChanged(new PropertyChangedEventArgs("X"));<br /> }<br /> }<br /> private double y; <br /><br /> public double Y <br /> {<br /> get; <br /> set<br /> {<br /> y = value;<br /> OnPropertyChanged(new PropertyChangedEventArgs("Y"));<br /> }<br /><br /> }<br /> public Breakdown Breakdown { get; set; }<br /><br /> public event PropertyChangedEventHandler PropertyChanged;<br /><br /> public void OnPropertyChanged(PropertyChangedEventArgs e)<br /> {<br /> if (PropertyChanged != null)<br /> {<br /> PropertyChanged(this, e);<br /> }<br /> }<br /> }<br />My algorithm class:<br /><br />public class Algorithm<br />{<br /> public void Execute()<br /> {<br /> ...<br /> ...<br /> while(i < maxIteration) <br /> {<br /> Move() // this method change values X and Y of data point of element in List<><br /> i++;<br /> }<br /> }<br />}<br /><br />Class algorithm has List of points and properties Result which return this list. I want to update location of points in every iteration. My algorithm is executed by click button. But how to notify Chart that values of X and Y changed ?Anonymoushttps://www.blogger.com/profile/18369915276692353188noreply@blogger.comtag:blogger.com,1999:blog-2691777204722317361.post-5916636658689070612014-04-16T04:14:53.622-07:002014-04-16T04:14:53.622-07:00Hi Grzegorz. It's good to know you got it work...Hi Grzegorz. It's good to know you got it working. I suspected that a rebuild could have been the problem too (I just assumed that you would have tried that).<br /><br />Well, in order to change the bubble position at runtime, there are two paths I suggest:<br />1. Raise property change notification on your X and Y properties (and infact for any property whose updates you would wish to inform the UI about). One popular way to do this is to implement the INotifyPropertyChanged interface. See http://www.codeproject.com/Articles/41817/Implementing-INotifyPropertyChanged. <br />In the case of our example above, you would want to implement the interface in the TestDataItem class. This should cause the bubble to change location as soon as you set the X or Y property on any of the objects bound to the BubbleSeries' ItemsSource.<br /><br />2. If the first option doesn't work, then you should try calling bubbleSeries.Refresh() every time you change the X or Y. But I strongly advice you implement the first as a more scalable approach.Charleyhttps://www.blogger.com/profile/12609580492024600252noreply@blogger.comtag:blogger.com,1999:blog-2691777204722317361.post-1727004431717698882014-04-16T03:30:29.968-07:002014-04-16T03:30:29.968-07:00Everything was good, thanks for help, I only have ...Everything was good, thanks for help, I only have to rebuild my project and then it start works. Is it possible to dynamic change bubble position ? I want to use this for visualization algorithm and values of X and Y changes during the execution of the algorithm. Anonymoushttps://www.blogger.com/profile/18369915276692353188noreply@blogger.comtag:blogger.com,1999:blog-2691777204722317361.post-60185974430631935702014-04-15T10:15:00.829-07:002014-04-15T10:15:00.829-07:00What namespace does the TestData class belong to?
...What namespace does the TestData class belong to?<br />You may need to replace the string 'CustomBubble' in xmlns:local="clr-namespace:CustomBubble" with your own namespace.<br />E.g. xmlns:local="clr-namespace:MyNamespace".<br /><br />...<br />You can determine your class' namespace by checking the declaration above the class name.<br />E.g.<br />namespace MyNamespace<br />{<br /> public class TestData<br /> {<br /> ...Charleyhttps://www.blogger.com/profile/12609580492024600252noreply@blogger.comtag:blogger.com,1999:blog-2691777204722317361.post-36602014095459204352014-04-15T07:17:09.112-07:002014-04-15T07:17:09.112-07:00I've error: The tag 'TestData' does no...I've error: The tag 'TestData' does not exist in XML namespace 'CustomBubble'. I add in my MainWindow.xaml file this line: xmlns:local="clr-namespace:CustomBubble" . But this don't work...<br />Anonymoushttps://www.blogger.com/profile/18369915276692353188noreply@blogger.com