Grumpy Old Man 3547 Posted April 29, 2017 Hey folks, would it be possible to display a line or bar graph or similar inside a dialog? Which ui elements should I use for that? A simple bar or line graph would do just fine Wanted to track some values over time and display them with a graph or similar. Any ideas? Cheers Share this post Link to post Share on other sites
killzone_kid 1332 Posted April 29, 2017 map control draw line Share this post Link to post Share on other sites
Greenfist 1863 Posted April 29, 2017 Or any rectangular shape with background color for bar graphs. Share this post Link to post Share on other sites
Grumpy Old Man 3547 Posted April 30, 2017 Draw line seems it might do the trick. Gonna take a look into that, bars might be needed for a different graph but could work as well if the line doesn't work out. Cheers Share this post Link to post Share on other sites
Larrow 2823 Posted April 30, 2017 No need for the map control if not needed, just use a RscLine via ctrlCreate. 4 Share this post Link to post Share on other sites
atmo 29 Posted April 16, 2018 (edited) Ok, with the risk of resurrecting an old thread....and the fact I've never created any GUI elements before does anyone have example code? I'm trying to create a scatter plot of some data..... Atmo Edit: I've just read Killzone_Kid's tutorials and some of the wiki... will keep trying.. Edited April 16, 2018 by atmo Share this post Link to post Share on other sites
atmo 29 Posted April 22, 2018 Ok. Another weekend lost to Arma.... Sort of like this then....! I'll work on it a bit but this is the basics. Description.ext class RscTitles { class Atmo_fpsMonitor_Background { idd = -1; duration = 1e+1000; class controls { class Atmo_fpsMonitor_BackgroundControl { idc = 10000; type = 0; style = 96; x = safeZoneXAbs + safeZoneWAbs - 0.8 * 3/4; y = safezoneY + safeZoneH - 0.6; w = 0.8 * 3/4; h = 0.14; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {,0.7,0.7,0}; // ignored but throws error if omitted colorText[] = {0,1,0,1}; text = "Client fps"; }; }; }; class Atmo_fpsMonitor_Line { idd = -1; duration = 120; fadein = 0; fadeout = 0; class controls { class Atmo_fpsMonitor_LineControl { idc = -1; type = 0; style = 176; x = "missionNamespace getVariable 'Atmo_fpsMonitor_LinePosition' select 0"; y = "missionNamespace getVariable 'Atmo_fpsMonitor_LinePosition' select 1"; w = "missionNamespace getVariable 'Atmo_fpsMonitor_LinePosition' select 2"; h = "missionNamespace getVariable 'Atmo_fpsMonitor_LinePosition' select 3"; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; // ignored but throws error if omitted colorText[] = {0, 1, 0, 1}; text = ""; }; }; }; }; and in Init.sqf or initPlayerlocal.sqf [] spawn { scriptName "Atmo_fpsMonitor"; sleep 0.1; private _stepX = 1/60; private _stepY = 1/80; private _monitorWidth = 0.8 * 3/4; private _monitorHeight = 0.14; private _monitorXpos = safeZoneXAbs + safeZoneWAbs - _monitorWidth; private _monitorYpos = safezoneY + safeZoneH - 0.6; 100 cutRSC ["Atmo_fpsMonitor_Background","PLAIN"]; // Show the background private _frame = 0; private _fpsOld = 0; while{true} do { private _fps = diag_fps; private _x1 = _frame * _stepX * _monitorWidth + _monitorXpos; // Start line X position private _y1 = (1 - (_fpsOld * _stepY)) * _monitorHeight + _monitorYpos; // Start line Y position private _y2 = (1 - (_fps * _stepY)) * _monitorheight + _monitorYpos; // End line Y position private _cx = _stepX * _monitorWidth; // line X length private _cy = _y2 - _y1; // line Y length Atmo_fpsMonitor_LinePosition = [_x1, _y1, _cx , _cy]; // position the Rsc references (101 + _frame) cutRsc ["Atmo_fpsMonitor_Line", "Plain"]; _frame = (_frame + 1) mod 60; _fpsOld = _fps; sleep 1; }; }; // 'First style' - shifts the whole array - and the whole monitor slides. /* // Create the fpsArray private _fpsArray = []; for "_i" from 0 to 60 do { _fpsArray pushBack 0; }; while{true} do { for "_i" from 0 to 59 do { _x1 = _i * _stepX * _monitorWidth + _monitorXpos; _y1 = (1 - ((_fpsArray select _i) * _stepY)) * _monitorHeight + _monitorYpos; _y2 = (1 - ((_fpsArray select (_i+1)) * _stepY)) * _monitorheight + _monitorYpos; _cx = _stepX * _monitorWidth; _cy = _y2 - _y1; newPosition = [_x1, _y1, _cx , _cy]; (101 + _i) cutRsc ["myDrawTitle", "Plain"]; }; sleep 0.5; private _dummy = [_fpsArray] call Bis_fnc_arrayShift; _fpsArray pushBack diag_fps; _frame = _frame + 1; }; */ My first GUI! Any comments appreciated. 3 Share this post Link to post Share on other sites
7erra 629 Posted April 23, 2018 Wow looks really good! Do you think there is a way to make the line appear like the Task Manager in Windows? Also labeling the axes would be amazing ;) I'm going to try out some stuff too 1 Share this post Link to post Share on other sites
atmo 29 Posted April 24, 2018 @7erra - yes, look at the commented out code - that's what that is.. I've got a few more things going like showing and hiding with User1 action key. I'm still investigating the GUI so I might be a bit slow here! I'm registering all the layers etc at the moment, just trying out a few other things. Share this post Link to post Share on other sites
7erra 629 Posted April 24, 2018 Okay got it (kind of). Video: Scripts: https://drive.google.com/open?id=1gujKZpdbneZmoZRj5BLg0xhcsWCAfosw I had some problems with the math behind the RscLine solution even though @atmo already did a great job on that one Therefore I sticked to the progress bar. 1 1 Share this post Link to post Share on other sites
atmo 29 Posted April 24, 2018 Ah nice. You've helped me along a little bit . I like the macro. Thanks for sharing. I'll keep experimenting. 2 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted April 24, 2018 5 hours ago, 7erra said: Okay got it (kind of). 7erra that was really great!! 1 Share this post Link to post Share on other sites