Author : @aarsoftx aarsoftx

Posted on Wed, Aug 24 2022

Make bar chart on console/terminal using this C++ library.

Draw bar charts using this C++ library

Article on C++

Make bar chart on console/terminal using this C++ library.

Hey Guys! 

Welcome to my blog. In such cases console application is great. You have to make some text based graphics on the terminal using different character like *, #, $, % etc.

Okay, Now imagine that you are making an application on C++ for data manage and you need to make some chart in your application which is console. Then you need to create whole thing. But using my library you can make application with bar chart. You  need make a vector of a data and then assign it in library object. Here you go... 

To download library click here

Or you can get it via running this command bellow :

> git https://github.com/abthahiahmed/console-bar-chart-library.git

You need to make program like bellow in in your C++ console program: 

#include "include/ConsoleBarChart.h"

using namespace aarsoftx;

int main(int argc, char **argv){
	vector<ConsoleChartData> result;
	
	result.push_back({"Abtahi", 5000});	
	result.push_back({"Ehsan", 8000});
	result.push_back({"Anik", 10500});
	result.push_back({"Tisha", 3500});

	ConsoleBarChart *cbc = new ConsoleBarChart("Monthly Salary", 3, 500, result);
	
	cbc->insert("Jannat" , 6000);

	cbc->show();
	

	return 0;
}

You will get out like bellow using this library : 

Console Bar Chart  Output by Abthahi Ahmed Rifat - AAR SoftX

Okay That was a sample program about library. You can use it as your program. 

Method of ConsoleBarChart class

Method Usage
ConsoleBarChart(string, int, int, vector) This is a constructor to initialize and configure all the settings.
ConsoleBarChart::insert(string, int) Using this function you can insert data into Data vector.
ConsoleBarChart::show() Using this function you can display the final Bar Chart on your Console window.

 

Conclusion

In data management application we must need chart to visualize data. But in console application it's a complex without any graphics library. So using this library you do it via some bits of lines.

Now, you have simple knowledge about this library. You can use it in  your project. You can also help me to make it better.