public Animation() { InitializeComponent(); chart.View.AxisY.Min = 0; chart.View.AxisY.Max = 100; BarColumnOptions.SetRadiusX(chart, 2); BarColumnOptions.SetRadiusY(chart, 2); chart.ChartType = ChartType.Column; NewData(); }
public AggregateChart() { InitializeComponent(); _dict["red"] = CreateBrush(Colors.Red); _dict["blue"] = CreateBrush(Color.FromArgb(255, 2, 150, 252)); _dict["yellow"] = CreateBrush(Colors.Yellow); cb.ItemsSource = Utils.GetEnumValues(typeof(Aggregate)); cb.SelectedIndex = 0; cb.SelectionChanged += (s, e) => chart.Aggregate = (Aggregate)cb.SelectedIndex; int cnt = 30; chart.Data.ItemNames = CreateRandomStrings(cnt, new string[] { "blue", "red", "yellow" });; chart.View.AxisX.AnnoVisibility = AnnoVisibility.ShowAll; var vals = CreateRandomValues(cnt); var ds = new DataSeries() { ValuesSource = vals }; ds.PlotElementLoaded += (s, e) => { PlotElement pe = (PlotElement)s; if (_dict.ContainsKey(pe.DataPoint.Name)) { pe.Fill = _dict[pe.DataPoint.Name]; } pe.StrokeThickness = 0; }; chart.Data.Children.Add(ds); chart.View.AxisX.AnnoTemplate = chart.Resources["al_tmpl"]; BarColumnOptions.SetRadiusX(chart, 4); BarColumnOptions.SetRadiusY(chart, 4); }