You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.5 KiB
101 lines
4.5 KiB
package java01;
|
|
|
|
import java.util.Map;
|
|
|
|
public class ResultDisplay {
|
|
|
|
// 控制台输出技能词频统计
|
|
public void displaySkillFrequency(Map<String, Integer> skillFrequency) {
|
|
System.out.println("\n=== 技能词频统计 ===");
|
|
System.out.printf("%-20s %s\n", "技能", "出现次数");
|
|
System.out.println("------------------------");
|
|
|
|
int count = 0;
|
|
for (Map.Entry<String, Integer> entry : skillFrequency.entrySet()) {
|
|
if (count < 20) { // 只显示前20个
|
|
System.out.printf("%-20s %d\n", entry.getKey(), entry.getValue());
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 控制台输出薪资与经验关系
|
|
public void displaySalaryByExperience(Map<String, Double> salaryByExperience) {
|
|
System.out.println("\n=== 薪资与经验关系 ===");
|
|
System.out.printf("%-15s %s\n", "经验", "平均薪资(元)");
|
|
System.out.println("------------------------");
|
|
|
|
for (Map.Entry<String, Double> entry : salaryByExperience.entrySet()) {
|
|
System.out.printf("%-15s %.2f\n", entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
// 控制台输出薪资与学历关系
|
|
public void displaySalaryByEducation(Map<String, Double> salaryByEducation) {
|
|
System.out.println("\n=== 薪资与学历关系 ===");
|
|
System.out.printf("%-15s %s\n", "学历", "平均薪资(元)");
|
|
System.out.println("------------------------");
|
|
|
|
for (Map.Entry<String, Double> entry : salaryByEducation.entrySet()) {
|
|
System.out.printf("%-15s %.2f\n", entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
// 控制台输出不同地点薪资水平
|
|
public void displaySalaryByLocation(Map<String, Double> salaryByLocation) {
|
|
System.out.println("\n=== 不同地点薪资水平 ===");
|
|
System.out.printf("%-15s %s\n", "地点", "平均薪资(元)");
|
|
System.out.println("------------------------");
|
|
|
|
for (Map.Entry<String, Double> entry : salaryByLocation.entrySet()) {
|
|
System.out.printf("%-15s %.2f\n", entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
// 控制台输出薪资分布
|
|
public void displaySalaryDistribution(Map<String, Integer> salaryDistribution) {
|
|
System.out.println("\n=== 薪资分布 ===");
|
|
System.out.printf("%-15s %s\n", "薪资范围", "职位数量");
|
|
System.out.println("------------------------");
|
|
|
|
for (Map.Entry<String, Integer> entry : salaryDistribution.entrySet()) {
|
|
System.out.printf("%-15s %d\n", entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
// 生成技能词频柱状图(控制台文本版本)
|
|
public void generateSkillFrequencyChart(Map<String, Integer> skillFrequency, String fileName) {
|
|
System.out.println("\n=== 技能词频统计图表 ===");
|
|
int count = 0;
|
|
for (Map.Entry<String, Integer> entry : skillFrequency.entrySet()) {
|
|
if (count < 10) {
|
|
System.out.printf("%-20s ", entry.getKey());
|
|
// 用星号表示频率
|
|
for (int i = 0; i < Math.min(entry.getValue(), 50); i++) {
|
|
System.out.print("*");
|
|
}
|
|
System.out.println(" " + entry.getValue());
|
|
count++;
|
|
}
|
|
}
|
|
System.out.println("技能词频图表已生成(文本版本)");
|
|
}
|
|
|
|
// 生成薪资分布饼图(控制台文本版本)
|
|
public void generateSalaryDistributionChart(Map<String, Integer> salaryDistribution, String fileName) {
|
|
System.out.println("\n=== 薪资分布图表 ===");
|
|
for (Map.Entry<String, Integer> entry : salaryDistribution.entrySet()) {
|
|
System.out.printf("%-15s %d\n", entry.getKey(), entry.getValue());
|
|
}
|
|
System.out.println("薪资分布图表已生成(文本版本)");
|
|
}
|
|
|
|
// 生成薪资与经验关系折线图(控制台文本版本)
|
|
public void generateSalaryByExperienceChart(Map<String, Double> salaryByExperience, String fileName) {
|
|
System.out.println("\n=== 薪资与经验关系图表 ===");
|
|
for (Map.Entry<String, Double> entry : salaryByExperience.entrySet()) {
|
|
System.out.printf("%-15s %.2f\n", entry.getKey(), entry.getValue());
|
|
}
|
|
System.out.println("薪资与经验关系图表已生成(文本版本)");
|
|
}
|
|
}
|