Skip to content

Commit

Permalink
Updated Apexcharts.js to 4.1.0
Browse files Browse the repository at this point in the history
Added support for LineColors Threshold
  • Loading branch information
joadan committed Nov 25, 2024
1 parent b28e2c5 commit 9d8c9d9
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docs/BlazorApexCharts.Docs/BlazorApexCharts.Docs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<Content Update="Components\ChartService\Usage.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Components\ChartTypes\LineCharts\ColorThreshold.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<DocExamples Title="Area Charts">


<CodeSnippet Title=Basic ClassName=@typeof(Basic).ToString()>

<CodeSnippet Title=Basic ClassName=@typeof(Basic).ToString()>
<Snippet>
<Basic />
</Snippet>
Expand All @@ -20,6 +21,6 @@
<Snippet>
<AreaPlotOptions />
</Snippet>
</CodeSnippet>
</CodeSnippet>

</DocExamples>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<DemoContainer>
<ApexChart TItem="Order"
Title="Basic Sample"
Options="options">

<ApexPointSeries TItem="Order"
Items="orders"
SeriesType="@SeriesType.Line"
Name="Gross Value"
XValue="@(e => e.Country)"
YAggregate="@(e => e.Sum(e => e.GrossValue))"
OrderByDescending="e=>e.X" />

<ApexPointSeries TItem="Order"
Items="orders"
SeriesType="@SeriesType.Line"
Name="Net Value"
XValue="@(e => e.Country)"
YAggregate="@(e => e.Sum(e => e.NetValue))"
OrderByDescending="e=>e.X" />
</ApexChart>
</DemoContainer>

@code {
private List<Order> orders { get; set; } = SampleData.GetOrders();
private ApexChartOptions<Order> options { get; set; } = new();

protected override void OnInitialized()
{
options.PlotOptions = new PlotOptions
{
Line = new PlotOptionsLine
{
Colors = new LineColors
{
Threshold = 150000,
ColorAboveThreshold = "#0088ee",
ColorBelowThreshold = "#ff0000"
}
}
};


}


}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@
</Snippet>
</CodeSnippet>

<CodeSnippet Title="Color Threshold" ClassName=@typeof(ColorThreshold).ToString()>
<Snippet>
<ColorThreshold />
</Snippet>
</CodeSnippet>

</DocExamples>
24 changes: 24 additions & 0 deletions src/Blazor-ApexCharts/Models/ApexChartOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2746,6 +2746,30 @@ public class PlotOptionsLine
/// Default is false
/// </summary>
public bool? IsSlopeChart { get; set; }

/// <inheritdoc cref="ApexCharts.LineColors" />
public LineColors Colors { get; set; }

}

/// <summary>
/// Options for line colors
/// </summary>
public class LineColors
{
/// <summary>
/// Value that indicates the threshold for different colors
/// Default is 0
/// </summary>
public decimal? Threshold { get; set; }
/// <summary>
/// Color of the line above threshold
/// </summary>
public string ColorAboveThreshold { get; set; }
/// <summary>
/// Color of the line below threshold
/// </summary>
public string ColorBelowThreshold { get; set; }
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Blazor-ApexCharts/wwwroot/js/apexcharts.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Blazor-ApexCharts/wwwroot/js/blazor-apexcharts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ApexCharts from './apexcharts.esm.js?ver=4.0.0'
import ApexCharts from './apexcharts.esm.js?ver=4.1.0'

// export function for Blazor to point to the window.blazor_apexchart. To be compatible with the most JS Interop calls the window will be return.
export function get_apexcharts() {
Expand Down

0 comments on commit 9d8c9d9

Please sign in to comment.