I'm currently working on a project in which I need to show pre-designed diagrams inside multiple panels of a Dashboard Layout. I do this by inserting a diagram from an Observable Collection into a PanelModel's content on creation, and then loading the diagram onto the panel from a JSON file, like so:
Creating the panel:
PanelModel panelModel = new PanelModel();
panelModel.Content = @<div style="height:100%; width:100%">
<SfDiagram @ref="DiagramCollection[diagramIndex]">
<
/SfDiagram>
</div>;
await dashboardObject.AddPanel(panelModel);
Loading the JSON file:
string json = System.IO.File.ReadAllText("wwwroot/Diagrams/DemoDiagram.json");
DiagramCollection[diagramIndex].LoadDiagram(json);
Now, this seems to be working fine. The problem is, that the Diagram shown in the panel needs to be disabled to the user, i.e. the user should not be able to modify the Diagram in any way.
I know that you can set the Diagram Constraints to "None", but the Constraints in the JSON file are set to "Default", as it comes directly from where you CAN change the Diagram, and I can't seem to directly change the Diagram's Constraint because it's a Blazor Parameter. I've tried connecting the Diagram Constraints to an outside variable when I create the PanelModel:
panelModel.Content = @<div style="height:100%; width:100%">
<SfDiagram @ref=DiagramCollection[diagramIndex]" Constraints="_constraints">
</SfDiagram>
</div
But it doesn't seem to work.
How should I do this?