Dynamic Bar Chart

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Dynamic Bar Chart // Scriptorium

1  |  

Post by early // Sep 30, 2008, 3:53am

early
Total Posts: 46
Here's a 10 element FIFO data pipe. A familiar display metaphor is chosen - a simple bar chart.

Specify a number for iValue, flick the control line, and your input is pushed to the top of the array. All the other numbers are pushed down one position. The previous tenth element (now eleventh) is dumped into oValue.

Each element is output from the array to the Rosetta object, where each is attached to the 'height' parameter of a cube.

Instant ten element dynamic bar chart. Hook the output of one to the input of the next, a twenty element dynamic chart.

Post by early // Sep 30, 2008, 3:58am

early
Total Posts: 46
Here's an example how to use it dynamically. I'll grab an arbitrary data source from Windows by using one of the Win32_ objects. I send the chosen counter through a BinaryOp function to scale the data down to something reasonable. I could have scaled the TenChart object instead. I'll drop in the activity control structure that trueBlue showed me. The Win32_ object will trigger the TenChart to load the new data, which is represented in 3D Space by the height of the bars...

Post by trueBlue // Sep 30, 2008, 9:06am

trueBlue
Total Posts: 1761
pic
You ARE so very cleaver thanks for sharing! :)
Added a background. Horizontal Edges represent 0% to 100%.
Added BinaryOps to Bars with Min = 10.
Used Object - Material Instancing for Bars.
Video demonstrates using Random Engine.

Post by early // Oct 1, 2008, 4:56am

early
Total Posts: 46
And thank you for sharing your enhancements. I've been having so much fun making the things, I haven't taken time to make them pretty.


The BinOp MIN could be moved to the input side of the FIFO queue if you don't need to preserve the original value. As it is, each value is being tested 10 times.


It really appears that the vbscript doesn't care if a Rosetta object variable (whatever you call them - like iValue and oValue) are input or output. That is, TenFIFO reads from, as well as writes to, output variables. A discarded version of the script copied output variables into input variables as the last step.

Post by early // Oct 3, 2008, 4:28am

early
Total Posts: 46
I've added a simple delta function object to the first post.


It should be useful to prepare data for the bar chart. It uses the same (pathological?) programming technique I used in in the FIFO object, exploiting the 'leftover' values in the output variable oValue. Again like the FIFO object, the code is astonishingly compact:



' Execute

' Called to execute the command

Sub Execute(params)


Dim iValue, oValue


oValue = params.ConValue("oValue")

iValue = params.ConValue("iValue")


params.ConValue("oDelta") = iValue - oValue

params.ConValue("oAbsDelta") = abs(iValue - oValue)

params.ConValue("oValue") = params.ConValue("iValue")


End Sub

Post by early // Oct 5, 2008, 9:26am

early
Total Posts: 46
10Chart was updated to handle the negative values supplied by the Delta function. The object was updated in the top post.


In the example, processor interrupts per second are being charted in the rear, while the deltas are scaled up in the foreground.

Post by frootee // Oct 5, 2008, 9:50am

frootee
Total Posts: 2667
pic
very cool stuff early!


Just as a note, I found during testing that the Paused Activity Loop like you have here is more efficient in shared space than using a timer.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn