Create chart with code