SFML graph plotting library
Graph plotting library based on SFML multimedia library. SFPlot supports
- Cartesian Chart (2D X-Y Chart)
- Pie Chart
- Radar Chart
- Bar Chart
- Circle Bar Chart
Execute commands below in the top directory of SFPlot.
cmake .
make
If you want to enable sample program add -DENABLE_SAMPLE=ON argument to cmake command.
cmake -DENABLE_SAMPLE=ON .
make
First of all you have to set up default configurations for SFPlot.
sf::plot_config.font = font;
sf::plot_config.font_color = sf::Color::White;
sf::plot_config.axes_color = sf::Color::White;
sf::plot_config.scale_color = sf::Color(100.f, 100.f, 100.f);Then declare chart
sf::CartesianChart chart; // Cartesian X-Y ChartNeedless to say, you have to add data set to each chart before drawing to show data.
auto data1 = chart.addData();
data1->data = {{0.f, 100.f}, {45.f, 200.f}, {45.f, 50.f}, {120.f, 200.f}, {90.f, 120.f}};Each Chart class is derived from sf::Drawable.
Therefore, you can draw charts on screen in conventional way in SFML.
window.draw(chart);
window.display();A working example is located in sample/main.cpp. Please check it for the comprehensive example.
- SFML library
- C++ compiler which supports C++17
- CMake
MIT License. Please refer LICENSE file for the detail.
I welcome your advice/contribution/comment. Please feel free to send me message.
Happy Hacking.
