Fixed a Bug with your ColumnBarBaseSeries.cs when using Catagories

Jul 27, 2010 at 9:19 AM

There was an issue with the column and bar series when using the Category Range it threw a null object reference exception

this is the fix


please replace the method protected Range<UnitValue> GetCategoryRange(object category) with the followoing code


        /// <summary>        

/// Gets a range in which to render a data point.        

/// </summary>        

/// <param name="category">The category to retrieve the range for.        

/// </param>        

/// <returns>The range in which to render a data point.</returns>        

protected Range<UnitValue> GetCategoryRange(object category) {

if (ActualIndependentAxis == null)              

 return new Range<UnitValue>();            

ICategoryAxis categoryAxis = ActualIndependentAxis as CategoryAxis;          

if (categoryAxis != null) {              

return categoryAxis.GetPlotAreaCoordinateRange(category);            

} else {                

UnitValue unitValue = ActualIndependentAxis.GetPlotAreaCoordinate(category);                

if (ValueHelper.CanGraph(unitValue.Value) && _dataPointlength.HasValue) {                    

double halfLength = _dataPointlength.Value / 2.0;

                     return new Range<UnitValue>(                        

new UnitValue(unitValue.Value - halfLength, unitValue.Unit),                        

new UnitValue(unitValue.Value + halfLength, unitValue.Unit));                


return new Range<UnitValue>();