Starting a business often carries risk. There's a popular saying that "You have to spend money to make money." And while that's not necessarily true, one compelling way to decrease your risk is to do a break-even evaluation.

Break-even analyses calculate the minimum number of units to sell, and the sales volume needed before making a profit.

It results in neither a gain nor a loss and determines the number of sales required to cover all variable and fixed costs. Business owners can use a break-even analysis tool to determine when their business will break even and become profitable.

break even

In this blog, we develop a break-even calculator with a WinForms application, which shows the detailed calculation for every fixed interval of units using FlexChart and FlexGrid control.

Try ComponentOne Studio

Download the latest version of ComponentOne Studio Enterprise

Download Now!

With the 2021 v2 release of ComponentOne for WinForms, FlexChart introduced a special chart type, BreakEven chart, which shows the relationship between cost and income in order to show profit and loss for different quantities of break-even.

It is also called a Cost Volume Profit Chart. For displaying the pictorial output, we will use this newly-added chart type to show the break-even point in our application.

For showing the detailed tabular data at each internal, we will use the custom functions to calculate the sales and total cost, and then use the Expression property of the Column class of C1FlexGrid to calculate the profit or loss at that point of purchase.

To understand this in a better way, let's break the process in the below-given steps:

Creating Input Form

The primary step is to make an input form that takes the required input like fixed cost, sales price per unit, variable cost per unit, and several unit iterations to see the data.

We are using ComponentOne WinForms Input controls like C1TextBox, C1NumberEdit, C1Label, and C1Button. We are also using C1ThemeController to apply the "Material Dark" theme of C1 to the application.

Let's take an example of a footwear company that recently launched a new edition of shoes called "Revolution 2.0" (for example) and calculate the minimum number of quantities they need to sell to cover their total invested cost, around $1,00,000.

They set the selling price of "Revolution 2.0" to $450 and the variable cost per shoe is about $50. After filling in these values, the form looks like below:

input form

After filling all the required inputs, we put these values in the break-even point formula to get the minimum number of units with no net profit or loss after the sale.

Break even Point = Fixed costs / (Sales price per unit – Variable cost per unit)
Break even Point = 100000/(450-50) = 250 units

break even

Representing Break-Even Analysis via FlexChart

Charts are the most effective way of displaying data. They present big data in a concise, easy-to-understand format and can easily express views without browsing large data sets. FlexChart for WinForms provides users with a powerful and easy-to-use API for configuring over 80 chart types.

To represent the break-even point, let's add the BreakEven chart to FlexChart. For this, we need to take a new BreakEven object and set the values of its main properties (SalesPrice, FixedCost, and VariableCost) and add it to the FlexChart.Series collection to show the projection of profits over time.

We'll also be able to visualize how long it will take to reach the break-even point where incomes outperform costs. After setting the property values, the code looks this:

//Clear Existing Series
flexChart1.Series.Clear();
flexChart1.Series.Add(new BreakEven() { SalesPrice =400, FixedCost = 100000, VariableCost = 50 });
flexChart1.Legend.Position = Position.Right;
flexChart1.AxisX.Title = "Number Of Units";
flexChart1.AxisY.Title = "Fixed Cost";

To set the unit intervals to show the data on the X-axis, we need to set the MajorUnit and MinorUnit property of the AxisX class FlexChart.

flexChart1.AxisX.MinorUnit = 40;
flexChart1.AxisX.MajorUnit = 40;

After adding all the above code, the chart output looks like below:

chart

Representing Break-Even Analysis via FlexGrid

C1FlexGrid control is a powerful, full-featured grid. It provides all the basics, plus advanced features like cell merging, multicolumn sorting, and automatic data aggregation. It can be used in bound mode – displaying data from any .NET data source, or unbound mode, where the grid manages the data.

In this sample, to show the detailed computation in tabular form, we will create a BreakEvenPoint class and assign the list of the object of this class as the DataSource of the grid.

To calculate the sales and total cost at different units, we have created custom methods GetTotalCost and GetSalesRevenue that take the object of BreakEven class of FlexChart and the number of units as a parameter. The complete code from creating and calculating the list of data and assigning it to the grid looks like:

public class BreakEvenPoint
    {
        int unitSold, sales, totalCost;
        public BreakEvenPoint(int unitSold, int sales, int totalCost)
        {
            this.unitSold = unitSold;
            this.sales = sales;
            this.totalCost = totalCost;
        }
        public int UnitSold
        {
            get
            { return unitSold; }
            set
            { unitSold = value; }
        }
        public int Sales
        {
           get
            { return sales; }
            set
            { sales = value; }
        }
        public int TotalCost
        {
            get
            { return totalCost; }
            set
            { totalCost = value; }
        }
    }
List<BreakEvenPoint> breakEvenList = new List<BreakEvenPoint>();
BreakEven breakEvenChart = flexChart1.Series[1] as BreakEven;
int units = 0, sales = 0, totalCost = (int)fixedCost, iteration = 0;
//Calculate data for particular interval of units and add it into the list
breakEvenList.Add(new BreakEvenPoint(units, sales, totalCost));
while ((sales - totalCost) <= 0)
     {
       units = units + unit;
       sales = (int)GetSalesRevenue(breakEvenChart, units);
       totalCost = (int)GetTotalCost(breakEvenChart, units);
       iteration = iteration + 1;
       breakEvenList.Add(new BreakEvenPoint(units, sales, totalCost));
     }
while (iteration > 0)
    {
       units = units + unit;
       sales = (int)GetSalesRevenue(breakEvenChart, units);
       totalCost = (int)GetTotalCost(breakEvenChart, units);
       iteration = iteration - 1;
       breakEvenList.Add(new BreakEvenPoint(units, sales, totalCost));
    }
//Assign the list of data as the datasource of the grid
c1FlexGrid1.DataSource = breakEvenList;

To show the profit and loss at different units, add an extra column "Profit/Loss" in the grid and calculate its value using the Column's Expression property.

Make sure to add the reference to the C1.Win.ExpressionEditor.XX.dll assembly to access this property. Apply styling in this column using the CellStyle class of FlexGrid to show the loss with red and profit with green. See the complete code from adding this column to applying the styles below:

//Add a new Column to the Grid to show the Profit/Loss after selling particular units
Column columnProfitLoss = c1FlexGrid1.Cols.Add();
columnProfitLoss.Name = columnProfitLoss.Caption = "Profit/Loss";
columnProfitLoss.AllowExpressionEditing = true;
//Add Expression to calculate the values based on existing columns' data
columnProfitLoss.Expression = "[Sales] - [TotalCost]";
//Add CellStyle to show the loss
CellStyle cs = c1FlexGrid1.Styles.Add("Loss");
cs.ForeColor = Color.FromArgb(255, 51, 51);
//Add CellStyle to show the Profit
CellStyle cs1 = c1FlexGrid1.Styles.Add("Profit");
cs1.ForeColor = Color.FromArgb(102, 204, 0);
//Assing the CellStyle to particular cell based on its value
for (int i = 1; i < c1FlexGrid1.Rows.Count; i++)
   {
     if (Convert.ToInt32(c1FlexGrid1[i, 4]) > 0)
         {
           c1FlexGrid1.SetCellStyle(i, 4, cs1);
         }
    else
         {
            c1FlexGrid1.SetCellStyle(i, 4, cs);
         }
    }

After adding all the above code, the final output of C1FlexGrid looks like:

componentone

By doing so, we can use the FlexChart and FlexGrid controls to map the break-even point on the chart and show the complete sales and revenue data at different units. Plan and prioritize our task to increase sales accordingly. The final output form that consists of both the chart and grid looks is shown below:

analysis output

Find the complete sample here. Feel free to try it out and leave feedback or questions in the comments below. Happy coding!

Try ComponentOne Studio

Download the latest version of ComponentOne Studio Enterprise

Download Now!