chart.setDataXML("<chart caption="..." which breaks code.
Just replace all double quotes with backslash-double quote.I believe this would work from JavaScript and not break the string for the dataXML function:
<chart caption=\"Monthly Chocolate Usage\" bgColor=\"c7c7c7\" xAxisName=\"Month\" yAxisName=\"Chocolate Usage\" numberSuffix=\" KWh\" showValues=\"0\" useRoundEdges=\"1\">
Regards,
/Hans