Skip to content

Commit 7b66582

Browse files
authored
Merge pull request #298 from apexcharts/fix-toolbar-icons
#297 Fixed custom icons
2 parents e8abdee + 671e37d commit 7b66582

File tree

4 files changed

+83
-14
lines changed

4 files changed

+83
-14
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
SeriesType="SeriesType.Line"
9+
XValue="@(e => e.Country)"
10+
YAggregate="@(e => e.Sum(e => e.GrossValue))"
11+
OrderByDescending="e=>e.Y" />
12+
13+
<ApexPointSeries TItem="Order"
14+
Items="Orders"
15+
Name="Net Value"
16+
SeriesType="SeriesType.Line"
17+
XValue="@(e => e.Country)"
18+
YAggregate="@(e => e.Sum(e => e.NetValue))"
19+
OrderByDescending="e=>e.Y" />
20+
</ApexChart>
21+
</DemoContainer>
22+
23+
@code {
24+
private List<Order> Orders { get; set; } = SampleData.GetOrders();
25+
private ApexChartOptions<Order> options { get; set; } = new();
26+
27+
protected override void OnInitialized()
28+
{
29+
30+
var downloadIcon = @"<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' stroke-width='2' stroke='currentColor' fill='none' stroke-linecap='round' stroke-linejoin='round'>
31+
<path stroke='none' d='M0 0h24v24H0z' fill='none'></path>
32+
<path d='M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2'></path>
33+
<path d='M7 11l5 5l5 -5'></path>
34+
<path d='M12 4l0 12'></path>
35+
</svg>";
36+
37+
options.Chart = new Chart
38+
{
39+
Toolbar = new ApexCharts.Toolbar
40+
{
41+
Tools = new Tools { Download = downloadIcon }
42+
}
43+
};
44+
45+
46+
base.OnInitialized();
47+
}
48+
49+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@page "/features/toolbar"
2+
3+
<DocExamples Title="Custom Tooltip">
4+
5+
<CodeSnippet Title="Change Icon" ClassName=@typeof(ChangeIcon).ToString()>
6+
<Snippet>
7+
<ChangeIcon />
8+
</Snippet>
9+
</CodeSnippet>
10+
11+
12+
</DocExamples>

docs/BlazorApexCharts.Docs/Shared/MainNavigation.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
<NavbarMenuItem Text="Size" Href="features/chart-size" />
161161
<NavbarMenuItem Text="State" Href="features/state" />
162162
<NavbarMenuItem Text="Syncronized charts" Href="features/syncronized" />
163+
<NavbarMenuItem Text="Toolbar" Href="features/toolbar" />
163164
<NavbarMenuItem Text="Custom Tooltip" Href="features/tooltip" />
164165
</SubMenu>
165166

src/Blazor-ApexCharts/Models/ApexChartOptions.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,8 @@ public class Tools
14101410
public List<ToolCustomIcon> CustomIcons { get; set; }
14111411

14121412
/// <summary>
1413-
/// Show the download menu / hamburger icon in the toolbar. If you want to display a custom icon instead of hamburger icon, you can provide HTML string in this property.
1413+
/// Show the download menu / hamburger icon in the toolbar.
1414+
/// If you want to display a custom icon, you can provide HTML string in this property.
14141415
///
14151416
/// <code>
14161417
/// download: true
@@ -1420,40 +1421,46 @@ public class Tools
14201421
/// ApexCharts has built-in support to allow exporting the chart to popular image formats like PNG or SVG and also allows exporting the chart data to a CSV file.
14211422
/// By default, all XY charts have the toolbar enabled in them which has a hamburger icon at the top right corner. Clicking the hamburger icon opens a menu which has following options to download.
14221423
/// </summary>
1423-
public bool Download { get; set; } = true;
1424+
public object Download { get; set; } = true;
14241425

14251426
/// <summary>
1426-
/// Show the panning icon in the toolbar.
1427+
/// Show the panning icon in the toolbar.
1428+
/// If you want to display a custom icon for Pan, you can provide HTML string in this property.
14271429
/// </summary>
1428-
public bool Pan { get; set; } = true;
1430+
public object Pan { get; set; } = true;
14291431

14301432
/// <summary>
1431-
/// Reset the chart data to it's initial state after zommin/zoomout/panning. If you want to display a custom icon for reset, you can provide HTML string in this property.
1433+
/// Reset the chart data to it's initial state after zommin/zoomout/panning.
1434+
/// If you want to display a custom icon for reset, you can provide HTML string in this property.
14321435
/// </summary>
1433-
public bool Reset { get; set; } = true;
1436+
public object Reset { get; set; } = true;
14341437

14351438
/// <summary>
1436-
/// Show the rectangle selection icon in the toolbar. If you want to display a custom icon for selection, you can provide HTML string in this property.
1439+
/// Show the rectangle selection icon in the toolbar.
1440+
/// If you want to display a custom icon for selection, you can provide HTML string in this property.
14371441
/// </summary>
14381442
/// <remarks>
14391443
/// Make sure to also enable <see cref="Chart.Selection"/> when showing the selection tool.
14401444
/// </remarks>
1441-
public bool Selection { get; set; } = true;
1445+
public object Selection { get; set; } = true;
14421446

14431447
/// <summary>
1444-
/// Show the zoom icon which is used for zooming by dragging selection on the chart area. If you want to display a custom icon for zoom, you can provide HTML string in this property.
1448+
/// Show the zoom icon which is used for zooming by dragging selection on the chart area.
1449+
/// If you want to display a custom icon for zoom, you can provide HTML string in this property.
14451450
/// </summary>
1446-
public bool Zoom { get; set; } = true;
1451+
public object Zoom { get; set; } = true;
14471452

14481453
/// <summary>
1449-
/// Show the zoom-in icon which zooms in 50% from the visible chart area. If you want to display a custom icon for zoom-in, you can provide HTML string in this property.
1454+
/// Show the zoom-in icon which zooms in 50% from the visible chart area.
1455+
/// If you want to display a custom icon for zoom-in, you can provide HTML string in this property.
14501456
/// </summary>
1451-
public bool Zoomin { get; set; } = true;
1457+
public object Zoomin { get; set; } = true;
14521458

14531459
/// <summary>
1454-
/// Show the zoom-out icon which zooms out 50% from the visible chart area. If you want to display a custom icon for zoom-out, you can provide HTML string in this property.
1460+
/// Show the zoom-out icon which zooms out 50% from the visible chart area.
1461+
/// If you want to display a custom icon for zoom-out, you can provide HTML string in this property.
14551462
/// </summary>
1456-
public bool Zoomout { get; set; } = true;
1463+
public object Zoomout { get; set; } = true;
14571464
}
14581465

14591466
/// <summary>

0 commit comments

Comments
 (0)