1+ @page " /HTMLShape"
2+
3+ @using Syncfusion .Blazor .Diagram
4+
5+ @* Add a Namespace for a Syncfusion<sup style="font-size:70%">®</sup> control used in Diagrm HTML node *@
6+ @using Syncfusion .Blazor .CircularGauge
7+
8+ @* Initialize Diagram with node template *@
9+ <SfDiagramComponent Height =" 600px" Nodes =" @_nodes" >
10+ <DiagramTemplates >
11+ <NodeTemplate >
12+ @{
13+ <SfCircularGauge Width =" 300px" Height =" 300px" >
14+ <CircularGaugeAxes >
15+ <CircularGaugeAxis StartAngle =" 210" EndAngle =" 150" Minimum =" 0" Maximum =" 120" Radius =" 80%" >
16+ <CircularGaugeAxisLineStyle Width =" 10" Color =" transparent" >
17+ </CircularGaugeAxisLineStyle >
18+ <CircularGaugeAxisLabelStyle UseRangeColor =" false" >
19+ <CircularGaugeAxisLabelFont Size =" 12px" FontFamily =" Roboto" FontStyle =" Regular" >
20+ </CircularGaugeAxisLabelFont >
21+ </CircularGaugeAxisLabelStyle >
22+ <CircularGaugeAxisMajorTicks Height =" 10" Offset =" 5" UseRangeColor =" false" >
23+ </CircularGaugeAxisMajorTicks >
24+ <CircularGaugeAxisMinorTicks Height =" 0" Width =" 0" UseRangeColor =" false" >
25+ </CircularGaugeAxisMinorTicks >
26+ <CircularGaugeAnnotations >
27+ <CircularGaugeAnnotation Radius =" 30%" Angle =" 0" ZIndex =" 1" Content =" Speedometer" >
28+ <ContentTemplate >
29+ <div ><span style =" font-size :14px ; color :#9E9E9E ; font-family :Regular; margin-left : -33px " >Speedometer </span ></div >
30+ </ContentTemplate >
31+ </CircularGaugeAnnotation >
32+ <CircularGaugeAnnotation Radius =" 40%" Angle =" 180" ZIndex =" 1" Content =" 65 MPH" >
33+ <ContentTemplate >
34+ <div ><span style =" font-size :20px ; color :#424242 ; font-family :Regular; margin-left : -33px " >65 MPH </span ></div >
35+ </ContentTemplate >
36+ </CircularGaugeAnnotation >
37+ </CircularGaugeAnnotations >
38+ <CircularGaugeRanges >
39+ <CircularGaugeRange Start =" 0" End =" 40" Color =" #30B32D" StartWidth =" 10" EndWidth =" 10" RoundedCornerRadius =" 0" >
40+ </CircularGaugeRange >
41+ <CircularGaugeRange Start =" 40" End =" 80" Color =" #FFDD00" StartWidth =" 10" EndWidth =" 10" RoundedCornerRadius =" 0" >
42+ </CircularGaugeRange >
43+ <CircularGaugeRange Start =" 80" End =" 120" Color =" #F03E3E" StartWidth =" 10" EndWidth =" 10" RoundedCornerRadius =" 0" >
44+ </CircularGaugeRange >
45+ </CircularGaugeRanges >
46+ <CircularGaugePointers >
47+ <CircularGaugePointer Value =" 65" Radius =" 60%" PointerWidth =" 8" >
48+ <CircularGaugePointerAnimation Enable =" true" ></CircularGaugePointerAnimation >
49+ <CircularGaugeCap Radius =" 7" >
50+ </CircularGaugeCap >
51+ <CircularGaugeNeedleTail Length =" 18%" >
52+ </CircularGaugeNeedleTail >
53+ </CircularGaugePointer >
54+ </CircularGaugePointers >
55+ </CircularGaugeAxis >
56+ </CircularGaugeAxes >
57+ </SfCircularGauge >
58+ }
59+ </NodeTemplate >
60+ </DiagramTemplates >
61+ </SfDiagramComponent >
62+
63+ @code
64+ {
65+ // Initialize node collection with node
66+ private DiagramObjectCollection <Node > _nodes = new DiagramObjectCollection <Node >();
67+
68+ protected override void OnInitialized ()
69+ {
70+ Node node = new Node ()
71+ {
72+ ID = " node1" ,
73+ // Size of the node
74+ Width = 300 ,
75+ Height = 300 ,
76+ // Position of the node
77+ OffsetX = 400 ,
78+ OffsetY = 300 ,
79+ // sets the type of the shape as HTML
80+ Shape = new Shape ()
81+ {
82+ Type = NodeShapes .HTML ,
83+ }
84+ };
85+ _nodes .Add (node );
86+ }
87+ }
0 commit comments