Skip to content

Export "Employee Competency Assessment" to Excel with Java (Chart & Visualization)

JQuick-ExcelChart & Visualization

Chart & VisualizationScene 0109

Scores for three employees across four dimensions (Technical / Communication / Collaboration / Execution), computing each person's average in the last row; includes a radar chart showing the competency profile. All statistics and charts are declared in XML. Exported as a multi-sheet workbook (Employee Competency Assessment / Employee Competency Radar Chart). Implemented declaratively in pure XML — no Java business code required.

Download the Excel fileView raw XML configBack to all demos

Employee Competency Assessment — Chart & Visualization
Full screenshot of the exported xlsx

About this demo

This demo exports the "Employee Competency Assessment" workbook: 1 data sheet(s); MAPPING over 4 columns (维度, 张三, 李四, 王五), 6 formula(s), 1 style rule(s), RADAR chart on its own sheet. On the Java side it builds 5 data rows and calls exportEmployeeSkillRadar() once — everything else is driven by the config.

It belongs to the "Chart & Visualization" group: GRAPH charts — column, line, scatter and radar charts written into a separate sheet, making the workbook multi-sheet.

What you can copy from this page

  • The complete Java test class (60 lines, runnable as-is)
  • The complete XML config (35 lines: mapping, formulas, styles, charts and every other rule)
  • The exported xlsx file (real output, comparable with the preview above)

Related searches: Java export Excel chart, Java generate Excel line chart, Apache POI chart export example, Java multi-sheet workbook export, export Employee Competency Assessment to Excel with Java

Output specs

Scene no.
0109
Group
Chart & Visualization
Config lines
35
Source lines
60

Java source · Graph0109EmployeeSkillRadarDemo.java

This is the complete test class that produced the Excel file above — copy it and run as-is. Java only builds the data rows; all statistics and styling live in the XML config.

package com.github.paohaijiao.biz.graph;

import com.github.paohaijiao.statement.JQuickRow;
import com.github.paohaijiao.xml.ex.JQuickExcelExportXmlParseFactory;
import com.github.paohaijiao.xml.factory.JQuickFactory;
import com.github.paohaijiao.xml.factory.JQuickXmlFactory;
import com.github.paohaijiao.xml.handler.JQuickParseHandler;
import org.junit.Test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

public class Graph0109EmployeeSkillRadarDemo {

    private static final String XML = "jquick/biz/graph/0109_graph_employee-skill-radar.xml";

    /** 导出:4 个维度 + 1 行平均 + 雷达图,回读校验平均分与图表 sheet。 */
    @Test
    public void exportEmployeeSkillRadar() throws Exception {
        List<JQuickRow> rows = new ArrayList<>();
        rows.add(detail("技术", 85, 75, 90));
        rows.add(detail("沟通", 70, 90, 80));
        rows.add(detail("协作", 90, 80, 85));
        rows.add(detail("执行", 80, 85, 88));
        rows.add(averageRow());

        File out = new File("D:/test/excel/biz/graph/0109_graph_employee-skill-radar.xlsx");
        try (OutputStream os = new FileOutputStream(out)) {
            JQuickParseHandler parser = new JQuickExcelExportXmlParseFactory("crimsonRed", rows, os);
            JQuickFactory factory = new JQuickXmlFactory(parser, XML);
            Graph0109EmployeeSkillRadarService service = factory.createApi(Graph0109EmployeeSkillRadarService.class);
            service.exportEmployeeSkillRadar("field", "value");
        }

    }

    /** 构造一条维度明细(平均分由 FORMULAS 计算,此处不写)。 */
    private static JQuickRow detail(String dimension, double zhangsan, double lisi, double wangwu) {
        JQuickRow row = new JQuickRow();
        row.put("a", dimension);
        row.put("b", zhangsan);
        row.put("c", lisi);
        row.put("d", wangwu);
        return row;
    }

    /** 平均行:只写「平均」文字,其余列以空值占位(值由 XML FORMULAS 计算)。 */
    private static JQuickRow averageRow() {
        JQuickRow row = new JQuickRow();
        row.put("a", "平均");
        row.put("b", null);
        row.put("c", null);
        row.put("d", null);
        return row;
    }
}

Minimal invocation (4 lines)

The core is these four lines: hand the rows to the parser, the parser to the factory, get a typed Service and call it. Copy them straight into your project.

// rows 由业务代码构造(List<JQuickRow>),os 为输出流,见下方完整源码
JQuickParseHandler parser = new JQuickExcelExportXmlParseFactory("crimsonRed", rows, os);
JQuickFactory factory = new JQuickXmlFactory(parser, XML);
Graph0109EmployeeSkillRadarService service = factory.createApi(Graph0109EmployeeSkillRadarService.class);

XML config · 0109_graph_employee-skill-radar.xml

Formats (FORMAT), formulas (FORMULAS) and styles (STYLE) are all declared in this XML, fully decoupled from the Java code. The full config is below — copy it as-is.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE excels PUBLIC "-//PAOHAIJIAO//DTD API EXCEL 1.0//EN"
        "classpath:paohaijiao/dtd/Jquick-excel.dtd">
<excels namespace="com.github.paohaijiao.biz.graph.Graph0109EmployeeSkillRadarService">

    <!-- 导出:员工能力评估 -->
    <excel name="exportEmployeeSkillRadar" returnClass="void">
        <![CDATA[
            EXPORT WITH SHEET="员工能力评估", HEADER=true,
                MAPPING={"a":"维度","b":"张三","c":"李四","d":"王五"},
                FORMAT={"b":"0.00","c":"0.00","d":"0.00"},
                FORMULAS={
                    B6:'AVERAGE(B2:B5)',C6:'AVERAGE(C2:C5)',D6:'AVERAGE(D2:D5)'
                },
                STYLE={ROW 6:{bold:true,fillPattern:solid_foreground,fillForegroundColor:lightYellow,alignment:right,verticalAlignment:center}},
                GRAPH={TYPE=RADAR, TITLE="员工能力雷达图", CATEGORY_AXIS=维度, VALUE_AXIS=分数,
                       CATEGORIES=["技术","沟通","协作","执行"],
                       SERIES=[
                           {NAME=张三, DATA=[85,70,90,80]},
                           {NAME=李四, DATA=[75,90,80,85]},
                           {NAME=王五, DATA=[90,80,85,88]}
                       ]}
        ]]>
    </excel>

    <!-- 导入解析:读取导出的员工能力评估 -->
    <excel name="importEmployeeSkillRadar" returnClass="java.util.List">
        <![CDATA[
            IMPORT WITH SHEET="员工能力评估", HEADER=true,
                MAPPING={"维度":"dimension","张三":"zhangsan","李四":"lisi","王五":"wangwu"}
        ]]>
    </excel>

</excels>

More demos in this group

The Excel file, preview image, XML config and source code on this page were all produced by a real JQuick-Excel run and are free to copy into your own project.