{"id":18938514,"url":"https://github.com/jerr-it/sfgraphing","last_synced_at":"2025-04-15T19:30:27.640Z","repository":{"id":48834386,"uuid":"250654128","full_name":"jerr-it/SFGraphing","owner":"jerr-it","description":"C++ Plot Library for SFML","archived":false,"fork":false,"pushed_at":"2022-10-31T19:13:56.000Z","size":652,"stargazers_count":22,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T01:12:39.393Z","etag":null,"topics":["cpp","graph","hacktoberfest","plot","plots","plotting","sfml"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jerr-it.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-27T21:42:24.000Z","updated_at":"2025-03-26T11:06:29.000Z","dependencies_parsed_at":"2023-01-20T13:17:09.241Z","dependency_job_id":null,"html_url":"https://github.com/jerr-it/SFGraphing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2FSFGraphing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2FSFGraphing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2FSFGraphing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2FSFGraphing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerr-it","download_url":"https://codeload.github.com/jerr-it/SFGraphing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249138517,"owners_count":21218900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","graph","hacktoberfest","plot","plots","plotting","sfml"],"created_at":"2024-11-08T12:14:36.756Z","updated_at":"2025-04-15T19:30:27.107Z","avatar_url":"https://github.com/jerr-it.png","language":"C++","readme":"\u003ch1 align=\"center\"\u003eSFGraphing\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/Language-C++-blue?style=for-the-badge\u0026logo=c%2B%2Bl\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/SFML-Required-red?style=for-the-badge\u0026logo=sfml\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nA C++ Plot Library to be used in combination with SFML\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"img/screenshot.png\" width=400/\u003e\n    \u003cimg src=\"img/screenshot2.png\" width=400/\u003e\n    \u003cimg src=\"img/screenshot3.png\" width=805/\u003e\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003eNewest Version\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003e\nEntirely rewritten for better readability.  \u003cbr\u003e\nAdded \u003cb\u003ePiecharts\u003c/b\u003e! \u003cbr\u003e\nYou can now set Position and Dimension of Plots\n\u003c/p\u003e\n\n\u003ch2 align=\"center\"\u003eHow to use\u003c/h2\u003e\n\nDocumentation at: https://jerr-it.github.io/SFGraphing/\u003cbr\u003e\n\nThe file main.cpp provides more details on how to use this library\n\nBy default a sample program will be created.\n\nHow to compile this example \u003cbr\u003e\n```\ncmake .\nmake graphing\n./graphing\n```\n\u003cb\u003eDepending on your OS and installation, you might need to adjust the SFML path in SFPlot/CMakeLists.txt to fit your installation of SFML.\u003c/b\u003e\u003cbr\u003e\nInclude header in your main file\n```c++\n#include \"SFGraphing/SFPlot.h\"\n#include \"SFGraphing/SFPieChart.h\"\n```\n\nImportant: You need a font, otherwise text wont display!\n```c++\nsf::Font font;\nfont.loadFromFile(\"YourFontHere.ttf\");\n```\n\n\u003ch2 align=\"center\"\u003ePlot\u003c/h2\u003e\n\nCreate a dataset\n```c++\nstd::vector\u003cfloat\u003e xAxis = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};\nstd::vector\u003cfloat\u003e yAxis = {1, 2, 3, 4, 5, 6, 5, 6, 7, 8};\n\nPlotDataSet set(xAxis, yAxis, sf::Color::Green, \"Green Data\", PlottingType::LINE);\n```\nAvailable plotting types are POINTS, LINE and BARS\n\nCreate your plot and add your dataset\n```c++\n//Position, dimension, margin, font\nSFPlot plot(sf::Vector2f(800, 0), sf::Vector2f(800, 800), 50, \u0026font, \"X Axis\", \"Y Axis\");\nplot.AddDataSet(\u0026set);\n```\n\nInitialize the plott\n```c++\n//x-minimum, x-maximum, y-minimum, y-maximum, x-step-size, y-step-size, Color of axes\nplot.SetupAxes(0, 10, 0, 10, 1, 1, sf::Color::White);\nplot.GenerateVertices();\n```\nIn case you want SFPlot to determine the axes scaling and numbering automatically, call without parameters:\n```c++\nplot.SetupAxes();\nplot.GenerateVertices();\n```\nDisplay data (int your window loop)\n```c++\nwindow.clear();\nwindow.draw(plot);\nwindow.display();\n```\nWant to update data in real time?\n```c++\nwindow.clear();\nplot.ClearVertices();\n\nset.SetDataValue(0, set.GetDataValue(0) + sf::Vector2f(0, 0.001));\n\nplot.SetupAxes();\nplot.GenerateVertices();\n\nwindow.draw(plot);\nwindow.display();\n```\n\n\u003ch2 align=\"center\"\u003ePie Chart\u003c/h2\u003e\n\nCreate dataset\n```c++\nstd::vector\u003cfloat\u003e values = {100, 230, 150, 100};\nstd::vector\u003csf::Color\u003e colors = {sf::Color::Blue, sf::Color::Red, sf::Color::Magenta, sf::Color::Cyan};\nstd::vector\u003cstd::string\u003e labels = {\"A\", \"B\", \"C\", \"D\"};\n//Representations: ABSOLUTE, RELATIVE\nPieChartDataSet pSet(values, labels, Representation::RELATIVE, colors);\n```\nCreate PieChart\n```c++\n//Dataset, Position, Radius, Font\nSFPieChart pChart(\u0026pSet, sf::Vector2f(250, 400), 200, \u0026font);\n```\nInitialize\n```c++\npChart.GenerateVertices();\n```\nDisplay\n```c++\nwindow.clear();\nwindow.draw(pChart);\nwindow.display();\n```\nUpdate data in real time?\n```c++\nwindow.clear();\npChart.ClearVertices();\n\npSet.SetValue(0, pSet.GetValue(0) + 0.003);\n\npChart.GenerateVertices();\nwindow.draw(pChart);\nwindow.display();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr-it%2Fsfgraphing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerr-it%2Fsfgraphing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr-it%2Fsfgraphing/lists"}