增加ChartJson导出导入

This commit is contained in:
monitor1394
2026-03-25 22:46:26 +08:00
parent dcac0f9655
commit 99e56d238a
15 changed files with 2741 additions and 0 deletions

View File

@@ -154,5 +154,25 @@ namespace XCharts.Runtime
}
protected virtual void OnThemeChanged() { }
/// <summary>
/// Export UI component configuration to JSON string.
/// </summary>
[Since("v3.16.0")]
public string ExportToJson(bool prettyPrint = true)
{
return UIComponentJsonSerializer.Serialize(this, prettyPrint);
}
/// <summary>
/// Import JSON and update current UI component configuration.
/// </summary>
[Since("v3.16.0")]
public void ImportFromJson(string json)
{
UIComponentJsonDeserializer.Deserialize(json, this);
RefreshAllComponent();
RefreshGraph();
}
}
}