pingをmsで指定すると、ifとcolorsをハードコーディングせずにアルゴリズムを使ってこのpingを行うことができますか?値をハードに定義する代わりに、アルゴリズムで色を表示する
function displayPing(lngThePingTime)
response.Write("<span style=""font-wight:bold;color:")
if(lngThePingTime < 50) then
response.Write("#77ff66")
elseif lngThePingTime < 100 then
response.Write("#22ee00")
elseif lngThePingTime < 150 then
response.Write("#33bb00")
elseif lngThePingTime < 250 then
response.Write("#ffaa00")
elseif lngThePingTime < 400 then
response.Write("#ee6600")
elseif lngThePingTime < 550 then
response.Write("#dd4400")
elseif lngThePingTime < 700 then
response.Write("#dd1100")
elseif lngThePingTime < 1000 then
response.Write("#990000")
else
response.Write("#660000")
end if
response.Write(""">")
response.Write lngThePingTime
response.Write("</span>")
end function
をしかし言うアルゴリズム持つのいずれかの方法があります:IEこの機能はうまく機能
Lowest Colour : #77ff66
Highest Colour: #660000
Cutoff Value: 1500 (any ping higher than this is fixed to highest colour)
色はすべての日陰ではない固定色合いのセットになるようにしますか?
言語は問題ではなく、メソッドにもっと興味があります!
スプリット色LowとHighの間で単純な線形補間を行います。私にはうまく見える、私はこれを使用しました。 –
HSV座標内の補間は、通常、少し良くなります。つまり、緑色から赤色への移行は、茶色のかわりに黄色を経ます。 –