Class HistogramSeries
Histogram consists tabular frequencies, which are shown as adjacent rectangles and erected over discrete intervals.
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.WPF.dll
Syntax
public class HistogramSeries : AdornmentSeries, ICloneable, ISupportAxes2D, ISupportAxes
Remarks
The rectangle area is equal to the frequency of the observations in HistogramInterval The height of a rectangle is also equal to the frequency density of the interval.A histogram may also be normalized displaying relative frequencies. You can also draw a normal distribution curve for the given data points, by enabling the ShowNormalDistributionCurve
Examples
<syncfusion:HistogramSeries HistogramInterval="10" ItemsSource="{Binding Data}" XBindingPath="Year" YBindingPath="Value">
</syncfusion:HistogramSeries>
HistogramSeries series1 = new HistogramSeries();
series1.ItemsSource = viewmodel.Data;
series1.HistogramInterval = "10";
series1.XBindingPath = "Year";
series1.YBindingPath = "Value";
chart.Series.Add(series1);
Constructors
HistogramSeries()
Called when instance created for HistogramSeries
Declaration
public HistogramSeries()
Fields
CurveLineStyleProperty
The DependencyProperty for CurveLineStyle property.
Declaration
public static readonly DependencyProperty CurveLineStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
HistogramIntervalProperty
The DependencyProperty for HistogramInterval property.
Declaration
public static readonly DependencyProperty HistogramIntervalProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ShowNormalDistributionCurveProperty
The DependencyProperty for ShowNormalDistributionCurve property.
Declaration
public static readonly DependencyProperty ShowNormalDistributionCurveProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
XAxisProperty
The DependencyProperty for XAxis property.
Declaration
public static readonly DependencyProperty XAxisProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
YAxisProperty
The DependencyProperty for YAxis property.
Declaration
public static readonly DependencyProperty YAxisProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
YBindingPathProperty
The DependencyProperty for YBindingPath property.
Declaration
public static readonly DependencyProperty YBindingPathProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
CurveLineStyle
Gets or set the line style of HistogramSeries normal distribution curve.
Declaration
public Style CurveLineStyle { get; set; }
Property Value
Type |
---|
System.Windows.Style |
Examples
<syncfusion:SfChart.Resources>
<Style TargetType = "Polyline" x:Key="curveLineStyle">
< Setter Property = "Stroke" Value="YellowGreen"/>
< Setter Property = "StrokeThickness" Value="3"/>
< Setter Property = "StrokeDashArray" Value="1,2" />
</Style>
</syncfusion:SfChart.Resources>
<syncfusion:HistogramSeries HistogramInterval="10" ItemsSource="{Binding Data}" CurveLineStyle = {StaticResource curveLineStyle}
XBindingPath="Year" YBindingPath="Value">
</syncfusion:HistogramSeries>
SfChart chart = new SfChart();
Style style = new Style(typeof(Polyline));
style.Setters.Add(new Setter(Polyline.StrokeProperty, Brushes.Green));
style.Setters.Add(new Setter(Polyline.StrokeThicknessProperty, 5.0));
DoubleCollection doubleCollection = new DoubleCollection();
doubleCollection.Add(2);
doubleCollection.Add(3);
style.Setters.Add(new Setter(Polyline.StrokeDashArrayProperty, doubleCollection));
HistogramSeries series1 = new HistogramSeries();
series1.ItemsSource = viewmodel.Data;
series1.HistogramInterval = "10";
series1.XBindingPath = "Year";
series1.YBindingPath = "Value";
series1.CurveLineStyle = style;
chart.Series.Add(series1);
See Also
HistogramInterval
Gets or sets a value that specifies the interval to combine in histogram axis. This is a bindable property.
Declaration
public double HistogramInterval { get; set; }
Property Value
Type |
---|
System.Double |
ShowNormalDistributionCurve
Gets or sets a value indicating whether to enable the distribution curve in the histogram series.
Declaration
public bool ShowNormalDistributionCurve { get; set; }
Property Value
Type |
---|
System.Boolean |
XAxis
Gets or sets the x axis for the Histogram series.
Declaration
public ChartAxisBase2D XAxis { get; set; }
Property Value
Type |
---|
ChartAxisBase2D |
XRange
Gets or sets the x axis range.
Declaration
public DoubleRange XRange { get; }
Property Value
Type |
---|
DoubleRange |
YAxis
Gets or sets the y axis for the Histogram series.
Declaration
public RangeAxisBase YAxis { get; set; }
Property Value
Type |
---|
RangeAxisBase |
YBindingPath
Gets or sets the property path bind with y axis.
Declaration
public string YBindingPath { get; set; }
Property Value
Type |
---|
System.String |
YRange
Gets or sets the y axis range.
Declaration
public DoubleRange YRange { get; }
Property Value
Type |
---|
DoubleRange |
Methods
CloneSeries(DependencyObject)
Returns the instance of HistogramSeries series.
Declaration
protected override DependencyObject CloneSeries(DependencyObject obj)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | obj | object |
Returns
Type |
---|
System.Windows.DependencyObject |
Overrides
CreateSegment()
Creates an instance of series segment.
Declaration
protected override ChartSegment CreateSegment()
Returns
Type | Description |
---|---|
ChartSegment | Returns the instance of corresponding series segment. |
Overrides
Remarks
This customization is not supported for fast type series and technical indicators.
Examples
This sample shows how to call the CreateSegment() method to customize the line series segments.
public class LineSeriesExt : LineSeries
{
protected override ChartSegment CreateSegment()
{
return new LineSegmentExt();
}
}
public class LineSegmentExt : LineSegment
{
public override UIElement CreateVisual(Size size)
{
// Write your customization code here.
}
public override void Update(IChartTransformer transformer)
{
// Write your customization code here.
}
}
CreateSegments()
Creates the segments of HistogramSeries.
Declaration
public override void CreateSegments()
Overrides
GeneratePoints()
Method used to generate points for histogram series.
Declaration
protected override void GeneratePoints()
Overrides
OnBindingPathChanged(DependencyPropertyChangedEventArgs)
Called when binding path changed.
Declaration
protected override void OnBindingPathChanged(DependencyPropertyChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | args | Event args |
Overrides
See Also
OnDataSourceChanged(IEnumerable, IEnumerable)
Called when ItemsSource property changed.
Declaration
protected override void OnDataSourceChanged(IEnumerable oldValue, IEnumerable newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | oldValue | old value |
System.Collections.IEnumerable | newValue | new value |
Overrides
OnMouseMove(MouseEventArgs)
Called when pointer or mouse move on chart area.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e | Event args |
Overrides
OnXAxisChanged(ChartAxis, ChartAxis)
Called when XAxis value changed.
Declaration
protected virtual void OnXAxisChanged(ChartAxis oldAxis, ChartAxis newAxis)
Parameters
Type | Name | Description |
---|---|---|
ChartAxis | oldAxis | old axis |
ChartAxis | newAxis | new axis |
OnYAxisChanged(ChartAxis, ChartAxis)
Called when YAxis property changed.
Declaration
protected virtual void OnYAxisChanged(ChartAxis oldAxis, ChartAxis newAxis)
Parameters
Type | Name | Description |
---|---|---|
ChartAxis | oldAxis | old axis |
ChartAxis | newAxis | new axis |
UpdateSegments(Int32, NotifyCollectionChangedAction)
Updates the segment at the specified index.
Declaration
public override void UpdateSegments(int index, NotifyCollectionChangedAction action)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the segment. |
System.Collections.Specialized.NotifyCollectionChangedAction | action | The action that caused the segments collection changed event |
Overrides
Explicit Interface Implementations
ISupportAxes.ActualXAxis
Declaration
ChartAxis ISupportAxes.ActualXAxis { get; }
Returns
Type |
---|
ChartAxis |
ISupportAxes.ActualYAxis
Declaration
ChartAxis ISupportAxes.ActualYAxis { get; }
Returns
Type |
---|
ChartAxis |