Commit 2ea6eb0de36d0573a3e17ad2120a9b6230febf68
1 parent
1fc0f18d
Exists in
master
and in
94 other branches
Fix decimal precision in interactive plot (cf. #7939)
Showing
1 changed file
with
9 additions
and
4 deletions
Show diff stats
js/app/views/PlotTabResultUI.js
... | ... | @@ -198,6 +198,11 @@ Ext.define('amdaUI.PlotTabResultUI', { |
198 | 198 | me.contextualMenu.add(insertIntervalItem); |
199 | 199 | } |
200 | 200 | }, |
201 | + | |
202 | + getAxisValue: function(axis, pixelMin, pixelMax, pixelVal) { | |
203 | + var val = amdaPlotComp.PlotContextManager.toAxisValue(axis, pixelMin, pixelMax, pixelVal); | |
204 | + return parseFloat(val).toPrecision(2); | |
205 | + }, | |
201 | 206 | |
202 | 207 | createPlotImage: function(resultFolder, plotFile) { |
203 | 208 | var me = this; |
... | ... | @@ -252,16 +257,16 @@ Ext.define('amdaUI.PlotTabResultUI', { |
252 | 257 | xText = crtTime.toJSON(); |
253 | 258 | break; |
254 | 259 | case 'y-left' : |
255 | - yLeftText = parseFloat(amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos).toFixed(2)); | |
260 | + yLeftText = me.getAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos); | |
256 | 261 | break; |
257 | 262 | case 'y-right' : |
258 | - yRightText = parseFloat(amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos).toFixed(2)); | |
263 | + yRightText = me.getAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos); | |
259 | 264 | break; |
260 | 265 | case 'xaxis_id' : |
261 | - xText = parseFloat(amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos).toFixed(2)); | |
266 | + xText = me.getAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos); | |
262 | 267 | break; |
263 | 268 | case 'epochAxis' : |
264 | - xText = parseFloat(amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos).toFixed(2)); | |
269 | + xText = me.getAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos); | |
265 | 270 | break; |
266 | 271 | } |
267 | 272 | ... | ... |