Hi,
I have two RadDateTimePicker from && two RadButton.
In the command button I filter the chart,
The data is ok but the chart is not refreshed.
The chart load OK on view loaded.
<ContentView.BindingContext>
<local:DashboardViewModel/>
</ContentView.BindingContext>
<VerticalStackLayout ><HorizontalStackLayout><Label Text="From:" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" /><telerikInput:RadDateTimePicker x:Name="fromDateTimePicker" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Margin="5" HeightRequest="60" WidthRequest="150"
Date="{Binding FromDate, Mode=TwoWay}"/></HorizontalStackLayout><HorizontalStackLayout><Label Text="To:" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Margin="0,0,20,0"/><telerikInput:RadDateTimePicker x:Name="toDateTimePicker" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Margin="5" HeightRequest="60" WidthRequest="150"
Date="{Binding ToDate, Mode=TwoWay}"/></HorizontalStackLayout><telerik:RadButton AutomationId="button" Text="Search" HorizontalOptions="CenterAndExpand" VerticalOptions="Center" BackgroundColor="#1ABB9C" Margin="5" Command="{Binding OnDashBoardCommand}"/></VerticalStackLayout>
<telerikChart:RadCartesianChart Grid.Row="4" Grid.Column="0" x:Name="totalFilesDividedByRoutesChart">
<telerikChart:RadCartesianChart.BindingContext>
<local:DashboardViewModel />
</telerikChart:RadCartesianChart.BindingContext>
<telerikChart:RadCartesianChart.HorizontalAxis>
<telerikChart:CategoricalAxis PlotMode="OnTicks"/>
</telerikChart:RadCartesianChart.HorizontalAxis>
<telerikChart:RadCartesianChart.VerticalAxis>
<telerikChart:NumericalAxis LabelFitMode="MultiLine" />
</telerikChart:RadCartesianChart.VerticalAxis>
<telerikChart:RadCartesianChart.Series>
<telerikChart:BarSeries ValueBinding="Value"
CategoryBinding="RouteName"
ItemsSource="{Binding TotalFilesDividedByRoutesDataSource}" />
</telerikChart:RadCartesianChart.Series>
</telerikChart:RadCartesianChart>
public class DashboardViewModel: BaseViewModel
{
OnDashBoardCommand = new Command(execute: () =>
{
GetDataTotalFilesDividedByRoutesData();
},
canExecute: () => {
if (!(FromDate.HasValue && ToDate.HasValue))
{
return false;
}
return FromDate.Value <= ToDate.Value;
});
TotalFilesDividedByRoutesDataSource = new ObservableCollection<TotalFilesDividedByRoutesData>();
GetDataTotalFilesDividedByRoutesData();
}
public ObservableCollection<TotalFilesDividedByRoutesData> TotalFilesDividedByRoutesDataSource { get; private set; }
private void GetDataTotalFilesDividedByRoutesData()
{
if (!(FromDate.HasValue && ToDate.HasValue))
{
return ;
}
.....
TotalFilesDividedByRoutesDataSource.Clear();
TotalFilesDividedByRoutesDataSource = new ObservableCollection<TotalFilesDividedByRoutesData>(computedData.AsEnumerable());
}