This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dehpawner's profile picture

Multitrace graphing question

Started by Dehpawner, 28 February 2014 - 04:52 PM
Dehpawner #1
Posted 28 February 2014 - 05:52 PM
I am having trouble trying to multitrace graphs.
http://pastebin.com/FG1GpzxB
is what I have so far.

Goal – have the graph, graph System Power and Inventory Percent Full.

I am just failing to see where I can add another graph to the monitors, I have tried for a few hours trying different things.

Any suggestions?

I have done some more looking through the forums, I have done a little bit more of editting, and now I am coming up with
graph:41:expected number

here is the code
Spoileros.loadAPI("ocs/apis/graph")
os.loadAPI("ocs/apis/sensor")
– system power
local mon=peripheral.wrap("right")
local aesensor1= "left"
local aesystem1="0,0,3"
local getdetails = "getTargetDetails"
– inventory
local mon=peripheral.wrap("right")
local aesensor2="left"
local aesystem2="0,0,3"
local getdetail = "getTargetDetails"

–power graph

function update()
local tab = sensor.call(aesensor1, getdetails, aesystem1)
return tab.SystemPower
end

function update2()
local tab2 = sensor.call(aesensor2, getdetail, aesystem2)
return tab2.InventoryPercentFull
end
local gr, err = graph.new(peripheral.wrap("right"), {update, update2}, {"System Power", "Inventory"}, {nil,nil}, {0,0}, {1000,100}, false)

if gr then
while true do
gr:draw()
sleep(0.5)
end
else
print(err)
end


Any suggestions?

    After further messing around with the code, i replaced the {nil, nil} with {1,1} to try to get rid of the 'graph:41:expected number' error. It worked, so I'm just going to make my own gradient to see if it will have some color! :D/>

    – Super Happy now! :D/>
    Lyqyd #2
    Posted 01 March 2014 - 12:55 AM
    Glad you managed to solve this before I could come by and approve it! Feel free to ask further questions about it in this topic if you run into further issues.