var userUri = new Uri(@"Cartesian/FunnelChart/Resources/user.png", UriKind.Relative); //根据路径获取图片
var fingerUri = new Uri("Cartesian/FunnelChart/Resources/fingerprint.png", UriKind.Relative);
var viewUri = new Uri("Cartesian/FunnelChart/Resources/view.png", UriKind.Relative);
var ve1 = new VisualElement //获取一个Visualement的参数并赋值
{
X = 0.75,
Y = 120, //给他坐标
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Center,
UIElement = new StackPanel
{
Children =
{
new Image {Source = new BitmapImage(userUri)},
new TextBlock { Text = "LOADED THE AD", FontSize = 16, Foreground = Brushes.White}
}
}
};
var ve2 = new VisualElement
{
X = 0.75,
Y = 0,
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
UIElement = new TextBlock { Text = "100 %", FontSize = 40, Foreground = Brushes.White}
};
var ve3 = new VisualElement
{
X = 2.5,
Y = 120,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Center,
UIElement = new StackPanel
{
Children =
{
new Image {Source = new BitmapImage(viewUri)},
new TextBlock { Text = "SAW THE AD", FontSize = 16, Foreground = Brushes.White}
}
}
};
var ve4 = new VisualElement
{
X = 2.5,
Y = 0,
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
UIElement = new TextBlock { Text = "50 %", FontSize = 40, Foreground = Brushes.White }
};
var ve5 = new VisualElement
{
X = 4.25,
Y = 120,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Center,
UIElement = new StackPanel
{
Children =
{
new Image {Source = new BitmapImage(fingerUri)},
new TextBlock { Text = "INTERACTED", FontSize = 16, Foreground = Brushes.White}
}
}
};
var ve6 = new VisualElement
{
X = 4.25,
Y = 0,
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
UIElement = new TextBlock { Text = "100 %", FontSize = 40, Foreground = Brushes.White }
};
cartesianChart1.VisualElements.AddRange(new[]
{
ve1, ve2, ve3, ve4, ve5, ve6
});