Stock Market Plotting Graph Help

Hello Developers,

I’m going to start off by saying that, I am a mediocre scripter. I’m know scripting terms so no need to clarify them.

Alright, now onto the actual question; How would you plot a graph using Roblox Luau? I have the system setup, and it works fine. What I want to do is, that I take a value, and plot in a graph. Then, when that value changes, there’s another plotted point. And between those plots there should be a line.

Any Help is GREATLY Appreciated,
OceanTubez

Are the points on the graph plotted with scale, offset, or a mix of both?

Is this like a 3D line? An actual physical part in your game, or is it part of a GUI or something 2D?

It’s A GUI.

omg bruvs this text is so cool

I don’t think you understood, I need to still PLOT the points on the graph

You could use ui but i would do it in 3D for ease.

Say you have a Part of size of 100,100,1 (z doesnt matter)

Now first you need to get the top right corner of the part which can be done through a bit of math.

Now after getting the corner you can plot the graph using fractions. How?

local Plane = Plane or Workspace.Plane 
local TopRight = (Plane.CFrame *CFrame.new(Plane.Size.X/2,Plane.Size.Y/2,Plane.Size.Z/2 + 1))
local PlotCount = PlotCount or Plane.PlotCount
function PlotPoint(x,y)
    local NewCFrame = CFrame.New(x * TopRight.Position.X,y*TopRight.Position.Y,TopRight.Position.Z) * CFrames.Angles(0,0,0)

local Properties = {
['Size'] = Vector3.new(1,1,1),
['CFrame'] = NewCFrame,
['Name'] = PlotCount.Value + 1,
['Parent'] = workspace
-- And Other Properties..
}
local PlottedPart = Instance.new('Part')
for i,v in Properties do
    Part[i] = v
end
game:GetService('CollectionService'):AddTag('Point-Plot',PlottedPart) --or add them to a folder. Will be better for lines
PlotCount.Value += 1
local AttachmentForBeams = Instance.new('Attachment')
AttachmentForBeams.Parent = PlottedPart
end
function DrawLinesBetweenPoints()
--you know what to do here ;)
end
PlotPoint(1/100,3/100)

I don’t understand what you are saying right now, do you want to plot the points using the offset property of UDim2, the scale property, or both?

Also, I highly recommend using a viewport, as the CFrame functions allow parts to look at each other, so easily we can make a line between two parts. Look at @IamNewToRiblix’s answer.