Modified the mechanism for generating the segments on the graph.