| 141 | function ytickformatter (ddata, axisidx) { |
---|
| 142 | return function(val,axis) { |
---|
| 143 | for(var i=0; i<ddata.length; i++) { |
---|
| 144 | if(ddata[i].yaxis == axisidx && |
---|
| 145 | ddata[i].reconnoiter_display_expression) { |
---|
| 146 | var meta = { _max: Math.max(Math.abs(axis.datamax), |
---|
| 147 | Math.abs(axis.datamin)), |
---|
| 148 | // for delta calc, we don't want to |
---|
| 149 | // lose precision |
---|
| 150 | floor: ['.'], ciel: ['.'], round: ['~','.'] |
---|
| 151 | }, |
---|
| 152 | pval = rpn_eval(val, ddata[i].reconnoiter_display_expression, meta); |
---|
| 153 | if((val > 0 && pval < 0) || |
---|
| 154 | (val < 0 && pval > 0)) { |
---|
| 155 | // Sign inversion means we're being clever and using |
---|
| 156 | // the negative axis as a positive one. |
---|
| 157 | pval = Math.abs(pval); |
---|
| 158 | } |
---|
| 159 | return pval.toFixed(axis.tickDecimals) + |
---|
| 160 | ((meta.suffix != null) ? meta.suffix : ''); |
---|
| 161 | } |
---|
| 162 | } |
---|
| 163 | return val.toFixed(axis.tickDecimals); |
---|
| 164 | } |
---|
| 165 | } |
---|
| 166 | |
---|
335 | | r.options.yaxis.tickFormatter = function (val, axis) { |
---|
336 | | for(var i=0; i<ddata.length; i++) { |
---|
337 | | if(ddata[i].yaxis == 1 && |
---|
338 | | ddata[i].reconnoiter_display_expression) { |
---|
339 | | var meta = { _max: Math.max(Math.abs(axis.datamax), |
---|
340 | | Math.abs(axis.datamin)), |
---|
341 | | // for delta calc, we don't want to |
---|
342 | | // lose precision |
---|
343 | | floor: ['.'], ciel: ['.'], round: ['~','.'] |
---|
344 | | }, |
---|
345 | | pval = rpn_eval(val, ddata[i].reconnoiter_display_expression, meta); |
---|
346 | | if((val > 0 && pval < 0) || |
---|
347 | | (val < 0 && pval > 0)) { |
---|
348 | | // Sign inversion means we're being clever and using |
---|
349 | | // the negative axis as a positive one. |
---|
350 | | pval = Math.abs(pval); |
---|
351 | | } |
---|
352 | | return pval.toFixed(axis.tickDecimals) + |
---|
353 | | ((meta.suffix != null) ? meta.suffix : ''); |
---|
354 | | } |
---|
355 | | } |
---|
356 | | return val.toFixed(axis.tickDecimals); |
---|
357 | | }; |
---|
| 368 | r.options.yaxis.tickFormatter = ytickformatter(ddata, 1); |
---|
| 369 | if(!r.options.y2axis) r.options.y2axis = {}; |
---|
| 370 | r.options.y2axis.tickFormatter = ytickformatter(ddata, 2); |
---|