Preprocessing data to support stacked graph