A WPF control library for responsive column, line, and pie charts.
Kareem has a video demoing and explaining functionality or you can download and check out the charts in the Example project.
- Import the namespace
xmlns:wpfChartControls="clr-namespace:WPFChartControls;assembly=WPFChartControls"- Add chart
<wpfChartControls:_2DColumnChart />- Bind data to Items property
- using code-behind
<wpfChartControls:_2DColumnChart x:Name="ColumnChart" />
ColumnChart.Items = TestColumnItems.Case4;
- using attribute binding
<wpfChartControls:_2DColumnChart Items="{Binding Items}" />
Items- collection ofColumnItemitems to be displayed in the chartColumnBrush- brush used for theColumnItemitemsStroke- brush used to draw the axis and linesStrokeThickness- thickness of the axis and linesIntervalCount- number of intervals to be displayed on the Y-axisInnerPadding- inner padding of the chart area
ColumnItem- an item in the column chart with aHeaderandValueTestColumnItems- provides test case collections ofColumnIteminstances
- Import the namespace
xmlns:wpfChartControls="clr-namespace:WPFChartControls;assembly=WPFChartControls"- Add chart
<wpfChartControls:_2DPieChart />- Bind data to Items property
- using code-behind
<wpfChartControls:_2DPieChart x:Name="PieChart" />
PieChart.Categories = TestPieCategories.Case6;
- using attribute binding
<wpfChartControls:_2DPieChart Categories="{Binding Categories}" />
Categories- collection ofPieCategoryitems to be displayed in the chartStrokeBrush- brush used to draw the strokes of the pie slicesStrokeThickness- thickness of the strokes of the pie slicesLegendPosition- position of the legend relative to the chart
PieCategory- a category in a pie chart with aPercentage,Title, andColorBrushLegendPosition- position of the legend (values:Top,Left,Right,Bottom)TestPieCategories- provides test case collections ofPieCategoryinstances
- Import the namespace
xmlns:wpfChartControls="clr-namespace:WPFChartControls;assembly=WPFChartControls"- Add chart
<wpfChartControls:LineChart />- Bind data to Items property
- using code-behind
<wpfChartControls:LineChart x:Name="LineChart" />
LineChart.Values = TestLineValues.Case3;
- using attribute binding
<wpfChartControls:LineChart Values="{Binding Values}" />
Values- collection ofLineValueitems to be displayed in the chartAxisStrokeBrush- brush used to draw the axis strokesAxisStrokeThickness- thickness of the axis strokesGridLineStrokeBrush- brush used to draw the grid linesGridLineStrokeThickness- thickness of the grid linesGridLineOpacity- opacity of the grid linesInnerPadding- inner padding of the chart areaValueLineStrokeBrush- brush used to draw the value lineValueLineStrokeThickness- thickness of the value lineXIntervalCount- number of intervals to be displayed on the X-axisYIntervalCount- number of intervals to be displayed on the Y-axis
LineValue- a value in a line chart withXandYcoordinatesTestLineValues- provides test case collections ofLineValueinstances
Thank you to Kareem Sulthan, who shared the code that became the foundation of WPF Chart Controls.
From there I did lots of refactoring, made each chart adjust sizing when the window height/width is changed, and added documentation comments to increase reusability.
Copyright (c) 2024 Kareem Sulthan, Justin M Heartley