Skip to content

Commit 8101600

Browse files
authored
Merge pull request #630 from PeerConradi/master
StrokeColor added to mutator and Mutator example in LineChart
2 parents b2e88f0 + 55c387e commit 8101600

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,10 @@
5050
</Snippet>
5151
</CodeSnippet>
5252

53+
<CodeSnippet Title="Point Mutator" ClassName=@typeof(PointMutate).ToString()>
54+
<Snippet>
55+
<PointMutate />
56+
</Snippet>
57+
</CodeSnippet>
58+
5359
</DocExamples>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<DemoContainer>
2+
<ApexChart TItem="Order"
3+
Title="Order Net Value" Options="@options">
4+
5+
<ApexPointSeries TItem="Order"
6+
Items="Orders"
7+
Name="Gross Value"
8+
9+
SeriesType="SeriesType.Line"
10+
XValue="@(e => e.OrderDate)"
11+
YValue="@(e => e.GrossValue)"
12+
DataPointMutator="MutateDataPoint"
13+
OrderByDescending="e=>e.Y" />
14+
</ApexChart>
15+
</DemoContainer>
16+
17+
@code {
18+
private List<Order> Orders { get; set; } = SampleData.GetOrders().Where(n => n.Country == "Sweden").ToList();
19+
20+
private ApexChartOptions<Order> options = new ApexCharts.ApexChartOptions<Order>()
21+
{
22+
Markers = new Markers
23+
{
24+
Size = 6,
25+
FillOpacity = 1,
26+
StrokeWidth = 2,
27+
StrokeColors = new List<string> { "#FFFFFF" },
28+
Colors = new List<string> { "#0000FF" },
29+
StrokeOpacity = 1d
30+
}
31+
};
32+
33+
private void MutateDataPoint(DataPoint<Order> point)
34+
{
35+
var max = Orders.Max(e => e.GrossValue);
36+
37+
if (point.Items.Any(n => n.GrossValue == max))
38+
{
39+
point.FillColor = "#FF0000";
40+
point.StrokeColor = "#00FFFF";
41+
}
42+
}
43+
}

src/Blazor-ApexCharts/Models/DataPoints/DataPoint.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ public class DataPoint<TItem> : IDataPoint<TItem>
1212
/// <inheritdoc cref="IDataPoint{TItem}.FillColor"/>
1313
public string FillColor { get; set; }
1414

15-
/// <inheritdoc cref="IDataPoint{TItem}.X"/>
16-
public object X { get; set; }
15+
/// <summary>
16+
/// Controls the color of the border around the data point
17+
/// </summary>
18+
public string StrokeColor { get; set; }
19+
20+
/// <inheritdoc cref="IDataPoint{TItem}.X"/>
21+
public object X { get; set; }
1722

1823
/// <summary>
1924
/// A collection of goal markers to display with the data point

0 commit comments

Comments
 (0)