Bunifu Line Chart
Add perfect Line and Area chart representations for your data with Bunifu Line Chart.
Bunifu Line Chart is a chart component that renders a dataset as a single line path on the canvas. It can also be set to render area charts suitable for displaying quantitative data, often for comparing two sets of data.
Here is an example of a sales dashboard using Bunifu Line Chart.

This section explains to you the steps required to start creating a simple line chart in the design view.
Step 1: Drag the canvas control to the form from the toolbox
Step 2: In the property window of the
canvas
on the labels property, add the following values in the string collection editor window as shown below:
Step 3: From the toolbox drag and drop
BunifuLineChart
to the form.Step 4: Click the ellipsis button on the Data property of
BunifuLine
, and add the following values to the collection window editor displayed as shown below:
Step 5: Go to the property named TargetCanvas select
bunifuChartCanvas1
as the target component.Step 6: Advance to
BunifuLineChart
properties and set a name on the Label property. An example would be No. of Solid State Drives repaired. Step 7: Run the application.

Advance to
BunifuLineChart
properties and set a name on the Label property. An example would be No. of Solid State Drives repaired. Alternatively, we can code and render a line chart without using the design view. Here's how to do it:
C#
VB
void renderLineChart()
{
Bunifu.Charts.WinForms.ChartTypes.BunifuLineChart bunifuLineChart = new Bunifu.Charts.WinForms.ChartTypes.BunifuLineChart();
/*
* For this example we will use random numbers
*/
var r = new Random();
/*
* Add your data from your source - accepts double list
* Below is an example from a random number
*/
List<double> data = new List<double>();
data.Add(-30);
for (int i = 0; i < 5; i++)
{
data.Add(r.NextDouble());
}
/*
* Set your data
*/
bunifuLineChart.Data = data;
/*
* Specify the target canvas
*/
bunifuLineChart.TargetCanvas = bunifuChartCanvas1;
/*
* Add labels to your canvas
* Label count should correspond to data count for charts like Bar charts
*/
bunifuChartCanvas1.Labels = new string[] { "Label1", "Label2", "Label3", "Label4", "Label5" };
/*
* Beautify the chart by sepcifying the colors
*/
bunifuLineChart.BackgroundColor = Color.Purple;
}
Private Sub renderLineChart()
Dim bunifuLineChart As Bunifu.Charts.WinForms.ChartTypes.BunifuLineChart = New Bunifu.Charts.WinForms.ChartTypes.BunifuLineChart()
'
' For this example we will use random numbers
'
Dim r = New Random()
'
' Add your data from your source - accepts double list
' Below is an example from a random number
'
Dim data As List(Of Double) = New List(Of Double)()
data.Add(-30)
For i As Integer = 0 To 5 - 1
data.Add(r.NextDouble())
Next
'
' Set your data
'
bunifuLineChart.Data = data
'
' Specify the target canvas
'
bunifuLineChart.TargetCanvas = bunifuChartCanvas1
'
' Add labels to your canvas
' Label count should correspond to data count for charts like Bar charts
'
bunifuChartCanvas1.Labels = New String() {"Label1", "Label2", "Label3", "Label4", "Label5"}
'
' Beautify the chart by sepcifying the colors
'
bunifuLineChart.BackgroundColor = Color.Purple
End Sub
Let us examine Bunifu Line charting properties.
This property gets and sets the algorithm that draws the curves of a spline line chart. The default algorithm uses a custom weighted cubic interpolation, which renders smooth curves, and the monotone algorithm preserves monotonicity (i.e. it reserves a strict order of the dataset being interpolated/plotted) suitable for presenting y=f(x) datasets.

the code below illustrates how to set the cubic interpolation at run-time.
C#
VB.NET
private void bunifuRadioButton1_CheckedChanged2(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
if (e.Checked)
{
//sets the default cubic interploation mode
bunifuLineChart1.CubicInterpolationMode = BunifuLineChart.CubicInterpolationModes.Default;
}
else
{
//sets a monotone cubic interpolation mode
bunifuLineChart1.CubicInterpolationMode = BunifuLineChart.CubicInterpolationModes.Monotone;
}
}
Private Sub bunifuRadioButton1_CheckedChanged2(ByVal sender As Object, ByVal e As Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs)
If e.Checked Then
'sets the default cubic interploation mode
bunifuLineChart1.CubicInterpolationMode = BunifuLineChart.CubicInterpolationModes.Default
Else
'sets a monotone cubic interpolation mode
bunifuLineChart1.CubicInterpolationMode = BunifuLineChart.CubicInterpolationModes.Monotone
End If
End Sub
Gets and sets a double numeric value that changes a curve tension of a spline line chart. A zero value renders straight line charts.
Note that the property doesn’t work when
- 1.a monotone algorithm is used in the cubic interpolation mode property.
- 2.rendering a stepped line chart.
This property gets and sets the z-order index of a dataset in the case of multiple datasets. A dataset having a less order number will be displayed in front of other line datasets.
For example, let's have a pair of charts targeted to the same canvas. The line chart to have an order value of 0 and another chart set to an order value 1. The chart which has an order value of 0 will be displayed on top of the other chart components that have a value of 1 and above.

An additional point to note is that a higher negative ordered line plot will render the line chart above other chart components( such as lines, area, scatter plot, bar, etc.), that have a lower negative order value.
As can see, the code below assigns different higher negative order values to render the line plots above the other line plots.
C#
VB.NET
private void setBorderWidth(BunifuLineChart bunifuLineChart, int width)
{
bunifuLineChart.BorderWidth = width;
}
private void bunifuRadioButton1_CheckedChanged2(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
if (e.Checked){
bunifuLineChart1.Order = 0;
bunifuLineChart2.Order = 1;
bunifuLineChart3.Order = 2;
setBorderWidth(bunifuLineChart1, 6);
setBorderWidth(bunifuLineChart2, 3);
setBorderWidth(bunifuLineChart3, 3);
}
}
private void bunifuRadioButton2_CheckedChanged2(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
if (e.Checked)
{
bunifuLineChart2.Order = -1;
bunifuLineChart1.Order = 0;
bunifuLineChart3.Order = 2;
setBorderWidth(bunifuLineChart2, 6);
setBorderWidth(bunifuLineChart1, 3);
setBorderWidth(bunifuLineChart3, 3);
}
}
private void bunifuRadioButton3_CheckedChanged2(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
if (e.Checked)
{
bunifuLineChart3.Order = -2;
bunifuLineChart1.Order = 0;
bunifuLineChart2.Order = 2;
setBorderWidth(bunifuLineChart3, 6);
setBorderWidth(bunifuLineChart2, 3);
setBorderWidth(bunifuLineChart1, 3);
}
}
Private Sub setBorderWidth(ByVal bunifuLineChart As BunifuLineChart, ByVal width As Integer)
bunifuLineChart.BorderWidth = width
End Sub
Private Sub bunifuRadioButton1_CheckedChanged2(ByVal sender As Object, ByVal e As Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs)
If e.Checked Then
bunifuLineChart1.Order = 0
bunifuLineChart2.Order = 1
bunifuLineChart3.Order = 2
setBorderWidth(bunifuLineChart1, 6)
setBorderWidth(bunifuLineChart2, 3)
setBorderWidth(bunifuLineChart3, 3)
End If
End Sub
Private Sub bunifuRadioButton2_CheckedChanged2(ByVal sender As Object, ByVal e As Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs)
If e.Checked Then
bunifuLineChart2.Order = -1
bunifuLineChart1.Order = 0
bunifuLineChart3.Order = 2
setBorderWidth(bunifuLineChart2, 6)
setBorderWidth(bunifuLineChart1, 3)
setBorderWidth(bunifuLineChart3, 3)
End If
End Sub
Private Sub bunifuRadioButton3_CheckedChanged2(ByVal sender As Object, ByVal e As Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs)
If e.Checked Then
bunifuLineChart3.Order = -2
bunifuLineChart1.Order = 0
bunifuLineChart2.Order = 2
setBorderWidth(bunifuLineChart3, 6)
setBorderWidth(bunifuLineChart2, 3)
setBorderWidth(bunifuLineChart1, 3)
End If
End Sub
This property gets and sets a boolean value (true or false) to hide or show the line on the canvas. A false value will hide the line plot but display the data points.
This property gets and sets the type of line to render on the canvas. Values of a stepped line include;
False: does not render a step plot. It is the common default value, for rendering a spline chart

Before: renders a plot value before the next step of a data category. The same graphical plot is also applied with the true value. Below is its illustration

Middle: renders a plot value in the middle step of a data category

After: which renders a plot value after the next step of data category.

This property gets or sets the end cap style of a line plot. The property can be set to one of the following the values can be configured as follows:
Butt - renders a squared border style for the line plot's beginning and end. This is the line plot's default value.
Square - functions similarly as a Butt prop value where it renders a squared border cap at the end and at the start of the line plot.
Round - renders a rounded cap at the start and at the end of the line plot.

The following code demonstrates how to change the border cap at run-time.
C#
VB.NET
using Bunifu.Charts.WinForms.ChartTypes;
private void bunifuRadioButton1_CheckedChanged(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
if (e.Checked)
{
bunifuLineChart1.BorderCapStyle = BunifuLineChart.LineCaps.Butt;
bunifuChartCanvas1.Update();
}
}
private void bunifuRadioButton2_CheckedChanged(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
if (e.Checked)
{
bunifuLineChart1.BorderCapStyle = BunifuLineChart.LineCaps.Round;
bunifuChartCanvas1.Update();
}
}
Imports Bunifu.Charts.WinForms.ChartTypes
Private Sub bunifuRadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs)
If e.Checked Then
bunifuLineChart1.BorderCapStyle = BunifuLineChart.LineCaps.Butt
bunifuChartCanvas1.Update()
End If
End Sub
Private Sub bunifuRadioButton2_CheckedChanged(ByVal sender As Object, ByVal e As Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs)
If e.Checked Then
bunifuLineChart1.BorderCapStyle = BunifuLineChart.LineCaps.Round
bunifuChartCanvas1.Update()
End If
End Sub