Hi Misael,
Greetings from Syncfusion.
We have analyzed your query and provided screenshot based on that we suspect your requirement is to change the disabled legend label TextColor. We would like to let you know that when disable the series using visibility, corresponding series LegendIcon and Label will be applied with light gray color with opacity by default.
However, we can achieve your requirement by using the Legend ItemTemplate property as per in the below code example
|
<ContentPage.Resources>
<local:LegendTextColorConverter x:Key="textColorConverter"/>
</ContentPage.Resources> …
<chart:SfChart.Legend>
<chart:ChartLegend DockPosition="Bottom" ToggleSeriesVisibility="True">
<chart:ChartLegend.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal" WidthRequest="100"
Opacity="{Binding Converter={StaticResource textColorConverter},
Path=Series.IsVisible, ConverterParameter=Opacity}">
<BoxView Color="{Binding IconColor}" HorizontalOptions="Center"
VerticalOptions="Center" HeightRequest="13" WidthRequest="13" />
<Label FontSize="13" VerticalTextAlignment="Center" Text="{Binding Label}"
TextColor="{Binding Converter={StaticResource textColorConverter},
Path=Series.IsVisible}" />
</StackLayout>
</DataTemplate>
</chart:ChartLegend.ItemTemplate>
</chart:ChartLegend>
</chart:SfChart.Legend>
… |
|
public class LegendTextColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var visible = (bool)value;
if (parameter != null)
{
return visible ? 1 : 0.7;
}
return visible ? Color.Green : Color.Red;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
} |
Output:
Please refer the below link for more details
Note: In the above sample we have added the BoxView as the LegendIcon as example and we can customize the icon in the Template using custom font icon as per your requirement.
Please let us know if you need any further assistance on this.
Regards,
Devakumar D