Closed kjdion84 closed 4 years ago
I found something interesting:
$chart.setData({"cols":[{"type":"string","label":"Vertical"},{"type":"number","label":"Leads"}],"rows":[{"c":[{"v":"Education"},{"v":8}]},{"c":[{"v":"Auto Loan"},{"v":7}]},{"c":[{"v":"Personal Loan"},{"v":7}]}]});
vs:
$chart.setData({"cols":[{"type":"string","label":"Vertical"},{"type":"number","label":"Leads"}],"rows":[{"c":[{"v":"Education"},{"v":"8"}]},{"c":[{"v":"Auto Loan"},{"v":"7"}]},{"c":[{"v":"Personal Loan"},{"v":"7"}]}]});
It looks like the live environment is interpreting these as strings rather than numbers. I think this is the problem. How do I fix this?
I fixed the issue by casting the variables with (int)
for the charts.
I wonder if it would be worthwhile to have all number columns be cast to floats or ints while they are converted to json.
I also want to know why the json would be output differently on dev vs live. Maybe a dumb question, but the php versions? Identical environments?
Maybe using the encode_json option JSON_NUMERIC_CHECK
to force numeric output would work....
I have no idea.
I can't promise a time frame, but I will look into this when I get a chance. But this definitely seems to be a bug.
I'm going to close this, just because it is so stale. This project is not abandoned, just in a stable state for now. I am always happy to help and please open a new issue if needed.
Thank you for using Lavacharts!
I have lavacharts working perfectly on localhost:
But they are completely broken on live environment:
Any idea why this is happening? Its using the exact same code in the exact same PHP version. I am using Siteground for my live environment and WAMPSERVER for localhost.