Hi,
I have two scatter series that represents points and another scatter series that draws the polygons based on some condition to connect these scatter points.
I built a bubble series to be displayed on some of the scatter points.
The issue that I ran into is:
- If I display either bubble series or scatter polygon series along with scatter , either one of the them is displayed.
If I keep bubble series with scatter series(polygons), then polygons are not drawn.
Here is the code:
<ig:XamDataChart Grid.Row="2" x:Name="chart" RefreshCompleted="chart_RefreshCompleted" HorizontalZoomable="True" VerticalZoomable="True" Margin="5,5,5,5" > <ig:XamDataChart.Axes> <ig:NumericXAxis x:Name="xAxis" MinimumValue="{Binding minXvalue}" MaximumValue="{Binding maxXvalue}" MajorStroke="Transparent" Label="{}{0:00}" /> <ig:NumericYAxis x:Name="yAxis" MinimumValue="{Binding minYvalue}" MaximumValue="{Binding maxYvalue}" MajorStroke="Transparent" Label="{}{0:00}" /> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:BubbleSeries XMemberPath="Xlocation" YMemberPath="Ylocation" RadiusMemberPath="BubbleValue" FillMemberPath="BubbleValue" MarkerType="Circle" ShowDefaultTooltip="True" MarkerBrush="Black" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ItemsSource="{Binding ComplianceProducerDataGrid}"> <ig:BubbleSeries.RadiusScale> <ig:SizeScale IsLogarithmic="False" MinimumValue="35" MaximumValue="70" /> </ig:BubbleSeries.RadiusScale> </ig:BubbleSeries>
<ig:ScatterSeries XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" MarkerType="Circle" Brush="SteelBlue" MarkerBrush="Green" ShowDefaultTooltip="True" ItemsSource="{Binding Data}" XMemberPath="XValue" YMemberPath="YValue"></ig:ScatterSeries>
<ig:ScatterSeries XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" MarkerType="Hexagon" Brush="SteelBlue" MarkerBrush="Blue" ShowDefaultTooltip="True" ItemsSource="{Binding Data_Inj}" XMemberPath="XValue" YMemberPath="YValue"></ig:ScatterSeries> <ig:ScatterSeries XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ItemsSource="{Binding ConnectData}" XMemberPath="XValue" YMemberPath="YValue"/>
</ig:XamDataChart.Series> </ig:XamDataChart>
Image1 (No Polygons): As you can see I don't see polygons
Image 2( Polygons but no Bubbles): I had to comment out bubble series in XAML to be able to see the polygons!
Image2 is here.
Hello Jay,
I am rather curious as to how exactly you are drawing the polygons onto the XamDataChart. I imagine that at the moment, it is likely that you are drawing them onto the RootCanvas of one of your series, or perhaps one of your axes, but if this assumption is incorrect, please let me know.
If my above assumption is correct, then depending on which of these you are drawing on, it may be possible that the polygons are laying over the top of your BubbleSeries, which could explain why you aren’t seeing that series. You could verify this by making the fill of your polygons more transparent or opaque, as this would allow you to see through them to see if the bubbles are being drawn underneath.
Would it be possible for you to please provide some more information or perhaps an isolated sample project that demonstrates the way that you are currently drawing the polygons on your XamDataChart?
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hi Andrew,
I put together a sample attached here. In my case, the points to connect the polygons is done using an algorithm but in the sample its simplistic. Nevertheless, that shouldn't matter.
Remember in my case, I am using one scatter series to get display points, another scatter series to populate the points for polygons and then a bubble series to populate bubbles. During debug mode, I can see all series populating correctly but fails to show both polygons and bubbles at the same time.
Thanks for the help, Andrew.
Looking fwd to the resolution.
Jay
Does it work for you?
I have been investigating into your project, and after adding a call to the "GetBubbleData()" method in the constructor of the ViewModel, I am able to see the ScatterSeries, BubbleSeries, and the polygon after clicking the button. In an attempt to make this sample project a bit more like your requirement's description, I have also added another "display" ScatterSeries. After adding this, I am still able to see the BubbleSeries and the polygon after clicking the button.
I had noticed that the assemblies in your sample project were set to "Specific Version = False," and so the project instantly picked up on the version I have installed on my machine, which is version 15.2.20152.2160. I cannot be sure if this is the same specific version that you had tested against, and if it isn't would it be possible for you to please provide the version number of the Infragistics assemblies that you are testing against?
I have attached the modified version of the sample project you sent. Please let me know if you are still able to reproduce this behavior that you are seeing with these modifications.
Thanks for looking into this Andrew.
Why is it necessary to add call to "Getbubbledata()" in the constructor itself?
In my scenario, user first picks the bubble variable via a combobox, then clicks on "connect shapes" button; the bubble data is populated after user picks the variable in UI. I believe adding a call to "getbubbledata()" in the constructor will not work in this scenario. That's why I set the call to "Getbubbledata" in the "private void connectShapes_Click(object sender, RoutedEventArgs e)".
do you think the bubble series will work with polygons only when it is called in constructor? I am confused.
Again, your version only works when call is made in the constructor.
I apologize, I didn't originally see the call to getBubbleData() in your button click. After removal of the getBubbleData() method call from the ViewModel constructor, I am now able to see the behavior you are seeing. This is still an issue with the sample project, though, and not the XamDataChart.
The reason for this is due to the instantiation of the DataBubble ObservableCollection<BubbleData> property, and the fact that it currently does not implement the INotifyPropertyChanged interface. In the getBubbleData() method call, you are setting this property to a new instance of ObservableCollection<BubbleData> at runtime due to the button click. Since you are not implementing INotifyPropertyChanged in this case, your UI will not be notified that anything has changed with that DataBubble collection, and so the BubbleSeries never updates.
As an alternative to implementing the INotifyPropertyChanged interface, you can also remove the instantiation of the DataBubble collection from your GetBubbleData() method, and instantiate it in the ViewModel's constructor. This doesn't necessarily mean you need to populate it there, but since it will already be instantiated, and since the ObservableCollection class implements INotifyCollectionChanged, this will allow you to see the changes to the data source when you do populate it via your button click.
I have attached a modified version of your sample project to demonstrate the above. I hope this helps.
Thanks Andrew for the explanation and the sample.
You mentioned that "Your UI will not be notified that anything has changed with that DataBubble collection, and so the BubbleSeries never updates" - But, if I comment out "polygon series" in XAML, the bubbles are displayed (even if I don't implement INotifyPropertyChanged to bubbledata collection/class). How does UI gets notified then? So, UI is not being notified when it is not commented out. Looks like polygon series collection is somehow affecting bubble series collection.
I noticed that you added the " ObservableModel" to "public class ViewModel". In my case, the public class viewmodel must be defined as :
public class Pattern_FillPluginModel : Analysis<Pattern_FillPluginModel> . In order to use INotifyChanged, I made the following changes to the observable collection and associated classes:
ObservableCollection<SampleData> _Data = new ObservableCollection<SampleData>(); public ObservableCollection<SampleData> Data // GET ALL DATA Points (completions) on the map { get { return _Data; } set { _Data = value; base.OnPropertyChanged("StringList"); } }
ObservableCollection<SampleData> _ConnectData = new ObservableCollection<SampleData>();
public ObservableCollection<SampleData> ConnectData { get { return _ConnectData; } set { _ConnectData = value; base.OnPropertyChanged("StringList"); }
} // For Pattern filling
ObservableCollection<BubbleData> _BubbleData = new ObservableCollection<BubbleData>(); public ObservableCollection<BubbleData> BubbleData { get { return _BubbleData; } set { _BubbleData = value; base.OnPropertyChanged("StringList");} }
CLASSES:
public class SampleData : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public string wellname { get; set; } public string sectorname { get; set; } public double XValue { get; set; } public double YValue { get; set; } public string Shape { get; set; } }
public class BubbleData : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public string Name { get; set; } public double Xlocation { get;set;} public double Ylocation { get; set; } public double BubbleValue { get; set; } }
But it did not work in my case! :(
With the previously attached sample project, I am unable to see the BubbleSeries show up if I remove the "Polygon Series" and click the button that instantiates and populates the BubbleData collection if the INotifyPropertyChanged interface implementation is removed from the BubbleSeries. Would it be possible for you to please provide a modified version of the sample project I sent you that shows the BubbleSeries working without the INotifyPropertyChanged interface? Perhaps you are instantiating the BubbleData collection in the constructor of your ViewModel in that case?
With your most recent code-sample, I see you are calling the OnPropertyChanged method for your BubbleData collection property, but you are passing in the string "StringList." This will look for a property named "StringList" to tell your UI that "StringList" has updated, in which case, your UI will still have no idea that BubbleData has updated. I would recommend that you make a call to OnPropertyChanged("BubbleData") in order to get the UI to be notified that your BubbleData collection has been instantiated in this case.