Skip to content

Commit 1f4a33c

Browse files
committed
More Heatmap samples
1 parent c1997e5 commit 1f4a33c

File tree

7 files changed

+152
-11
lines changed

7 files changed

+152
-11
lines changed

docs/BlazorApexCharts.Docs.Server/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"IIS Express": {
44
"commandName": "IISExpress",
55
"launchBrowser": true,
6-
"launchUrl": "rangebar-charts",
6+
"launchUrl": "heatmap-charts",
77
"environmentVariables": {
88
"ASPNETCORE_ENVIRONMENT": "Development"
99
}

docs/BlazorApexCharts.Docs/BlazorApexCharts.Docs.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@
2121
<ProjectReference Include="..\..\src\Blazor-ApexCharts\Blazor-ApexCharts.csproj" />
2222
</ItemGroup>
2323

24+
<ItemGroup>
25+
<Folder Include="Components\Issues\" />
26+
</ItemGroup>
27+
2428
</Project>
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<DemoContainer>
22
<ApexChart TItem="SupportIncident"
33
Title="Incident Severity"
4-
Options="options">
4+
>
55

66
@foreach (var source in incidents.GroupBy(e => e.Source))
77
{
@@ -18,13 +18,5 @@
1818

1919
@code {
2020
private List<SupportIncident> incidents { get; set; } = SampleData.GetSupportIncidents();
21-
private ApexChartOptions<SupportIncident> options;
22-
23-
protected override void OnInitialized()
24-
{
25-
options = new ApexChartOptions<SupportIncident>
26-
{
27-
Colors = new List<string> { "#008FFB" }
28-
};
29-
}
21+
3022
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<DemoContainer>
2+
<ApexChart TItem="SupportIncident"
3+
Title="Incident Severity"
4+
Options="options">
5+
6+
@foreach (var source in incidents.GroupBy(e => e.Source).OrderBy(e => e.Key))
7+
{
8+
<ApexPointSeries TItem="SupportIncident"
9+
Items="source.OrderBy(e=>e.WeekNumber)"
10+
Name="@source.Key.ToString()"
11+
SeriesType="SeriesType.Heatmap"
12+
Color="@GetColor(source.Key)"
13+
XValue="@(e => e.WeekName)"
14+
YAggregate="@(e => (int)e.Average(a=>a.Severity))" />
15+
}
16+
17+
</ApexChart>
18+
</DemoContainer>
19+
20+
@code {
21+
private List<SupportIncident> incidents { get; set; } = SampleData.GetSupportIncidents();
22+
private ApexChartOptions<SupportIncident> options = new();
23+
24+
private string GetColor(IncidentSource source)
25+
{
26+
switch (source)
27+
{
28+
case IncidentSource.Internal:
29+
return "#FF0000";
30+
case IncidentSource.ThirdParty:
31+
return "#0000FF";
32+
case IncidentSource.Integration:
33+
return "#FF00FF";
34+
default:
35+
return "#008FFB";
36+
}
37+
}
38+
}

docs/BlazorApexCharts.Docs/Components/ChartTypes/HeatmapCharts/HeatmapCharts.razor

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,22 @@
88
</Snippet>
99
</CodeSnippet>
1010

11+
<CodeSnippet Title="One color" ClassName=@typeof(OneColor).ToString()>
12+
<Snippet>
13+
<OneColor />
14+
</Snippet>
15+
</CodeSnippet>
1116

17+
<CodeSnippet Title="Series Color" ClassName=@typeof(Colors).ToString()>
18+
<Snippet>
19+
<Colors />
20+
</Snippet>
21+
</CodeSnippet>
1222

23+
<CodeSnippet Title=NoShade ClassName=@typeof(NoShade).ToString()>
24+
<Snippet>
25+
<NoShade />
26+
</Snippet>
27+
</CodeSnippet>
1328

1429
</DocExamples>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<DemoContainer>
2+
<ApexChart TItem="SupportIncident"
3+
Title="Incident Severity"
4+
Options="options"
5+
Debug>
6+
7+
@foreach (var source in incidents.GroupBy(e => e.Source))
8+
{
9+
<ApexPointSeries TItem="SupportIncident"
10+
Items="source.OrderBy(e=>e.WeekNumber)"
11+
Name="@source.Key.ToString()"
12+
SeriesType="SeriesType.Heatmap"
13+
XValue="@(e => e.WeekName)"
14+
YAggregate="@(e => (int)e.Average(a=>a.Severity))"
15+
ShowDataLabels=true
16+
/>
17+
}
18+
19+
</ApexChart>
20+
</DemoContainer>
21+
22+
@code {
23+
private List<SupportIncident> incidents { get; set; } = SampleData.GetSupportIncidents();
24+
private ApexChartOptions<SupportIncident> options;
25+
26+
protected override void OnInitialized()
27+
{
28+
options = new ApexChartOptions<SupportIncident>
29+
{
30+
Stroke = new Stroke
31+
{
32+
Width = 0
33+
},
34+
PlotOptions = new PlotOptions
35+
{
36+
Heatmap = new PlotOptionsHeatmap
37+
{
38+
EnableShades = false,
39+
Radius = 300,
40+
ColorScale = new PlotOptionsHeatmapColorScale
41+
{
42+
Ranges = new List<PlotOptionsHeatmapColorScaleRange> {
43+
new PlotOptionsHeatmapColorScaleRange {
44+
Color = "#0000FF",
45+
From = 0,
46+
To=50
47+
},
48+
{
49+
new PlotOptionsHeatmapColorScaleRange
50+
{
51+
Color = "#FF0000",
52+
From = 50,
53+
To = 100
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}
60+
};
61+
}
62+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<DemoContainer>
2+
<ApexChart TItem="SupportIncident"
3+
Title="Incident Severity"
4+
Options="options">
5+
6+
@foreach (var source in incidents.GroupBy(e => e.Source))
7+
{
8+
<ApexPointSeries TItem="SupportIncident"
9+
Items="source.OrderBy(e=>e.WeekNumber)"
10+
Name="@source.Key.ToString()"
11+
SeriesType="SeriesType.Heatmap"
12+
XValue="@(e => e.WeekName)"
13+
YAggregate="@(e => (int)e.Average(a=>a.Severity))" />
14+
}
15+
16+
</ApexChart>
17+
</DemoContainer>
18+
19+
@code {
20+
private List<SupportIncident> incidents { get; set; } = SampleData.GetSupportIncidents();
21+
private ApexChartOptions<SupportIncident> options;
22+
23+
protected override void OnInitialized()
24+
{
25+
options = new ApexChartOptions<SupportIncident>
26+
{
27+
Colors = new List<string> { "#008FFB" }
28+
};
29+
}
30+
}

0 commit comments

Comments
 (0)