Skip to content

Commit 6e4f012

Browse files
committed
Update the image in readme file
1 parent e83015b commit 6e4f012

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

LegendSample/LegendSample/View/LegendMaximumSizeSample.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
</chart:SfCircularChart.Title>
2222

2323
<chart:SfCircularChart.Legend>
24-
<local:LegendExt/>
24+
<local:LegendExt>
25+
</local:LegendExt>
2526
</chart:SfCircularChart.Legend>
2627

27-
<chart:PieSeries ItemsSource="{Binding DataCollection}"
28+
<chart:PieSeries ItemsSource="{Binding Data}"
2829
XBindingPath="Country"
2930
YBindingPath="Value"
3031
PaletteBrushes="{Binding CustomBrushes}">

LegendSample/LegendSample/ViewModel/ViewModel.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ namespace LegendSample.ViewModel
1515
public class ViewModel
1616
{
1717
public ObservableCollection<DataModel> DataCollection { get; set; }
18+
public ObservableCollection<DataModel> Data { get; set; }
19+
1820
public List<Brush> CustomBrushes { get; set; }
1921
public ViewModel()
2022
{
@@ -35,6 +37,27 @@ public ViewModel()
3537
CustomBrushes.Add(new SolidColorBrush(Color.FromArgb("#C71969")));
3638
CustomBrushes.Add(new SolidColorBrush(Color.FromArgb("#8AC114")));
3739
CustomBrushes.Add(new SolidColorBrush(Color.FromArgb("#8419C7")));
40+
CustomBrushes.Add(new SolidColorBrush(Colors.Green));
41+
CustomBrushes.Add(new SolidColorBrush(Colors.Brown));
42+
CustomBrushes.Add(new SolidColorBrush(Colors.DeepPink));
43+
CustomBrushes.Add(new SolidColorBrush(Colors.DarkBlue));
44+
CustomBrushes.Add(new SolidColorBrush(Colors.Orange));
45+
46+
Data = new ObservableCollection<DataModel>
47+
{
48+
new DataModel("India", 22500),
49+
new DataModel("Thailand", 8500),
50+
new DataModel("Vietnam",7500 ),
51+
new DataModel("Pakistan", 3600),
52+
new DataModel("US", 2125),
53+
new DataModel("Argentina", 400),
54+
new DataModel("Australia", 275),
55+
new DataModel("Brazil", 1100),
56+
new DataModel("Cambodia", 1800),
57+
new DataModel("China", 1800),
58+
new DataModel("Others", 1398),
59+
};
60+
3861

3962
}
4063
}
@@ -45,7 +68,7 @@ public class LegendExt : ChartLegend
4568
// Override the GetMaximumSizeCoefficient method to customize the legend size
4669
protected override double GetMaximumSizeCoefficient()
4770
{
48-
return 0.9;
71+
return 0.2;
4972
}
5073
}
5174
}

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ chart.Legend = new ChartLegend();
5252

5353
###### Output:
5454

55+
The following screenshot explains the legend for each segment of the pie chart, highlighting the significance of each individual section to the users.
56+
5557
![LegendImage](https://support.syncfusion.com/kb/agent/attachment/article/18792/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjM0ODU2Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.ScOM3vo6FrOOHQK84o0G2_CsY9LX9YFLyYywDTapoIE)
5658

5759
**Legend Placement Customization**
@@ -83,7 +85,7 @@ The legend has been shifted to the bottom of the chart, as you can see in the sc
8385

8486
**Legend icon Customization**
8587

86-
To customize the legend icon in your chart, you can use the [LegendIcon](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html?tabs=tabid-9%2Ctabid-11%2Ctabid-5%2Ctabid-7%2Ctabid-18%2Ctabid-1%2Ctabid-22%2Ctabid-24%2Ctabid-16%2Ctabid-20%2Ctabid-14%2Ctabid-13%2Ctabid-3#Syncfusion_Maui_Charts_ChartSeries_LegendIcon) property and set it to one of the values from the [ChartLegendIconType](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegendIconType.html) enum.
88+
To customize the legend icon in chart, use the [LegendIcon](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html?tabs=tabid-9%2Ctabid-11%2Ctabid-5%2Ctabid-7%2Ctabid-18%2Ctabid-1%2Ctabid-22%2Ctabid-24%2Ctabid-16%2Ctabid-20%2Ctabid-14%2Ctabid-13%2Ctabid-3#Syncfusion_Maui_Charts_ChartSeries_LegendIcon) property and set it to one of the values from the [ChartLegendIconType](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegendIconType.html) enum.
8789

8890
[XAML]
8991
```xml
@@ -174,7 +176,7 @@ In the screenshot below you can observe that the legend label has been customize
174176

175177
**Legend Visibility**
176178

177-
To hide the legend, you can use the [IsVisible](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegend.html?tabs=tabid-1%2Ctabid-3%2Ctabid-7%2Ctabid-12%2Ctabid-13%2Ctabid-5%2Ctabid-10%2Ctabid-15#Syncfusion_Maui_Charts_ChartLegend_IsVisible) property. This will allow you to enable or disable the legend in your chart.
179+
To hide the legend, use the [IsVisible](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegend.html?tabs=tabid-1%2Ctabid-3%2Ctabid-7%2Ctabid-12%2Ctabid-13%2Ctabid-5%2Ctabid-10%2Ctabid-15#Syncfusion_Maui_Charts_ChartLegend_IsVisible) property. This will allow to enable or disable the legend in chart.
178180

179181
[XAML]
180182
```xml
@@ -196,7 +198,7 @@ You can see that the chart's legend has been disabled in the screenshot below.
196198

197199
**Toggle Series Visibility**
198200

199-
To hide a particular segment in the MAUI circular charts by toggling the legend, use the [ToggleSeriesVisibility](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegend.html?tabs=tabid-1%2Ctabid-3%2Ctabid-7%2Ctabid-12%2Ctabid-13%2Ctabid-5%2Ctabid-10%2Ctabid-15#Syncfusion_Maui_Charts_ChartLegend_ToggleSeriesVisibility) property. This property allows you to dynamically change the visibility of a segment by tapping the respective legend item.
201+
To hide a particular segment in the MAUI circular charts by toggling the legend, use the [ToggleSeriesVisibility](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegend.html?tabs=tabid-1%2Ctabid-3%2Ctabid-7%2Ctabid-12%2Ctabid-13%2Ctabid-5%2Ctabid-10%2Ctabid-15#Syncfusion_Maui_Charts_ChartLegend_ToggleSeriesVisibility) property. This property allows to dynamically change the visibility of a segment by tapping the respective legend item.
200202

201203
[XAML]
202204
```xml
@@ -217,11 +219,11 @@ chart.Legend = new ChartLegend()
217219

218220
In the screenshot below you can observe that the Thailand segment is disabled.
219221

220-
![LegendToggleSeriesVisibilityImage](https://support.syncfusion.com/kb/agent/attachment/article/18792/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjM0ODQ3Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.9i9OFQuqNgdeijVXhMYDqy1n138D1bYqYfjDXR4CUeI)
222+
![LegendToggleSeriesVisibilityImage](https://support.syncfusion.com/kb/agent/attachment/article/18792/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjM1MjE1Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.Zt85M1UVgVmWEyyPOHLXayuZjajHDdJUUIxHNC2bmqc)
221223

222224
**Legend item visibility**
223225

224-
The visibility of individual legend items for specific series can be controlled using the [IsVisibleOnLegend](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html?tabs=tabid-9%2Ctabid-11%2Ctabid-5%2Ctabid-7%2Ctabid-18%2Ctabid-1%2Ctabid-22%2Ctabid-24%2Ctabid-16%2Ctabid-20%2Ctabid-14%2Ctabid-13%2Ctabid-3#Syncfusion_Maui_Charts_ChartSeries_IsVisibleOnLegend) property of the series. You can disable the legend for particular series using this property.
226+
The visibility of individual legend items for specific series can be controlled using the [IsVisibleOnLegend](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html?tabs=tabid-9%2Ctabid-11%2Ctabid-5%2Ctabid-7%2Ctabid-18%2Ctabid-1%2Ctabid-22%2Ctabid-24%2Ctabid-16%2Ctabid-20%2Ctabid-14%2Ctabid-13%2Ctabid-3#Syncfusion_Maui_Charts_ChartSeries_IsVisibleOnLegend) property of the series. Can disable the legend for particular series using this property.
225227

226228
[XAML]
227229
```xml
@@ -278,12 +280,14 @@ public class LegendExt : ChartLegend
278280
// Override the GetMaximumSizeCoefficient method to customize the legend size
279281
protected override double GetMaximumSizeCoefficient()
280282
{
281-
return 0.9;
283+
return 0.2;
282284
}
283285
}
284286
```
285287

286-
![LegendMaximumSizeRequestImage](https://support.syncfusion.com/kb/agent/attachment/article/18792/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjM0ODUwIiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.VWiq0GnClwzqW40pHx_ONATZ5okuzz0Zl1LWj_13p5Q)
288+
As you can see in the screenshot below, the legend view has been reduced in size due to the large number of data elements
289+
290+
![LegendMaximumSizeRequestImage](https://support.syncfusion.com/kb/agent/attachment/article/18792/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjM1MjE0Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.zOifIwhl07TTBamS6Q9Y4g3d3DC-L1fX-ejA5JoFYzk)
287291

288292
**Items layout Customization**
289293

@@ -322,7 +326,7 @@ this.Content = chart;
322326

323327
**Item Template Customization**
324328

325-
To customize the appearance of legend items, you can utilize the [ItemTemplate](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegend.html?tabs=tabid-1%2Ctabid-3%2Ctabid-7%2Ctabid-12%2Ctabid-13%2Ctabid-5%2Ctabid-10%2Ctabid-15#Syncfusion_Maui_Charts_ChartLegend_ItemTemplate) property. This allows you to define how each item in the legend should be displayed.
329+
To customize the appearance of legend items, can utilize the [ItemTemplate](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartLegend.html?tabs=tabid-1%2Ctabid-3%2Ctabid-7%2Ctabid-12%2Ctabid-13%2Ctabid-5%2Ctabid-10%2Ctabid-15#Syncfusion_Maui_Charts_ChartLegend_ItemTemplate) property. This allows to define how each item in the legend should be displayed.
326330

327331
[XAML]
328332
```xml

0 commit comments

Comments
 (0)