forked from syncfusion/blazor-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DefaultFunctionalities.razor
128 lines (120 loc) · 5.59 KB
/
DefaultFunctionalities.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
@page "/bullet-chart/default-functionalities"
@using Syncfusion.Blazor.Charts
@using Syncfusion.Blazor
@inject NavigationManager NavigationManager
@inherits SampleBaseComponent;
<SampleDescription>
<p>This sample illustrates a default bullet chart to compare the feature (value) bar with comparative (target) bar. It includes variety of configurations to change the look and feel of the chart.</p>
</SampleDescription>
<ActionDescription>
<p>Tooltip is enabled in this example, to see the tooltip in action, hover a feature bar or comparative bar on the bullet chart.</p>
</ActionDescription>
<div class="control-section" style="text-align: center">
<SfBulletChart DataSource="@BulletChartData0" Theme="@theme" ValueField="value" TargetField="target" Minimum="0" Maximum="300" Interval="50"
Title="Revenue" Subtitle="U.S. $" LabelFormat="${value}k" TitlePosition="TextPosition.Left" Width="80%">
<BulletChartTooltip TValue="ChartData" Enable="true"></BulletChartTooltip>
<BulletChartMargin Left="60" Right="15"></BulletChartMargin>
<BulletChartRangeCollection>
<BulletChartRange End="150"> </BulletChartRange>
<BulletChartRange End="250"></BulletChartRange>
<BulletChartRange End="300"></BulletChartRange>
</BulletChartRangeCollection>
</SfBulletChart>
<SfBulletChart DataSource="@BulletChartData1" ValueField="value" Theme="@theme" TargetField="target" Minimum="0" Maximum="30" Interval="5"
Title="Profit" Subtitle="%" LabelFormat="{value}%" TitlePosition="TextPosition.Left" Width="80%">
<BulletChartTooltip TValue="ChartData" Enable="true"></BulletChartTooltip>
<BulletChartMargin Left="80" Right="15"></BulletChartMargin>
<BulletChartRangeCollection>
<BulletChartRange End="20"> </BulletChartRange>
<BulletChartRange End="25"></BulletChartRange>
<BulletChartRange End="30"></BulletChartRange>
</BulletChartRangeCollection>
</SfBulletChart>
<SfBulletChart DataSource="@BulletChartData2" ValueField="value" Theme="@theme" TargetField="target" Minimum="0" Maximum="600" Interval="100"
Title="Avg Order Size" Subtitle="U.S. $" LabelFormat="${value}" TitlePosition="TextPosition.Left" Width="80%">
<BulletChartTooltip TValue="ChartData" Enable="true"></BulletChartTooltip>
<BulletChartMargin Left="21.5" Right="15"></BulletChartMargin>
<BulletChartRangeCollection>
<BulletChartRange End="350"> </BulletChartRange>
<BulletChartRange End="500"></BulletChartRange>
<BulletChartRange End="600"></BulletChartRange>
</BulletChartRangeCollection>
</SfBulletChart>
<SfBulletChart DataSource="@BulletChartData3" EnableGroupSeparator="false" Theme="@theme" ValueField="value" TargetField="target" Width="80%"
Minimum="0" Maximum="2500" Interval="500" Title="New Customers" Subtitle="Count" TitlePosition="TextPosition.Left">
<BulletChartTooltip TValue="ChartData" Enable="true"></BulletChartTooltip>
<BulletChartMargin Left="18" Right="15"></BulletChartMargin>
<BulletChartRangeCollection>
<BulletChartRange End="1700"> </BulletChartRange>
<BulletChartRange End="2000"></BulletChartRange>
<BulletChartRange End="2500"></BulletChartRange>
</BulletChartRangeCollection>
</SfBulletChart>
<SfBulletChart DataSource="@BulletChartData4" ValueField="value" Theme="@theme" TargetField="target" Minimum="0" Maximum="5" Interval="1"
Title="Cust Satisfication" Subtitle="Top rating of 5" TitlePosition="TextPosition.Left" Width="80%">
<BulletChartTooltip TValue="ChartData" Enable="true"></BulletChartTooltip>
<BulletChartMargin Left="7" Right="15"></BulletChartMargin>
<BulletChartRangeCollection>
<BulletChartRange End="3.7"> </BulletChartRange>
<BulletChartRange End="4.2"></BulletChartRange>
<BulletChartRange End="5"></BulletChartRange>
</BulletChartRangeCollection>
</SfBulletChart>
</div>
@code{
public class ChartData
{
public double value { get; set; }
public double target { get; set; }
}
public List<ChartData> BulletChartData0 = new List<ChartData>
{
new ChartData { value = 270, target = 250 }
};
public List<ChartData> BulletChartData1 = new List<ChartData>
{
new ChartData { value = 23, target = 27 }
};
public List<ChartData> BulletChartData2 = new List<ChartData>
{
new ChartData { value = 350, target = 550 }
};
public List<ChartData> BulletChartData3 = new List<ChartData>
{
new ChartData { value = 1600, target = 2100 }
};
public List<ChartData> BulletChartData4 = new List<ChartData>
{
new ChartData { value = 4.9, target = 4 }
};
private string CurrentUri;
private Theme theme { get; set; }
protected override void OnInitialized()
{
CurrentUri = NavigationManager.Uri;
if (CurrentUri.IndexOf("material") > -1)
{
theme = Theme.Material;
}
else if (CurrentUri.IndexOf("fabric") > -1)
{
theme = Theme.Fabric;
}
else if (CurrentUri.IndexOf("bootstrap") > -1)
{
theme = Theme.Bootstrap;
}
else if (CurrentUri.IndexOf("highcontrast") > -1)
{
theme = Theme.HighContrast;
}
else if (CurrentUri.IndexOf("tailwind") > -1)
{
theme = Theme.Tailwind;
}
else
{
theme = Theme.Bootstrap4;
}
}
}