public void CategoryNamesAreNotSorted()
        {
            Chart        chart  = new Chart();
            ColumnSeries series = new ColumnSeries();

            series.IndependentValueBinding = new Binding("Key");
            series.DependentValueBinding   = new Binding("Value");
            series.ItemsSource             = new KeyValuePair <string, int>[]
            {
                new KeyValuePair <string, int>("c", 3),
                new KeyValuePair <string, int>("a", 1),
                new KeyValuePair <string, int>("b", 2),
            };
            chart.Series.Add(series);
            CategoryAxis axis = null;

            TestAsync(
                chart,
                () => axis = chart.ActualAxes.OfType <CategoryAxis>().FirstOrDefault(),
                () =>
            {
                object[] labels = ChartTestUtilities.GetAxisLabels(axis).Select(l => l.DataContext).ToArray();
                Assert.AreEqual("c", labels[0]);
                Assert.AreEqual("a", labels[1]);
                Assert.AreEqual("b", labels[2]);
            });
        }
        public void DateTimeAxisLabelHonorsStringFormat()
        {
            Chart        chart          = new Chart();
            string       dateTimeFormat = "|{0:MM,dd}|";
            DateTimeAxis axis           = new DateTimeAxis {
                Orientation = AxisOrientation.X
            };
            Style labelStyle = new Style(typeof(DateTimeAxisLabel));

            labelStyle.Setters.Add(new Setter(DateTimeAxisLabel.StringFormatProperty, dateTimeFormat));
            axis.AxisLabelStyle = labelStyle;
            chart.Axes.Add(axis);
            ScatterSeries series = new ScatterSeries();

            series.DependentValueBinding   = new Binding("Day");
            series.IndependentValueBinding = new Binding();
            DateTime[] itemsSource = new DateTime[] { new DateTime(2009, 1, 23) };
            series.ItemsSource = itemsSource;
            chart.Series.Add(series);
            TestAsync(
                chart,
                () =>
            {
                AxisLabel label = ChartTestUtilities.GetAxisLabels(axis).First();
                Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, dateTimeFormat, label.DataContext), label.FormattedContent);
            });
        }
        public void FontSizeChangesFlowToAxisLabels()
        {
            Chart chart = new Chart();

            chart.FontSize = 22;
            ColumnSeries series = new ColumnSeries();

            series.ItemsSource = new int[] { 1, 2, 3 };
            chart.Series.Add(series);
            CategoryAxis axis = null;

            TestAsync(
                chart,
                () => axis = chart.ActualAxes.OfType <CategoryAxis>().First(),
                () =>
            {
                foreach (AxisLabel label in ChartTestUtilities.GetAxisLabels(axis))
                {
                    Assert.AreEqual(chart.FontSize, label.FontSize);
                }
            },
                () => chart.FontSize = 33,
                () =>
            {
                foreach (AxisLabel label in ChartTestUtilities.GetAxisLabels(axis))
                {
                    Assert.AreEqual(chart.FontSize, label.FontSize);
                }
            });
        }