<chart:BubbleSeries XBindingPath="XValue"
Size="Size" Interior="#4DFF0000"
YBindingPath="YValue" ItemsSource="{Binding Data}"/> |
<chart:BubbleSeries XBindingPath="XValue"
Size="Size" SegmentColorPath="Brush"
YBindingPath="YValue" ItemsSource="{Binding Data}"/> |
public class Model
{
..
public Brush Brush { get; set; }
}
public class ViewModel
{
public ViewModel()
{
GenerateData();
}
public void GenerateData()
{
Data = new ObservableCollection<Model>();
Random rd = new Random();
Data.Add(new Model()
{
XValue = 1,
YValue = rd.Next(0, 50),
Size = rd.Next(0, 10),
Brush = new SolidColorBrush(Color.FromArgb(40, 255, 0, 0))
});
Data.Add(new Model()
{
XValue = 2,
YValue = rd.Next(0, 50),
Size = rd.Next(0, 10),
Brush = new SolidColorBrush(Color.FromArgb(140, 0, 255, 0))
});
Data.Add(new Model()
{
XValue = 3,
YValue = rd.Next(0, 50),
Size = rd.Next(0, 10),
Brush = new SolidColorBrush(Color.FromArgb(240, 255, 0, 0))
});
Data.Add(new Model()
{
XValue = 4,
YValue = rd.Next(0, 50),
Size = rd.Next(0, 10),
Brush = new SolidColorBrush(Color.FromArgb(100, 0, 0, 255))
});
}
private ObservableCollection<Model> data;
public ObservableCollection<Model> Data
{
get { return data; }
set { data = value; }
}
} |
<chart:BubbleSeries XBindingPath="XValue"
Size="Size" Palette="Custom"
YBindingPath="YValue" ItemsSource="{Binding Data}">
<chart:BubbleSeries.ColorModel>
<chart:ChartColorModel>
<chart:ChartColorModel.CustomBrushes>
<SolidColorBrush Color="#4DFF0000"/>
<SolidColorBrush Color="#FDFFF000"/>
<SolidColorBrush Color="#BF0FFFF0"/>
<SolidColorBrush Color="#8DFF00F0"/>
</chart:ChartColorModel.CustomBrushes>
</chart:ChartColorModel>
</chart:BubbleSeries.ColorModel>
</chart:BubbleSeries> |