I have tried to render the chart with an array of objects as the key (string) and value (numeric) but I am getting like this
main.js:40 Uncaught TypeError: chart.rendor is not a function
const form = document.getElementById(‘voteForm’);
form.addEventListener(‘submit’, e => {
    const option = document.querySelector(‘input[name=series]:checked’).value;
    const data = {series: option};
    console.log(option,data)
    fetch(‘http://localhost:3001/poll’, {
        method: ‘POST’,
        body: JSON.stringify(data),
        headers: {
        ‘Content-Type’: ‘application/json’
        }
    }).then(res => res.json())
    .then(data => console.log(data))
    .catch(err => console.log(err));
    e.preventDefault();
});
let dataPoints = [
    { label: ‘Game of Thrones’, y:0},
    { label: ‘Money Heist’, y:0},
    { label: ‘Dare Devil’, y:0},
    { label: ‘Peaky Blinders’, y:0},
    { label: ‘How to get away with murder’, y:0},
];
const chartContainer = document.querySelector(‘#chartContainer’);
console.log(chartContainer)
if (chartContainer) {
    const chart = new CanvasJS.Chart(“chartContainer”, {
        animationEnabled: true,
        theme: ‘theme1’,
        title: {
            text: ‘Best Series’
        },
        data: [{
            type: ‘column’,
            dataPoints: dataPoints
        }]
    });
    chart.rendor();
}
I’m getting everything in the console and the only problem is this
	- 
		This topic was modified 5 years, 7 months ago by 
Rishwanth.
	 
	- 
		This topic was modified 5 years, 7 months ago by 
Rishwanth.
	 
	- 
		This topic was modified 5 years, 7 months ago by 
Vishwas R.