Visualizing sequences

This entry is part 2 of 4 in the series Reactive Extensions in theory and practice

As we already know from part 1 an Observable is a sequence of ongoing events in time. These sequences and their compositions and transformations can be nicely visualized by marble diagrams in either textual or graphical representation. The visualization of Observables makes it very easy to understand what is going on even if you are not an expert in Reactive Extensions.

Textual representation

There is a simple textual representation that uses the following symbols:

Symbol Description
--> Timeline flows from left to right
O Item emitted by a sequence when called OnNext
X Abnormal termination when called OnError
| Successful completion when called OnCompleted

A sequence with 3 items looks like this:


Combining sequences

The following diagram visualizes the Select(f) operator applied to Seq1 that creates a result stream (Result) where each emitted value of Seq1 is replaced according to the function f. In this case f adds one to the input value:

Seq1   --1---2-----3---->
       Select(x => x + 1)
Result --2---3-----4---->

Graphical representation

Here is the graphical representation of the example from above:

Marble diagram - Select


Series Navigation<< Short introduction to Reactive ExtensionsDrawing lines with Rx >>

Published by

Leif Battermann

I am a passionate software developer interested in .NET C#, F#, Haskell, software design and architecture, functional programming, clean code, flow design, code katas, coding dojos and more.

  • Arthur H.

    Nice articles!
    If I may ask: What tool did you use to create the nice marble diagrams? I am looking for something I could use for my slides talk about reactive programming. Thank you 🙂