{"id":"linuskat/iris-implot","name":"iris-implot","scope":"linuskat","platform":"roblox","description":"Fork of Iris which adds 2 new plotting widgets","version":"1.0.4","latest":"1.0.4","versions":["1.0.1","1.0.2","1.0.3","1.0.4"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"5fafb36f9f02a4981fb9b9dda0d0ca94b2463eefb375f5bdb67a211a3827869b","likes":0,"downloads":0,"install":"forest install linuskat/iris-implot","url":"https://forest.dev/p/roblox/linuskat/iris-implot","files":"https://api.forest.dev/ai/package/roblox/linuskat/iris-implot/files","readme":"# <span align=\"left\">ImPlot for Iris</span> <a href=\"https://github.com/LinusKat/ImPlot/releases/\"><img align=\"right\" src=\"/public/download.svg\" /></a>\r\n\r\nThis is a graphing widget addon based off [ImPlot](https://github.com/epezent/implot), using the open source project [Iris](https://github.com/SirMallard/Iris).\r\n\r\n<div align=\"center\">\r\n    <table>\r\n        <tr>\r\n            <td><img src=\"public/example1.png\" alt=\"Example 1\" width=\"400\"/></td>\r\n            <td><img src=\"public/example2.png\" alt=\"Example 2\" width=\"400\"/></td>\r\n        </tr>\r\n        <tr>\r\n            <td><img src=\"public/example3.png\" alt=\"Example 3\" width=\"400\"/></td>\r\n            <td><img src=\"public/example4.png\" alt=\"Example 4\" width=\"400\"/></td>\r\n        </tr>\r\n    </table>\r\n</div>\r\n\r\n> Iris is an Immediate-Mode GUI Library for Roblox for creating debug and visualisation UI and tools and based on Dear ImGui.\r\n\r\n## Installation\r\n\r\n### Wally\r\n\r\nAdd: `\"linuskat/iris-implot` as a dependancy.\r\n```toml\r\n[dependencies]\r\nIris = \"linuskat/iris-implot@1.0.4\"\r\n```\r\n\r\n### Pre-installed\r\n\r\nDownload the Iris RBXM/ZIP from [releases](https://github.com/LinusKat/ImPlot/releases).\r\n\r\n### Manual\r\n\r\nSince Iris does not have the capability to simply add widgets you will need to modify Iris internal files to use the ImPlot addon.\r\n\r\nIf you are using an external code editor through a tool such as Rojo, I recommend downloading the packaged Iris zip file in [releases](https://github.com/LinusKat/ImPlot/releases).\r\n\r\n## Usage\r\n\r\n### Graphs\r\n\r\n```lua\r\n--!strict\r\nlocal Iris = require(\"@self/Iris\")\r\n\r\nlocal function Sample(SampleCount: number, Step: number, f: (x: number) -> number): {[number]: Vector2}\r\n\tlocal packed = {}\r\n\tfor x = 1, SampleCount, Step do\r\n\t\ttable.insert(packed, Vector2.new(x, f(x)))\r\n\tend\r\n\treturn packed\r\nend\r\n\r\nlocal SinPacked = Sample(100, .01, math.sin)\r\nlocal CosPacked = Sample(100, .01, math.cos)\r\n\r\nIris.Init()\r\nIris.UpdateGlobalConfig(Iris.TemplateConfig.sizeClear)\r\nIris:Connect(function()\r\n    local show_context = Iris.State(true)\r\n\tlocal plots = Iris.State({})\r\n\r\n\tIris.Window({\"Graph\"}); do\r\n\t\tIris.Checkbox({\"Show Context\"}, {isChecked = show_context})\r\n\r\n\t\tplots:set{{\r\n\t\t\tData = SinPacked,\r\n\t\t\tName = \"Sin\",\r\n\t\t\tGraphStyle = {\r\n\t\t\t\tColor = Color3.new(1, 0, 0),\r\n\t\t\t\tThickness = 1,\r\n\t\t\t},\r\n\t\t}, {\r\n\t\t\tData = CosPacked,\r\n\t\t\tName = \"Cos\",\r\n\t\t\tGraphStyle = {\r\n\t\t\t\tColor = Color3.new(0, 0, 1),\r\n\t\t\t\tThickness = 1,\r\n\t\t\t},\r\n\t\t}}\r\n\r\n        Iris.ImPlotGraph({\r\n            \"Sin / Cos\",\r\n            { X = \"x\", Y = \"y\", XScale = 1, YScale = .8 }},\r\n            {plots = plots, showDataInformation = show_context}\r\n        )\r\n    end; Iris.End()\r\nend)\r\n\r\n```\r\n\r\n### Pie Charts\r\n\r\n```lua\r\n--!strict\r\nlocal Iris = require(\"@self/Iris\")\r\n\r\nlocal EuropeanPizzaPreference = {\r\n\t{Value = 97, Color = Color3.fromRGB(255, 99, 71), Name = \"Neapolitan Pizza\"},\r\n\t{Value = 19, Color = Color3.fromRGB(30, 144, 255), Name = \"Sicilian Pizza\"},\r\n\t{Value = 7, Color = Color3.fromRGB(50, 205, 50), Name = \"Roman Pizza\"},\r\n\t{Value = 13, Color = Color3.fromRGB(218, 112, 214), Name = \"French Pizza\"},\r\n\t{Value = 45, Color = Color3.fromRGB(255, 165, 0), Name = \"Spanish Pizza\"},\r\n\t{Value = 21, Color = Color3.fromRGB(139, 69, 19), Name = \"Calzone\"},\r\n\t{Value = 64, Color = Color3.fromRGB(0, 191, 255), Name = \"New York Pizza\"},\r\n}\r\n\r\nIris.Init()\r\nIris.UpdateGlobalConfig(Iris.TemplateConfig.sizeClear)\r\n\r\nIris:Connect(function()\r\n\tIris.Window({\"Pie Chart\"}); do\r\n\t\tlocal show_pie_chart_data = Iris.State(true) -- this will show whether the data of the pie chart is shown.\r\n\t\tIris.Checkbox({\"Show Pie Chart Data\"}, {isChecked = show_pie_chart_data})\r\n\r\n\t\tIris.ImPlotPieChart({EuropeanPizzaPreference}, {showPieData = show_pie_chart_data})\r\n\tend; Iris.End()\r\nend)\r\n```\r\n\r\n### Scatter Charts\r\n\r\n```lua\r\n--!strict\r\nlocal Iris = require(\"@self/Iris\")\r\n\r\nlocal ScatterPlot = {\r\n\tData = {},\r\n\tName = \"math.random()\",\r\n\tMarkerStyle = {\r\n\t\tShape = \"Circle\",\r\n\t\tColor = Color3.new(1, 0, 0),\r\n\t\tSize = 10,\r\n\t\tTransparency = .4\r\n\t},\r\n}\r\n\r\nlocal RNG = Random.new(os.clock())\r\nfor i = 1, 50 do\r\n    table.insert(ScatterPlot.Data,\r\n\t\tVector2.new(RNG:NextInteger(-100, 100), RNG:NextInteger(0, 50))\r\n\t)\r\nend\r\n\r\nIris.Init()\r\nIris.UpdateGlobalConfig(Iris.TemplateConfig.sizeClear)\r\n\r\nIris:Connect(function()\r\n\tlocal scatter_plot_state = Iris.State({})\r\n\r\n\tscatter_plot_state:set({ScatterPlot})\r\n\r\n\tIris.Window({\"Scatter Chart\"}); do\r\n\t\tIris.ImPlotGraph({\r\n\t\t\t\"Scatter Plot\",\r\n\t\t\t{X = \"X\", Y = \"Y\", XScale = .9, YScale = .9}},\r\n\t\t\t{plots = scatter_plot_state}\r\n\t\t)\r\n\tend; Iris.End()\r\nend)\r\n```\r\n\r\n## API\r\n\r\n### `ImPlotGraph` - Graph Widget\r\n\r\n```lua\r\nfunction ImPlotGraph(\r\n\tWidgetArguments: {\r\n\t\tGraphName: string?,\r\n\t\tAxes: {\r\n\t\t\tXScale: number,\r\n\t\t\tX: string,\r\n\t\t\tYScale: number,\r\n\t\t\tY: string,\r\n\t\t},\r\n\t},\r\n\r\n\tWidgetStates: {\r\n\t\tshowDataInformation: State<boolean>,\r\n\t\tsize: State<Vector2>,\r\n\t\tplots: State<{\r\n\t\t\t{\r\n\t\t\t\tData: {Vector2},\r\n\t\t\t\tName: string?,\r\n\t\t\t\tMarkerStyle: { -- Include when scatter plot | Customization for scatter plot\r\n\t\t\t\t\tShape: Shape,\r\n\t\t\t\t\tColor: Color3,\r\n\t\t\t\t\tSize: number,\r\n\t\t\t\t\tTransparency: number,\r\n\t\t\t\t}?,\r\n\t\t\t\tGraphStyle: { -- Include when graph plot | Customization for graph lines\r\n\t\t\t\t\tColor: Color3,\r\n\t\t\t\t\tThickness: number,\r\n\t\t\t\t}?,\r\n\t\t\t}\r\n\t\t}>,\r\n\t}\r\n)\r\n```\r\n\r\n### `ImPlotPieChart` - Pie Chart Widget\r\n\r\n```lua\r\nfunction ImPlotPieChart(\r\n\tChunkDataContainer: Frame,\r\n\tPieChart: any,\r\n\r\n\tWidgetArguments: {\r\n\t\tpieData: {\r\n\t\t\tColor: Color3?,\r\n\t\t\tValue: number,\r\n\t\t},\r\n\t},\r\n\r\n\tWidgetStates: {\r\n\t\tshowPieData: State<boolean>,\r\n\t\tnormalize: State<boolean>,\r\n\t}\r\n)\r\n```\r\n\r\n## Credits\r\n\r\n- ImPlot Documentation - [@vijarsan](https://github.com/vijarsan)\r\n- [Iris](https://github.com/SirMallard/Iris) - Maintained by [@SirMallad](https://github.com/SirMallard)\r\n- [Maid](https://github.com/Quenty/NevermoreEngine/blob/main/src/maid/src/Shared/Maid.lua) - Maid by [Quenty](https://github.com/Quenty)\r\n- Based off [ImPlot](https://github.com/epezent/implot)\r\n","readmeTruncated":false}