@rbadis,
chart.addTo() method is used to add the line dataseries programmatically, as shown in the example. The code you are trying does not work because the series needs to be created before “type” or “datapoints” can be assigned.
If you are looking to change the y-values such that the line is centered vertically, you can use the y-axis range to calculate the midpoint. In case you are still having issues, please create a JSFiddle and share with us, so that we can understand your scenario better and help you out.
—
Ananya Deka
Team CanvasJS