Chart: Creating a Independent Axis

Jan 27, 2010 at 2:14 PM


I started working with the chart control and there is a problem when I try to set the iIndependentAxis in a column series.

I get an exception with the message: "Assigned independent axis cannot be used. This may be due to an unset Orientation property for the axis."

But the Orientation Property is set.

Here is the code:


                    ObservableCollection<KeyValuePair<string, double>> data = new ObservableCollection<KeyValuePair<string, double>>();
                    Random rand = new Random();
                    for (int i = 0; i < 10; i++)
                        KeyValuePair<string, double> column = new KeyValuePair<string, double>("value " + i, rand.Next(100));
                    ColumnSeries series = new ColumnSeries();
                    series.Title = "series 1";
                    series.ItemsSource = data;
                    series.IndependentValuePath = "Key";
                    series.DependentValuePath = "Value";

                    LinearAxis yAxis = new LinearAxis();
                    yAxis.Title = "values";
                    yAxis.Orientation = AxisOrientation.Y;
                    series.DependentRangeAxis = yAxis;

                    LinearAxis xAxis = new LinearAxis();
                    xAxis.Title = "categories";
                    xAxis.Orientation = AxisOrientation.X;
                    series.IndependentAxis = xAxis;


Does anyone what the problem is?


Thank you.




Jan 27, 2010 at 3:46 PM

Okay I found that it seems that the Location Property also has to be set.

Than it works :)


Dec 16, 2013 at 9:34 AM
Hi i have same problem, can you tell me how did u set Location Property?

Jan 10, 2014 at 2:20 PM
Sejn wrote:
Hi i have same problem, can you tell me how did u set Location Property?


I had the same problem. I just set the Location to Bottom for the X-Axis and Left for the Y-Axis. That was just enough. Maybe they need a set location. So Auto doesn't work...