Sunday, February 28, 2016

Visualizing Periodic Order Schedules

I've been grappling with a problem involving order schedules and thought a visualization may help to understand the problem better.  There just doesn't seem to be an existing graph that satisfies all my criteria.  Before I go to far it may help to explain my situation.  Imagine a system where weekly repeating orders are placed, and each of these orders go through several stages of fulfilment.  For example, here is an order placed every week on Friday.

Friday - Order Placed 
-on order-
Saturday - Order Delivered
-on hold-
Sunday - Stock placed on show for sale
-on show-
Tuesday - Check remaining stock and investigate overstocks

This seems simple to understand, the order is placed and is considered "on order", once it's delivered it's put "on hold" until it's checked to make sure the delivery is correct.  Once placed on show for sale it's considered "on sale".  After the next load arrives any remaining stock is considered to be an "over" or overstock.  Not too hard.  Now imagine you have many of these orders during a week and they all overlap.  It starts to become confusing.  A traditional way of displaying this might be in the form of the graph below.  It's certainly clear, but the cyclic nature of the orders isn't displayed.  For example, the order at the top should be entered again starting at the second Friday column in the graph, but this makes it look like you have more orders that you really do.  Is there a better way?

Linear order graph

The cyclic nature of the orders suggest that a circular graph may be useful and with a bit of playing around I came up with the visualization below.  The first event in an order sequence is mark on the outer part of the graph, it then spirals inwards indicating the different stages of the order process with different colours.  It's advantages are that orders only need to be added to the graph once and it allows the user to see the current state of all orders.  The graph below contains 5 orders and is easy to read once you understand how it works.

Circular order graph
Time for an example.  Let's say that on Tuesday at 6 pm you are curious about stock levels.  You start by drawing a line from the centre at this time on the edge of the graph.  You can see that the line crosses a green line, this indicates on show stock, it crosses a yellow line, this indicates on hold stock, and it crosses two red lines, both of these are orders that have been placed and not delivered.  If you want know the time the next load is delivered, rotate the line forward, until one of the red lines turns yellow.  This happens around midday Wednesday.

You may also want to know the history of the stock on show.  That's also easy, just follow the green line backwards.  Events mentioned are labelled with a black dot. You can see that the stock became available for sale on Sunday morning, arrived midday Saturday, and was ordered Thursday morning (that's a pretty long lead time isn't it).  For completeness the blue line indicates overstocks, and as this is the last stage of the order process and doesn't really have an end time, the line will fade out over two days.

Another interesting feature is that you can immediately see when an order for stock was placed by looking at the white grid lines.  Look at where the black line crosses the yellow line.  It's 4 and bit divisions from the edge of the graph.  This means that order was placed 4 and bit days ago.  You can confirm this by following the line back to see that this order was placed on Friday morning.

It's just a prototype and the colours need to be tweaked.  You could also make an axis logarithmic to emphasise certain data.  I like it.  It reminds me of a Smith Chart.

I've put the python code I used to generate this in  gist.  It's not pretty and should just be used to get you started.
Get the code!

No comments:

Post a Comment