@@ -19,7 +19,7 @@ namespace OxyPlot.Series
1919 public class HistogramSeries : XYAxisSeries
2020 {
2121 /// <summary>
22- /// The default tracker format string
22+ /// The default tracker format string.
2323 /// </summary>
2424 public new const string DefaultTrackerFormatString = "Start: {5}\n End: {6}\n Value: {7}\n Area: {8}\n Count: {9}" ;
2525
@@ -41,7 +41,7 @@ public class HistogramSeries : XYAxisSeries
4141 /// <summary>
4242 /// The default color mapping.
4343 /// </summary>
44- private OxyColor defaultColorMapping ( HistogramItem item ) => ActualFillColor ;
44+ private OxyColor defaultColorMapping ( HistogramItem item ) => this . ActualFillColor ;
4545
4646 /// <summary>
4747 /// Initializes a new instance of the <see cref="HistogramSeries" /> class.
@@ -55,7 +55,7 @@ public HistogramSeries()
5555 this . LabelFormatString = null ;
5656 this . LabelFontSize = 0 ;
5757 this . LabelPlacement = LabelPlacement . Outside ;
58- this . ColorMapping = defaultColorMapping ;
58+ this . ColorMapping = this . defaultColorMapping ;
5959 }
6060
6161 /// <summary>
@@ -138,7 +138,7 @@ public OxyColor ActualFillColor
138138 /// Gets or sets the delegate used to map from <see cref="ItemsSeries.ItemsSource" /> to <see cref="HistogramSeries" />. The default is <c>null</c>.
139139 /// </summary>
140140 /// <value>The mapping.</value>
141- /// <remarks>Example: series1.Mapping = item => new HistogramItem((double)item.BinStart, (double)item.BinStart + item.BinWidth, (double)item.Count / totalCount, item.Count); </remarks>
141+ /// <remarks>Example: series1.Mapping = item => new HistogramItem((double)item.BinStart, (double)item.BinStart + item.BinWidth, (double)item.Count / totalCount, item.Count). </remarks>
142142 public Func < object , HistogramItem > Mapping { get ; set ; }
143143
144144 /// <summary>
@@ -213,7 +213,7 @@ public override TrackerHitResult GetNearestPoint(ScreenPoint point, bool interpo
213213 item . RangeEnd ,
214214 item . Value ,
215215 item . Area ,
216- item . Count )
216+ item . Count ) ,
217217 } ;
218218 }
219219 }
@@ -222,7 +222,7 @@ public override TrackerHitResult GetNearestPoint(ScreenPoint point, bool interpo
222222 // if no HistogramItems contain the point, return null
223223 return null ;
224224 }
225-
225+
226226 /// <summary>
227227 /// Renders the legend symbol on the specified rendering context.
228228 /// </summary>
@@ -354,7 +354,7 @@ protected void RenderBins(IRenderContext rc, OxyRect clippingRect, ICollection<H
354354 {
355355 foreach ( var item in items )
356356 {
357- var actualFillColor = ColorMapping ( item ) ;
357+ var actualFillColor = this . GetItemFillColor ( item ) ;
358358
359359 // transform the data points to screen points
360360 var p1 = this . Transform ( item . RangeStart , 0 ) ;
@@ -371,6 +371,23 @@ protected void RenderBins(IRenderContext rc, OxyRect clippingRect, ICollection<H
371371 }
372372 }
373373
374+ /// <summary>
375+ /// Gets the fill color of the given <see cref="HistogramItem"/>.
376+ /// </summary>
377+ /// <param name="item">The item.</param>
378+ /// <returns>The fill color of the item.</returns>
379+ protected OxyColor GetItemFillColor ( HistogramItem item )
380+ {
381+ if ( ! item . Color . IsAutomatic ( ) )
382+ {
383+ return item . Color ;
384+ }
385+ else
386+ {
387+ return this . ColorMapping ( item ) ;
388+ }
389+ }
390+
374391 /// <summary>
375392 /// Gets the clipping rectangle, transposed if the X axis is vertically orientated.
376393 /// </summary>
@@ -396,7 +413,6 @@ protected void RenderBins(IRenderContext rc, OxyRect clippingRect, ICollection<H
396413 /// <param name="rc">The render context.</param>
397414 /// <param name="clippingRect">The clipping rectangle.</param>
398415 /// <param name="rect">The column rectangle.</param>
399- /// <param name="value">The value.</param>
400416 /// <param name="item">The item.</param>
401417 protected void RenderLabel ( IRenderContext rc , OxyRect clippingRect , OxyRect rect , HistogramItem item )
402418 {
0 commit comments