prepare legend and add toast