Finding a jQuery style web element to drill down on a tree data structure

I'm looking for a jquery-style javascript / CSS control that will allow the user to expand on the expression.

For example, imagine that we have the following expression:

  (2+3) × (4+5) + Max(22, 31, 16, 62, 40)

This will be evaluated as follows:

   (((2 + 3) × (4 + 5)) + Max (22, 31, 16, 62, 40))  
 ⇒ ((5 × 9) +62)  
 ⇒ (45 + 62)  
 ⇒ 107

I would like to present these intermediate steps in such a way that the user can expand a specific branch of the evaluation in order to discover the inputs that gave a certain value.

I played with the idea of ​​manipulating the generation of expressions in a tree structure, possibly with intermediate ratings inserted (blue shown in the example). However, I am concerned that the audience I am targeting this software to may seem a little intimidating.

eg. Expression tree

An alternative, friendlier view might be to allow collapsing in place, as shown in this example:

At first, the expression looks like this: Expression's initial state

The user presses the button "107", which changes the control to this:

View after the '107' button has been pressed

The user presses the "62" button, which changes the control to this:

View after the '62' button has been pressed

, , , . , , .

+5
1

, , , . : http://github.com/Wheelies/expression-explorer

, .

(((2+3)×(4+5))+Max(20+2, 31, 16, 62, 40)) , :

107

[107], :

45+62

[62], :

45 + Max(22, 31, 16, 62, 40)

[22]

45 + Max((20+2), 31, 16, 62, 40)

, . , JQuery

+4

All Articles