Skip to content

Commit 2834b66

Browse files
authored
Merge pull request #66 from apexcharts/fill-color
Added Support for PointColor
2 parents 3366c5b + 158137f commit 2834b66

File tree

21 files changed

+215
-29
lines changed

21 files changed

+215
-29
lines changed

docs/BlazorApexCharts.Docs.Server/Program.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
using Microsoft.AspNetCore.Hosting;
2-
using Microsoft.Extensions.Configuration;
32
using Microsoft.Extensions.Hosting;
4-
using Microsoft.Extensions.Logging;
5-
using System;
6-
using System.Collections.Generic;
7-
using System.Linq;
8-
using System.Threading.Tasks;
93

104
namespace BlazorApexCharts.Docs.Server
115
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"IIS Express": {
1212
"commandName": "IISExpress",
1313
"launchBrowser": true,
14-
"launchUrl": "rangebar-charts#grouped",
14+
"launchUrl": "pie-charts",
1515
"environmentVariables": {
1616
"ASPNETCORE_ENVIRONMENT": "Development"
1717
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
</Snippet>
1515
</CodeSnippet>
1616

17+
<CodeSnippet Title="Point Colors" ClassName=@typeof(PointColors).ToString()>
18+
<Snippet>
19+
<PointColors />
20+
</Snippet>
21+
</CodeSnippet>
22+
1723
<CodeSnippet Title=Horizontal ClassName=@typeof(Horizontal).ToString()>
1824
<Snippet>
1925
<Horizontal />
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<DemoContainer>
2+
<ApexChart TItem="Order"
3+
Title="Order Net Value">
4+
5+
<ApexPointSeries TItem="Order"
6+
Items="Orders"
7+
Name="Gross Value"
8+
XValue="@(e => e.Country)"
9+
YAggregate="@(e => e.Sum(e => e.GrossValue))"
10+
OrderByDescending="e=>e.Y"
11+
SeriesType="SeriesType.Bar"
12+
Color="#005ba3"
13+
PointColor="e=> GetColor(e)" />
14+
</ApexChart>
15+
</DemoContainer>
16+
17+
@code {
18+
private List<Order> Orders { get; set; } = SampleData.GetOrders();
19+
20+
private string GetColor(Order order)
21+
{
22+
if (order.Country == "France")
23+
{
24+
return "#ffd500";
25+
}
26+
return null;
27+
}
28+
29+
30+
}

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

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

11+
12+
<CodeSnippet Title="Point Colors" ClassName=@typeof(PointColors).ToString()>
13+
<Snippet>
14+
<PointColors />
15+
</Snippet>
16+
</CodeSnippet>
17+
1118
</DocExamples>
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="Support Incidents">
4+
5+
@foreach (var data in incidents.GroupBy(e=> e.Source))
6+
{
7+
<ApexBubbleSeries TItem="SupportIncident"
8+
Items="data.ToList()"
9+
Name="@data.Key.ToString()"
10+
XValue="@(e => e.WeekName)"
11+
YAggregate="@(e => (decimal)e.Sum(e => e.LeadTime))"
12+
ZAggregate="@(e => (int)e.Average(e => e.Severity))"
13+
PointColor = "e=> GetPointColor(e) "/>
14+
}
15+
</ApexChart>
16+
</DemoContainer>
17+
18+
@code {
19+
private List<SupportIncident> incidents { get; set; } = SampleData.GetSupportIncidents();
20+
21+
private string GetPointColor(SupportIncident incident)
22+
{
23+
if (incident.Severity > 70)
24+
{
25+
return "#ba4e8e";
26+
}
27+
return null;
28+
}
29+
30+
}

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

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

11+
<CodeSnippet Title="Point Color" ClassName=@typeof(PointColor).ToString()>
12+
<Snippet>
13+
<PointColor/>
14+
</Snippet>
15+
</CodeSnippet>
16+
1117
</DocExamples>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<DemoContainer>
2+
<ApexChart TItem="Order"
3+
Title="Order Gross Value">
4+
5+
<ApexPointSeries TItem="Order"
6+
Items="Orders"
7+
Name="Gross Value"
8+
SeriesType="SeriesType.Pie"
9+
XValue="@(e => e.Country)"
10+
YAggregate="@(e => e.Sum(e => e.GrossValue))"
11+
OrderByDescending="e=>e.Y"
12+
PointColor="e=> GetPointColor(e)" />
13+
</ApexChart>
14+
</DemoContainer>
15+
16+
@code {
17+
private List<Order> Orders { get; set; } = SampleData.GetOrders();
18+
19+
private string GetPointColor(Order order)
20+
{
21+
switch (order.Country)
22+
{
23+
case "France":
24+
return "#e3001b";
25+
case "Brazil":
26+
return "#005ba3";
27+
case "Sweden":
28+
return "#ffd500";
29+
case "Spain":
30+
return "#00783c";
31+
default:
32+
return "#87775d";
33+
}
34+
35+
36+
37+
}
38+
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<DemoContainer>
2+
<ApexChart TItem="SupportIncident"
3+
Title="Incident Severity"
4+
Options=options>
5+
6+
<ApexRangeSeries TItem="SupportIncident"
7+
Items="incidents"
8+
XValue="e=> e.Source.ToString()"
9+
YValue="e=> e.Severity"
10+
PointColor="e=> e.PointColor" />
11+
12+
</ApexChart>
13+
</DemoContainer>
14+
15+
@code {
16+
private List<SupportIncident> incidents { get; set; } = SampleData.GetSupportIncidentsForRange();
17+
private ApexChartOptions<SupportIncident> options;
18+
19+
protected override void OnInitialized()
20+
{
21+
options = new ApexChartOptions<SupportIncident>
22+
{
23+
PlotOptions = new PlotOptions
24+
{
25+
Bar = new PlotOptionsBar
26+
{
27+
Horizontal = true
28+
}
29+
}
30+
};
31+
}
32+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@
2020
</Snippet>
2121
</CodeSnippet>
2222

23+
<CodeSnippet Title="Point Colors" ClassName=@typeof(PointColors).ToString()>
24+
<Snippet>
25+
<PointColors />
26+
</Snippet>
27+
</CodeSnippet>
28+
2329
</DocExamples>

0 commit comments

Comments
 (0)