简体   繁体   English

Jmeter:格式化统计数据在HTML报表中有逗号

[英]Jmeter: format statistics data to have comma in HTML report

Is there a way to transform the statistics data to have comma (,) instead of dot (.) in the generated HTML report.有没有办法在生成的 HTML 报告中将统计数据转换为逗号 (,) 而不是点 (.)。

Like for the data in the attached image.就像附加图像中的数据一样。

来自Jmeter的统计数据

This is not something you can customize via JMeter Properties , you will have to do some JavaScript programming (not very complex thought)这不是你可以通过 JMeter Properties 自定义的东西,你将不得不做一些JavaScript编程(不是很复杂的想法)

  1. Locate dashboard.js.fmkr file under report-template\content\js folder (lives in "bin" folder of your JMeter installation)report-template\content\js文件夹下找到dashboard.js.fmkr文件(位于 JMeter 安装的“bin”文件夹中)

  2. You will need to change 2 lines, as of JMeter 5.4.1 they are:您将需要更改 2 行,从 JMeter 5.4.1 开始,它们是:

    • Line # 194 which looks like: item = item.toFixed(2) + '%'; 第 194 行看起来像: item = item.toFixed(2) + '%'; , you need to change it to: ,您需要将其更改为:

       item = item.toFixed(2).toString().replace('.', ',') + '%';
    • Line # 213 which looks like: item = item.toFixed(2); 第 213 行看起来像: item = item.toFixed(2); , similarly change it to: ,同样改成:

       item = item.toFixed(2).toString().replace('.', ',')

Regenerate the dashboard and you should see the commas instead of dots. 重新生成仪表板,您应该看到逗号而不是点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM