mhamano / Qilk-Sense-Chartjs

Qlik Sense Extension using Chart.js(http://www.chartjs.org/).
Other
19 stars 15 forks source link

formatMeasure Function works incorrectly on negative numbers #10

Open jmcturnan opened 7 years ago

jmcturnan commented 7 years ago

Hi,

I noticed that when a chart has both negative and positive numbers, the negative numbers are missing their thousand separator.

I partially fixed it for those that are set to 'Auto' with this to the condition: "|| parseInt(e) < -999 "

// if (t.qHyperCube.qMeasureInfo[r].qIsAutoFormat) return parseInt(e) > 999 ? e.toString().replace(".", a).replace(/\B(?=(\d{3})+(?!\d))/g, n) : e.toString().replace(".", a); if (t.qHyperCube.qMeasureInfo[r].qIsAutoFormat) return parseInt(e) > 999 || parseInt(e) < -999 ? e.toString().replace(".", a).replace(/\B(?=(\d{3})+(?!\d))/g, n) : e.toString().replace(".", a);

mhamano commented 7 years ago

Hi, I have fixed the formatting for negative values. Thank you for your cooperation!