Hi
I need to display a bunch of symbols on a GIS map . The size of each symbol denotes some value (for example the population of a city). I am using the BubbleChartDataAdapter and it seems to do exactly that.
My problem is that the values are changing over time, but I cannot find a way to update the adapter in order to reflect the change in the symbol's size
Is it possible in general to update the bubbles at runtime or do I have to do something custom?
Here is a very crude example where I try to change the bubble's size when I click on a symbol (working project also attached)
C#using DevExpress.XtraMap;
namespace bubble
{
public partial class Form1 : DevExpress.XtraEditors.XtraForm
{
private MyClass[] MyData;
public Form1()
{
InitializeComponent();
bubbles.Data = CreateData(); // bubbles is a VectorItemsLayer
mapControl1.MapItemClick += MapControl1OnMapItemClick;
}
private void MapControl1OnMapItemClick(object sender, MapItemClickEventArgs e)
{
// trying to edit the source object, not working
var obj = bubbles.GetItemSourceObject(e.Item) as MyClass;
if (obj != null)
{
obj.Size += 5;
}
// changin the bubble's size directly doesnt work either
var mb = e.Item as MapBubble;
mb.Size += 5;
}
private IMapDataAdapter CreateData()
{
MyData = new MyClass[4];
MyData[0] = new MyClass { Lat = 36.475, Lon = 70.14, Size = 5 };
MyData[1] = new MyClass { Lat = 36.475, Lon = -73.059, Size = 10 };
MyData[2] = new MyClass { Lat = -15.877, Lon = -73.059, Size = 15 };
MyData[3] = new MyClass { Lat = -15.877, Lon = 70.14, Size = 20 };
var adapter = new BubbleChartDataAdapter
{
DataSource = MyData,
ItemMaxSize = 50,
ItemMinSize = 10,
ValueMember = "Size",
LatitudeMember = "Lat",
LongitudeMember = "Lon"
};
return adapter;
}
}
class MyClass
{
public double Lat { get; set; }
public double Lon { get; set; }
public double Size { get; set; }
}
}