Skip to content

XYChart Config Schema ​

txt
https://mermaid.js.org/schemas/config.schema.json#/$defs/XYChartConfig

此对象包含特定于 XYCharts 的配置

AbstractExtensibleStatusIdentifiableCustom PropertiesAdditional PropertiesAccess RestrictionsDefined In
Can be instantiatedNoUnknown statusNoForbiddenAllowednoneconfig.schema.json*

XYChartConfig Type ​

object (XYChart Config)

all of

XYChartConfig Properties ​

PropertyTypeRequiredNullableDefined by
widthnumberRequiredcannot be nullMermaid Config
heightnumberRequiredcannot be nullMermaid Config
titleFontSizenumberRequiredcannot be nullMermaid Config
titlePaddingnumberRequiredcannot be nullMermaid Config
showDataLabelbooleanOptionalcannot be nullMermaid Config
showDataLabelOutsideBarbooleanOptionalcannot be nullMermaid Config
showTitlebooleanRequiredcannot be nullMermaid Config
showLegendbooleanOptionalcannot be nullMermaid Config
legendFontSizenumberOptionalcannot be nullMermaid Config
legendPaddingnumberOptionalcannot be nullMermaid Config
xAxisobjectRequiredcannot be nullMermaid Config
yAxisobjectRequiredcannot be nullMermaid Config
chartOrientationNot specifiedRequiredcannot be nullMermaid Config
plotReservedSpacePercentnumberRequiredcannot be nullMermaid Config

width ​

图表的宽度

width

width Type ​

number

width Constraints ​

minimum: the value of this number must greater than or equal to: 1

width Default Value ​

The default value is:

json
700

height ​

图表的高度

height

height Type ​

number

height Constraints ​

minimum: the value of this number must greater than or equal to: 1

height Default Value ​

The default value is:

json
500

titleFontSize ​

图表标题的字体大小

titleFontSize

titleFontSize Type ​

number

titleFontSize Constraints ​

minimum: the value of this number must greater than or equal to: 1

titleFontSize Default Value ​

The default value is:

json
20

titlePadding ​

图表标题的顶部和底部空间

titlePadding

titlePadding Type ​

number

titlePadding Constraints ​

minimum: the value of this number must greater than or equal to: 0

titlePadding Default Value ​

The default value is:

json
10

showDataLabel ​

应在栏内显示与栏对应的值

showDataLabel

showDataLabel Type ​

boolean

showDataLabel Default Value ​

The default value is:

json
false

showDataLabelOutsideBar ​

如果显示数据标签,则将其显示在条形外部

showDataLabelOutsideBar

showDataLabelOutsideBar Type ​

boolean

showDataLabelOutsideBar Default Value ​

The default value is:

json
false

showTitle ​

应显示图表标题

showTitle

showTitle Type ​

boolean

showTitle Default Value ​

The default value is:

json
true

showLegend ​

应该为命名的图表显示图例

showLegend

showLegend Type ​

boolean

showLegend Default Value ​

The default value is:

json
true

legendFontSize ​

图例文本的字体大小

legendFontSize

legendFontSize Type ​

number

legendFontSize Constraints ​

minimum: the value of this number must greater than or equal to: 1

legendFontSize Default Value ​

The default value is:

json
14

legendPadding ​

图例周围的间距

legendPadding

legendPadding Type ​

number

legendPadding Constraints ​

minimum: the value of this number must greater than or equal to: 0

legendPadding Default Value ​

The default value is:

json
10

xAxis ​

此对象包含 XYChart 轴配置的配置

xAxis

xAxis Type ​

object (XYChart axis config)

xAxis Default Value ​

The default value is:

json
{
  "$ref": "#/$defs/XYChartAxisConfig",
  "title": "XYChart axis config",
  "description": "此对象包含 XYChart 轴配置的配置",
  "type": "object",
  "unevaluatedProperties": true,
  "required": [
    "showLabel",
    "labelFontSize",
    "labelPadding",
    "showTitle",
    "titleFontSize",
    "titlePadding",
    "showTick",
    "tickLength",
    "tickWidth",
    "showAxisLine",
    "axisLineWidth",
    "labelRotation"
  ],
  "properties": {
    "showLabel": {
      "description": "应显示轴标签(刻度文本)",
      "type": "boolean",
      "default": true
    },
    "labelFontSize": {
      "description": "轴标签的字体大小(刻度文本)",
      "type": "number",
      "default": 14,
      "minimum": 1
    },
    "labelPadding": {
      "description": "轴标签(刻度文本)的顶部和底部空间",
      "type": "number",
      "default": 5,
      "minimum": 0
    },
    "showTitle": {
      "description": "应显示轴标题",
      "type": "boolean",
      "default": true
    },
    "titleFontSize": {
      "description": "轴标题的字体大小",
      "type": "number",
      "default": 16,
      "minimum": 1
    },
    "titlePadding": {
      "description": "轴标题的顶部和底部空间",
      "type": "number",
      "default": 5,
      "minimum": 0
    },
    "showTick": {
      "description": "应显示轴刻度线",
      "type": "boolean",
      "default": true
    },
    "tickLength": {
      "description": "轴刻度线的长度",
      "type": "number",
      "default": 5,
      "minimum": 1
    },
    "tickWidth": {
      "description": "轴刻度线的宽度",
      "type": "number",
      "default": 2,
      "minimum": 1
    },
    "showAxisLine": {
      "description": "显示跨轴线",
      "type": "boolean",
      "default": true
    },
    "axisLineWidth": {
      "description": "轴线的宽度",
      "type": "number",
      "default": 2,
      "minimum": 1
    },
    "labelRotation": {
      "description": "标签旋转角度",
      "type": "number",
      "default": 0,
      "minimum": -90,
      "maximum": 90
    }
  }
}

yAxis ​

此对象包含 XYChart 轴配置的配置

yAxis

yAxis Type ​

object (XYChart axis config)

yAxis Default Value ​

The default value is:

json
{
  "$ref": "#/$defs/XYChartAxisConfig",
  "title": "XYChart axis config",
  "description": "此对象包含 XYChart 轴配置的配置",
  "type": "object",
  "unevaluatedProperties": true,
  "required": [
    "showLabel",
    "labelFontSize",
    "labelPadding",
    "showTitle",
    "titleFontSize",
    "titlePadding",
    "showTick",
    "tickLength",
    "tickWidth",
    "showAxisLine",
    "axisLineWidth",
    "labelRotation"
  ],
  "properties": {
    "showLabel": {
      "description": "应显示轴标签(刻度文本)",
      "type": "boolean",
      "default": true
    },
    "labelFontSize": {
      "description": "轴标签的字体大小(刻度文本)",
      "type": "number",
      "default": 14,
      "minimum": 1
    },
    "labelPadding": {
      "description": "轴标签(刻度文本)的顶部和底部空间",
      "type": "number",
      "default": 5,
      "minimum": 0
    },
    "showTitle": {
      "description": "应显示轴标题",
      "type": "boolean",
      "default": true
    },
    "titleFontSize": {
      "description": "轴标题的字体大小",
      "type": "number",
      "default": 16,
      "minimum": 1
    },
    "titlePadding": {
      "description": "轴标题的顶部和底部空间",
      "type": "number",
      "default": 5,
      "minimum": 0
    },
    "showTick": {
      "description": "应显示轴刻度线",
      "type": "boolean",
      "default": true
    },
    "tickLength": {
      "description": "轴刻度线的长度",
      "type": "number",
      "default": 5,
      "minimum": 1
    },
    "tickWidth": {
      "description": "轴刻度线的宽度",
      "type": "number",
      "default": 2,
      "minimum": 1
    },
    "showAxisLine": {
      "description": "显示跨轴线",
      "type": "boolean",
      "default": true
    },
    "axisLineWidth": {
      "description": "轴线的宽度",
      "type": "number",
      "default": 2,
      "minimum": 1
    },
    "labelRotation": {
      "description": "标签旋转角度",
      "type": "number",
      "default": 0,
      "minimum": -90,
      "maximum": 90
    }
  }
}

chartOrientation ​

如何绘制水平或垂直图形

chartOrientation

  • is required

  • Type: unknown

  • cannot be null

  • defined in: Mermaid Config

  • tsType: "vertical" | "horizontal"

chartOrientation Type ​

unknown

chartOrientation Default Value ​

The default value is:

json
"vertical"

plotReservedSpacePercent ​

图表占用的空间图的最小百分比

plotReservedSpacePercent

plotReservedSpacePercent Type ​

number

plotReservedSpacePercent Constraints ​

minimum: the value of this number must greater than or equal to: 30

plotReservedSpacePercent Default Value ​

The default value is:

json
50
Opens in mermaid.ai