zcbot/software-contracts/origin.plot.v2.json

538 lines
19 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"capability": "origin.plot@v2",
"display_name": "Origin 科研绘图",
"default_enrollment": true,
"output_namespace": "origin",
"input_policy": {
"suffixes": [".csv", ".xlsx", ".json"],
"max_count": 16,
"max_bytes": 104857600,
"max_total_bytes": 536870912
},
"outputs": {
"project": {
"filename": "project.opju",
"media_type": "application/x-origin-project",
"relative_path": "project.opju",
"publish": true,
"required": false
},
"figure_png": {
"filename": "figure.png",
"media_type": "image/png",
"relative_path": "figure.png",
"publish": true,
"required": false
},
"figure_svg": {
"filename": "figure.svg",
"media_type": "image/svg+xml",
"relative_path": "figure.svg",
"publish": true,
"required": false
},
"figure_pdf": {
"filename": "figure.pdf",
"media_type": "application/pdf",
"relative_path": "figure.pdf",
"publish": true,
"required": false
},
"plot_spec": {
"filename": "plot-spec.json",
"media_type": "application/json",
"relative_path": ".meta/plot-spec.json",
"publish": false,
"required": true
},
"provenance": {
"filename": "provenance.json",
"media_type": "application/json",
"relative_path": ".meta/provenance.json",
"publish": false,
"required": true
}
},
"feature_path": ["operation", "plot", "type"],
"features": {
"line": "0.5.0",
"scatter": "0.5.0",
"line_scatter": "0.5.0",
"column": "0.5.0",
"bar": "0.5.0",
"grouped_column": "0.5.0",
"y_error": "0.5.0",
"contour": "0.5.0",
"surface_3d": "0.5.0",
"ternary": "0.5.0",
"heatmap": "0.5.0",
"multi_panel": "0.8.1",
"recipe": "0.9.0",
"box": "0.7.0",
"histogram": "0.7.0",
"stacked_column": "0.7.0",
"bubble": "0.7.0",
"band": "0.7.0",
"area": "0.8.0",
"stacked_area": "0.8.0",
"polar": "0.8.0",
"pie": "0.8.0",
"stacked_bar": "0.8.0"
},
"summary": {
"title_path": ["operation", "plot", "title"]
},
"legacy_runtime": {
"detail_path": ["origin"],
"slots_path": ["available_slots"],
"assumed_adapter_version": "0.3.0"
},
"request_schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"x-maxBytes": 262144,
"required": ["schema_version", "inputs", "operation", "outputs"],
"additionalProperties": false,
"properties": {
"schema_version": {"const": 2},
"inputs": {
"type": "array",
"minItems": 1,
"maxItems": 16,
"items": {
"type": "object",
"required": ["key", "artifact_id"],
"additionalProperties": false,
"properties": {
"key": {"type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$"},
"artifact_id": {"type": "string", "format": "uuid"},
"selector": {
"type": "object",
"required": ["sheet"],
"additionalProperties": false,
"properties": {
"sheet": {"type": "string", "minLength": 1, "maxLength": 128}
}
}
}
}
},
"operation": {
"type": "object",
"required": ["plot"],
"additionalProperties": false,
"properties": {
"plot": {
"type": "object",
"required": ["type"],
"additionalProperties": false,
"properties": {
"type": {
"enum": [
"line", "scatter", "line_scatter", "column", "bar",
"grouped_column", "y_error", "contour", "surface_3d",
"ternary", "heatmap", "multi_panel", "recipe", "box", "histogram",
"stacked_column", "bubble", "band", "area",
"stacked_area", "polar", "pie", "stacked_bar"
]
},
"series": {
"type": "array",
"minItems": 1,
"maxItems": 16,
"uniqueItems": true,
"items": {
"type": "object",
"required": ["input"],
"additionalProperties": false,
"properties": {
"input": {"type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$"},
"x": {"type": "string", "minLength": 1, "maxLength": 128},
"y": {"type": "string", "minLength": 1, "maxLength": 128},
"z": {"type": "string", "minLength": 1, "maxLength": 128},
"size": {"type": "string", "minLength": 1, "maxLength": 128},
"lower": {"type": "string", "minLength": 1, "maxLength": 128},
"upper": {"type": "string", "minLength": 1, "maxLength": 128},
"y_error": {"type": "string", "minLength": 1, "maxLength": 128},
"label": {"type": "string", "minLength": 1, "maxLength": 200},
"style": {"$ref": "#/$defs/series_style"}
}
}
},
"layout": {
"type": "object",
"required": ["rows", "columns"],
"additionalProperties": false,
"properties": {
"rows": {"type": "integer", "minimum": 1, "maximum": 2},
"columns": {"type": "integer", "minimum": 1, "maximum": 2},
"share_x": {"type": "boolean"},
"share_y": {"type": "boolean"}
}
},
"panels": {
"type": "array",
"minItems": 1,
"maxItems": 4,
"items": {"$ref": "#/$defs/panel"}
},
"recipe_version": {"const": 1},
"template": {"const": "publication_double_column"},
"title": {"type": "string", "maxLength": 500},
"title_style": {"$ref": "#/$defs/text_style"},
"canvas": {
"type": "object",
"required": ["width_mm", "height_mm"],
"additionalProperties": false,
"properties": {
"width_mm": {"type": "number", "minimum": 40, "maximum": 1000},
"height_mm": {"type": "number", "minimum": 40, "maximum": 1000}
}
},
"x_axis": {"$ref": "#/$defs/axis"},
"y_axis": {"$ref": "#/$defs/axis"},
"z_axis": {"$ref": "#/$defs/axis"},
"legend": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {"type": "boolean"},
"position": {
"enum": ["auto", "top_left", "top_right", "bottom_left", "bottom_right"],
"description": "图例位置auto 由 Origin 根据当前数据和图层空间智能定位。"
},
"font_size": {"type": "number", "minimum": 6, "maximum": 72}
}
},
"error_bars": {"type": "null"}
},
"allOf": [
{
"if": {"properties": {"type": {"enum": ["multi_panel", "recipe"]}}},
"then": {
"required": ["layout", "panels"],
"not": {"required": ["series"]}
},
"else": {
"required": ["series"],
"not": {
"anyOf": [
{"required": ["layout"]},
{"required": ["panels"]}
]
}
}
},
{
"if": {"properties": {"type": {"const": "recipe"}}},
"then": {"required": ["recipe_version"]},
"else": {"not": {"required": ["recipe_version"]}}
},
{
"if": {"properties": {"type": {"enum": ["contour", "surface_3d", "ternary", "heatmap"]}}},
"then": {
"properties": {
"series": {
"maxItems": 1,
"items": {
"required": ["input", "x", "y", "z"],
"not": {"anyOf": [
{"required": ["y_error"]}, {"required": ["size"]},
{"required": ["lower"]}, {"required": ["upper"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"const": "y_error"}}},
"then": {
"properties": {
"series": {
"items": {
"required": ["input", "x", "y", "y_error"],
"not": {"anyOf": [
{"required": ["z"]}, {"required": ["size"]},
{"required": ["lower"]}, {"required": ["upper"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"const": "grouped_column"}}},
"then": {
"properties": {
"series": {
"minItems": 2,
"items": {
"required": ["input", "x", "y"],
"not": {"anyOf": [
{"required": ["z"]}, {"required": ["y_error"]},
{"required": ["size"]}, {"required": ["lower"]},
{"required": ["upper"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"enum": [
"line", "scatter", "line_scatter", "column", "bar",
"area", "polar", "pie"
]}}},
"then": {
"properties": {
"series": {
"items": {
"required": ["input", "x", "y"],
"not": {"anyOf": [
{"required": ["z"]}, {"required": ["y_error"]},
{"required": ["size"]}, {"required": ["lower"]},
{"required": ["upper"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"enum": ["box", "histogram"]}}},
"then": {
"properties": {
"series": {
"items": {
"required": ["input", "y"],
"not": {"anyOf": [
{"required": ["x"]}, {"required": ["z"]},
{"required": ["y_error"]}, {"required": ["size"]},
{"required": ["lower"]}, {"required": ["upper"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"enum": [
"stacked_column", "stacked_area", "stacked_bar"
]}}},
"then": {
"properties": {
"series": {
"minItems": 2,
"items": {
"required": ["input", "x", "y"],
"not": {"anyOf": [
{"required": ["z"]}, {"required": ["y_error"]},
{"required": ["size"]}, {"required": ["lower"]},
{"required": ["upper"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"const": "bubble"}}},
"then": {
"properties": {
"series": {
"items": {
"required": ["input", "x", "y", "size"],
"not": {"anyOf": [
{"required": ["z"]}, {"required": ["y_error"]},
{"required": ["lower"]}, {"required": ["upper"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"const": "band"}}},
"then": {
"properties": {
"series": {
"items": {
"required": ["input", "x", "y", "lower", "upper"],
"not": {"anyOf": [
{"required": ["z"]}, {"required": ["y_error"]},
{"required": ["size"]}
]}
}
}
}
}
},
{
"if": {"properties": {"type": {"enum": ["polar", "pie"]}}},
"then": {
"not": {"anyOf": [
{"required": ["x_axis"]},
{"required": ["y_axis"]},
{"required": ["z_axis"]}
]}
}
}
]
}
}
},
"outputs": {
"type": "array",
"minItems": 1,
"maxItems": 4,
"uniqueItems": true,
"items": {
"oneOf": [
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "project"},
"type": {"const": "project"},
"format": {"const": "opju"}
}
},
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "figure_png"},
"type": {"const": "figure"},
"format": {"const": "png"},
"options": {
"type": "object",
"required": ["dpi"],
"additionalProperties": false,
"properties": {"dpi": {"type": "integer", "minimum": 72, "maximum": 1200}}
}
}
},
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "figure_svg"},
"type": {"const": "figure"},
"format": {"const": "svg"}
}
},
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "figure_pdf"},
"type": {"const": "figure"},
"format": {"const": "pdf"}
}
}
]
}
}
},
"$defs": {
"axis": {
"type": "object",
"description": "坐标轴设置。使用对数刻度时应根据数据显式提供正数 minimum 和 maximum以保证可复现的显示范围。",
"additionalProperties": false,
"properties": {
"title": {"type": "string"},
"unit": {"type": "string"},
"scale": {"enum": ["linear", "log10", "ln", "log2"]},
"minimum": {"type": "number"},
"maximum": {"type": "number"},
"major_step": {"type": "number", "exclusiveMinimum": 0},
"tick_label_angle": {"type": "number", "minimum": -180, "maximum": 180},
"tick_label_font_size": {"type": "number", "minimum": 6, "maximum": 72},
"title_font_size": {"type": "number", "minimum": 6, "maximum": 72},
"grid": {"enum": ["none", "major", "major_minor"]}
}
},
"text_style": {
"type": "object",
"additionalProperties": false,
"properties": {
"font_size": {"type": "number", "minimum": 6, "maximum": 72}
}
},
"series_style": {
"type": "object",
"additionalProperties": false,
"properties": {
"color": {"type": "string", "pattern": "^#[0-9A-Fa-f]{6}$"},
"line_width": {"type": "number", "minimum": 0.1, "maximum": 20},
"line_style": {"enum": ["solid", "dash", "dot", "dash_dot", "dash_dot_dot"]},
"symbol": {"enum": ["circle", "square", "triangle_up", "diamond", "cross", "plus"]},
"symbol_size": {"type": "number", "minimum": 1, "maximum": 100},
"transparency": {"type": "integer", "minimum": 0, "maximum": 100}
}
},
"panel_series": {
"type": "object",
"required": ["input", "x", "y", "kind"],
"additionalProperties": false,
"properties": {
"input": {"type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$"},
"x": {"type": "string", "minLength": 1, "maxLength": 128},
"y": {"type": "string", "minLength": 1, "maxLength": 128},
"x_error": {"type": "string", "minLength": 1, "maxLength": 128},
"y_error": {"type": "string", "minLength": 1, "maxLength": 128},
"kind": {"enum": ["line", "scatter", "line_scatter", "column", "bar"]},
"y_axis": {"enum": ["left", "right"]},
"label": {"type": "string", "minLength": 1, "maxLength": 200},
"style": {"$ref": "#/$defs/series_style"}
}
},
"panel": {
"type": "object",
"required": ["key", "series"],
"additionalProperties": false,
"properties": {
"key": {"type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$"},
"series": {
"type": "array",
"minItems": 1,
"maxItems": 16,
"uniqueItems": true,
"items": {"$ref": "#/$defs/panel_series"}
},
"panel_label": {"type": "string", "minLength": 1, "maxLength": 20},
"title": {
"type": "string",
"maxLength": 500,
"description": "面板上方标题;它不替代 y_axis.title。需要纵轴名称和单位时应同时设置 y_axis。"
},
"title_style": {"$ref": "#/$defs/text_style"},
"x_axis": {"$ref": "#/$defs/axis"},
"y_axis": {
"$ref": "#/$defs/axis",
"description": "左纵轴设置。科研多面板图应显式提供 title 和 unit避免使用数据列名或兼容性回退标题。"
},
"right_y_axis": {"$ref": "#/$defs/axis"},
"legend": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {"type": "boolean"},
"position": {
"enum": ["auto", "top_left", "top_right", "bottom_left", "bottom_right"],
"description": "图例位置auto 由 Origin 根据当前面板数据智能定位。"
},
"font_size": {"type": "number", "minimum": 6, "maximum": 72}
}
}
}
}
}
}
}