Space Corner Datapoints of ColumnSeries not correct?

Dec 2, 2010 at 3:14 PM


I've a DateTime x-axis with more than one ColumnSeries. The more series I add to the chart, the lesser the most left and right corner datapoints are visible. Labels on the X-axis are ok.

If I create just one ColumnSeries (without any styling) the space reserved for the first and last datapoint is lesser than the other datapoints. With two ColumnSeries the two outher datapoints are half visible, with three columnseries the outher datapoints are not visible at all (independent on the number of datapoints).

Do you have a suggestion how to solve this?



Dec 3, 2010 at 11:03 AM

It has to do with not-using a category axis for the x-axis.

With a clean chart just use these code:

            DataPointSingleSeriesWithAxes series2 = new ColumnSeries();
            Random rnd = new Random();
            Dictionary<int, int> items = new Dictionary<int, int>();
            for (int ii = 0; ii < 15; ii++)
                items.Add(ii, Convert.ToInt32((rnd.NextDouble() * 200) + ii * 3));
            series2.ItemsSource = items;
            series2.IndependentValueBinding = new Binding("Key");
            series2.DependentValueBinding = new Binding("Value");


            //LinearAxis xAxis = new LinearAxis();
            CategoryAxis xAxis = new CategoryAxis();
            xAxis.Orientation = AxisOrientation.X;
            xAxis.Location = AxisLocation.Bottom;


With the linear axis there is no space at the left and right. Example:

With category axis:

Any suggestions to do make use of a linear axis (and DateTime)?