Using a variable to set the width of a rectangle

Jan 24, 2014

I want to dynamically draw a bar graph using numerical values stored in variables to determine the lengths of the bars.

So, for example, I might have variables a, b, c and d, each containing a number up to 100, and I'd like to use those numbers to draw four bars (rectangles) of corresponding lengths, to represent the values in the four variables.

Is there a method that I'm missing? Any suggestions gratefully appreciated!

2 Replies
Bruce Graham

Hi Drew, and a warm welcome to the Heroes Community.

Not sure that it can be done except having e.g. a rectangle with 100 states, and if %height" = 47, then show State #47.

There may be a clever way to do this, but this is the only, completely inefficient way I can think to do this at the moment

Once again - welcome, and hope you get the solution to your first query here.

Drew Simpson

Thanks Bruce, for the reply and for the welcome.

As you say, using states like that wouldn't be efficient with 100 or so values, but perhaps it would be good if there were, say, up to ten.

It would be nice to be able to set the width (or position) of a shape to a variable rather than a fixed value - maybe JavaScript could help?

This discussion is closed. You can start a new discussion or contact Articulate Support.