wrote a function to take a container id and an array with data and build the chart