panosoft / node-chartist

SVG Charts on the server.
The Unlicense
83 stars 20 forks source link

'Type Error: Assignment to constant variable' after updating to node-chartist 1.0.1 #13

Closed a2raoof closed 7 years ago

a2raoof commented 7 years ago

I am getting an error:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Assignment to constant variable.

After updating to node-chartist 1.0.1

This happens during the following call

const bar = generate('line', options, data).then((output) => { ... }

I have tried setting the options both using the new Chartist object introduced in this update and without. I tried reverting back to a previous version and it works fine, but I do want to have access to the Chartist options.

alexgig commented 7 years ago

Hi @a2raoof,

Please send enough code to reproduce the issue and I can take a look.

Best, Alex

a2raoof commented 7 years ago

Hi @alexgig

I was able to produce the issue with:

` const options = { width: 500, height: 400, };

const data = {

labels: ['A', 'B', 'C'],

series: [
  {name: 'A', value:[2, 2.5, 1]},
  {name: 'B', value:[3, 3, 2]},
  {name: 'C', value:[4, 1, 1]}
]

} const bar = generate('line', options, data);`

Thanks

a2raoof commented 7 years ago

Tried this:

` var options = { width: 500, height: 400, };

const data = { // A labels array that can contain any sort of values labels: ['A', 'B', 'C'], // Our series array that contains series objects or in this case series data arrays series: [ {name: 'A', value:[2, 2.5, 1]}, {name: 'B', value:[3, 3, 2]}, {name: 'C', value:[4, 1, 1]} ] } const bar = generate('line', options, data);`

But still getting the error. I tried changing everything to var instead of const and still getting

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Assignment to constant variable.

alexgig commented 7 years ago

version of node?

a2raoof commented 7 years ago

v6.8.0

Do I need to update this to the latest? It was working with this version of node prior to the update to node-chartist v1.0.1

EDIT: Updated to v6.9.3 and still getting the error.

alexgig commented 7 years ago

Should be good to go. Tests pass on node v6.9

v1.0.2 published

a2raoof commented 7 years ago

Great! Works :)

Thanks for the help and quick response (Y)

alexgig commented 7 years ago

Excellent. You're welcome and thanks for posting the issue.

Happy charting! :-)

Best, Alex