Giter Club home page Giter Club logo

du-container-monitor's Issues

hub mass

take into account the mass of the hub: 55.8
For high precision :)

Feature request: Add parsing of target amount from container name

I'd like to be able to specify a target amount in the container hub name.

To be used in 2 ways:

  1. Color based on percentage of target amount
  2. Difference between current amount and target amount displayed, along with current amount and capacity
    For example, 200 units in container that holds 1000 with target of 500 might display 200/300/1000
    Another example, 600 units in container that holds 1000 with target of 500 might display 600/-100/1000

Display units on current amount

Need to show units on the current amount for clarity.

For example, right now if I see 54.0/192.0kL, it is impossible to tell from the numbers alone whether it means 54L or 54kL.

improvements

Please check all cycles and local variables across the code.
Please see comments below

if core ~= nil then
	 local elementsIdList = core.getElementIdList()
	 for _,id in pairs(elementsIdList) do -- use ipairs instead
		local elementType = core.getElementTypeById(id):lower()
		if elementType:find("container") then
			name = core.getElementNameById(id) -- should be local
			if string.match(name, "CH_") or string.match(name, "C_") then
			temp = split(name, "_") -- should be local			 
 				table.insert(containersIdList , {id, temp[1], string.match(temp[2], "%d+"), string.sub(temp[2], -1), temp[3], hasValue(temp[4])})	
				--1: id, 2: type, 3: containercount, 4: containersize, 5: material, 6: description
		end						
		end
	 end
end

Improvement to color the line:

local function getColor(number)
	if number < 50 then
		return "rgb(255," .. utils.round(utils.map(number, 0, 40, 100, 255)) .. ",0)"
	else
		return "rgb(" .. utils.round(utils.map(number, 40, 100, 255, 155)) .. ",255,0)"
	end
end

This code cannot work with different containers in one hub.
Please consider specifying the volume/capacity in the name of the hub.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.