@liuhange/dsh-data-visualization 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/lib/types/chartRenderers/barChartRenderer.d.ts +8 -0
- package/lib/types/chartRenderers/comparisonChartRenderer.d.ts +8 -0
- package/lib/types/chartRenderers/flowchartRenderer.d.ts +8 -0
- package/lib/types/chartRenderers/pieChartRenderer.d.ts +8 -0
- package/lib/types/chartRenderers/radarChartRenderer.d.ts +8 -0
- package/lib/types/defaultVisualizationConfig.d.ts +3 -0
- package/lib/types/htmlAssembler.d.ts +12 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/interactionScript.d.ts +5 -0
- package/lib/types/invariant.d.ts +3 -0
- package/lib/types/reportDataLoader.d.ts +5 -0
- package/lib/types/templateLoader.d.ts +5 -0
- package/lib/types/types.d.ts +30 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @liuhange/dsh-data-visualization
|
|
2
|
+
|
|
3
|
+
可视化报表插件:生成自包含 HTML 报表,含脱敏统计、清洗对比、资产分布、质量评分、血缘追踪五种交互式图表。
|
|
4
|
+
|
|
5
|
+
## Tool 接口
|
|
6
|
+
|
|
7
|
+
### `generate_visualization`
|
|
8
|
+
|
|
9
|
+
读取各插件 JSON 报告,生成自包含 HTML 可视化报表。
|
|
10
|
+
|
|
11
|
+
**参数:**
|
|
12
|
+
- `reportPaths` (string, 必填): JSON 格式的报告路径对象 `{masking, cleaning, inventory, quality, lineage}`
|
|
13
|
+
- `outputPath` (string, 必填): HTML 报表输出路径
|
|
14
|
+
|
|
15
|
+
**输出:**
|
|
16
|
+
- `visualization_report.html`: 自包含 HTML 报表(断网可独立打开)
|
|
17
|
+
|
|
18
|
+
## 图表类型
|
|
19
|
+
|
|
20
|
+
| 图表 | 说明 | 数据来源 |
|
|
21
|
+
|------|------|---------|
|
|
22
|
+
| 柱状图 | 脱敏各字段统计 | 脱敏报告 JSON |
|
|
23
|
+
| 对比图 | 清洗前后数据量对比 | 清洗报告 JSON |
|
|
24
|
+
| 饼图 | 数据资产分类分布 | 盘点报告 JSON |
|
|
25
|
+
| 雷达图 | 质量评分多维度展示 | 质量评分 JSON |
|
|
26
|
+
| 流程图 | 血缘追踪可视化 | 血缘 JSON |
|
|
27
|
+
|
|
28
|
+
## 配置节点
|
|
29
|
+
|
|
30
|
+
`business-rules.json` → `visualization` 节点。缺失时使用默认模板(2列网格、默认配色、交互全启用)。
|
|
31
|
+
|
|
32
|
+
## 特性
|
|
33
|
+
|
|
34
|
+
- 自包含 HTML:所有 CSS/JS 内联,无外部依赖,断网可打开
|
|
35
|
+
- 交互式:支持展开/折叠详情、切换图表类型
|
|
36
|
+
- 容错:部分 JSON 缺失时对应图表显示占位符,其他图表正常
|
|
37
|
+
- 配置化:图表配置/布局/配色从配置文件读取
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChartRenderResult } from '../types.js';
|
|
2
|
+
import type { VisualizationConfig } from '@liuhange/dsh-data-asset-shared';
|
|
3
|
+
export declare class BarChartRenderer {
|
|
4
|
+
render(data: unknown, config: VisualizationConfig): ChartRenderResult;
|
|
5
|
+
private extractCounts;
|
|
6
|
+
private placeholder;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=barChartRenderer.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChartRenderResult } from '../types.js';
|
|
2
|
+
import type { VisualizationConfig } from '@liuhange/dsh-data-asset-shared';
|
|
3
|
+
export declare class ComparisonChartRenderer {
|
|
4
|
+
render(data: unknown, config: VisualizationConfig): ChartRenderResult;
|
|
5
|
+
private extractData;
|
|
6
|
+
private placeholder;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=comparisonChartRenderer.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChartRenderResult } from '../types.js';
|
|
2
|
+
import type { VisualizationConfig } from '@liuhange/dsh-data-asset-shared';
|
|
3
|
+
export declare class FlowchartRenderer {
|
|
4
|
+
render(data: unknown, config: VisualizationConfig): ChartRenderResult;
|
|
5
|
+
private extractData;
|
|
6
|
+
private placeholder;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=flowchartRenderer.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChartRenderResult } from '../types.js';
|
|
2
|
+
import type { VisualizationConfig } from '@liuhange/dsh-data-asset-shared';
|
|
3
|
+
export declare class PieChartRenderer {
|
|
4
|
+
render(data: unknown, config: VisualizationConfig): ChartRenderResult;
|
|
5
|
+
private extractData;
|
|
6
|
+
private placeholder;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=pieChartRenderer.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChartRenderResult } from '../types.js';
|
|
2
|
+
import type { VisualizationConfig } from '@liuhange/dsh-data-asset-shared';
|
|
3
|
+
export declare class RadarChartRenderer {
|
|
4
|
+
render(data: unknown, config: VisualizationConfig): ChartRenderResult;
|
|
5
|
+
private extractData;
|
|
6
|
+
private placeholder;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=radarChartRenderer.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VisualizationConfig } from '@liuhange/dsh-data-asset-shared';
|
|
2
|
+
import type { ChartRenderResult } from './types.js';
|
|
3
|
+
export interface HtmlAssembleInput {
|
|
4
|
+
charts: ChartRenderResult[];
|
|
5
|
+
config: VisualizationConfig;
|
|
6
|
+
reportData: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare class HtmlAssembler {
|
|
9
|
+
private interactionScript;
|
|
10
|
+
assemble(input: HtmlAssembleInput): string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=htmlAssembler.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ChartType = 'bar' | 'comparison' | 'pie' | 'radar' | 'flowchart';
|
|
2
|
+
export interface GenerateVisualizationParams {
|
|
3
|
+
reportPaths: {
|
|
4
|
+
masking?: string;
|
|
5
|
+
cleaning?: string;
|
|
6
|
+
inventory?: string;
|
|
7
|
+
quality?: string;
|
|
8
|
+
lineage?: string;
|
|
9
|
+
};
|
|
10
|
+
outputPath: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ChartRenderResult {
|
|
13
|
+
type: ChartType;
|
|
14
|
+
title: string;
|
|
15
|
+
svgContent: string;
|
|
16
|
+
dataAvailable: boolean;
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface GenerateVisualizationResult {
|
|
20
|
+
htmlPath: string;
|
|
21
|
+
chartCount: number;
|
|
22
|
+
chartsRendered: string[];
|
|
23
|
+
status: 'SUCCESS' | 'FAILED';
|
|
24
|
+
configStatus: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ReportDataLoadResult {
|
|
27
|
+
data: unknown;
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@liuhange/dsh-data-visualization",
|
|
3
|
+
"description": "Data visualization plugin: generate self-contained HTML reports with interactive charts (bar/comparison/pie/radar/flowchart)",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/liuhange789/data-asset-inspector.git",
|
|
11
|
+
"directory": "packages/data-asset/data-visualization"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./src/*": "./src/*",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib/index.js",
|
|
30
|
+
"lib/invariant.js",
|
|
31
|
+
"lib/types/**/*.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@deepseek-ai/cordis": "^0.1.0",
|
|
36
|
+
"@deepseek-ai/dsh-tools": "^0.1.0",
|
|
37
|
+
"@liuhange/dsh-data-asset-shared": "^2.0.0"
|
|
38
|
+
}
|
|
39
|
+
}
|