I'm trying to create multiple charts inside a listview but the chart isn't showing up. I'm not sure why. The backing data is there. Here is the code I'm using:
<?xml version="1.0" encoding="utf-8" ?><ContentPage xmlns="http://xamarin.com/schemas/2014/forms" x:Class="Mobile.Views.WatchListPage" xmlns:infrastructure="clr-namespace:Mobile.Infrastructure;assembly=Mobile" xmlns:telerik="clr-namespace:Telerik.XamarinForms.Chart;assembly=Telerik.XamarinForms.Chart" xmlns:viewModel="clr-namespace:Mobile.ViewModels;assembly=Mobile" Title="DHT1"> <ContentPage.Resources> <ResourceDictionary> <Style x:Key="FriendlyNameStyle" TargetType="Label"> <Setter Property="FontSize" Value="16"></Setter> <Setter Property="FontFamily" Value="Open Sans"></Setter> </Style> <Style x:Key="ValueStyle" TargetType="Label"> <Setter Property="FontSize" Value="18"></Setter> <Setter Property="FontFamily" Value="Open Sans"></Setter> <Setter Property="FontAttributes" Value="Bold"></Setter> </Style> <Style x:Key="MinorText" TargetType="Label"> <Setter Property="FontSize" Value="14"></Setter> <Setter Property="FontFamily" Value="Open Sans"></Setter> <Setter Property="TextColor" Value="Gray"></Setter> </Style> </ResourceDictionary> </ContentPage.Resources> <ContentPage.Content> <StackLayout Orientation="Vertical" Padding="0" Spacing="0"> <SearchBar x:Name="ParameterSearch" Placeholder="Search parameters" Text="{Binding ParameterSearchText}"></SearchBar> <infrastructure:CustomListView x:Name="ParameterLv" SeparatorVisibility="Default" RowHeight="50"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Spacing="0"> <ContentView Padding="5, 0, 5, 0"> <Image Source="{Binding StatusImg}"></Image> </ContentView> <StackLayout Orientation="Vertical"> <Label Text="{Binding FriendlyName}" Style="{StaticResource FriendlyNameStyle}"></Label> <Label Text="{Binding TagId}" Style="{StaticResource MinorText}"></Label> </StackLayout> <telerik:RadCartesianChart x:Name="ParameterChart" HorizontalOptions="FillAndExpand"> <telerik:RadCartesianChart.BindingContext> <viewModel:ParameterViewModel/> </telerik:RadCartesianChart.BindingContext> <telerik:RadCartesianChart.HorizontalAxis> <telerik:NumericalAxis/> </telerik:RadCartesianChart.HorizontalAxis> <telerik:RadCartesianChart.VerticalAxis> <telerik:NumericalAxis /> </telerik:RadCartesianChart.VerticalAxis> <telerik:RadCartesianChart.Series> <telerik:ScatterLineSeries ItemsSource="{Binding TrendTail}"> <telerik:ScatterLineSeries.XValueBinding> <telerik:PropertyNameDataPointBinding PropertyName="Time"/> </telerik:ScatterLineSeries.XValueBinding> <telerik:ScatterLineSeries.YValueBinding> <telerik:PropertyNameDataPointBinding PropertyName="Value"/> </telerik:ScatterLineSeries.YValueBinding> </telerik:ScatterLineSeries> </telerik:RadCartesianChart.Series> </telerik:RadCartesianChart> <StackLayout Orientation="Vertical" Padding="0, 0, 5, 0"> <Label Text="{Binding Value}" Style="{StaticResource ValueStyle}"></Label> <Label Text="{Binding Unit}" Style="{StaticResource MinorText}" HorizontalTextAlignment="Center" VerticalTextAlignment="Start"></Label> </StackLayout> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </infrastructure:CustomListView> </StackLayout> </ContentPage.Content></ContentPage>
namespace Mobile.ViewModels{ using ReactiveUI; public class ParameterViewModel : ReactiveObject { private string _friendlyName; public string FriendlyName { get { return _friendlyName; } set { this.RaiseAndSetIfChanged(ref _friendlyName, value); } } private string _tagId; public string TagId { get { return _tagId; } set { this.RaiseAndSetIfChanged(ref _tagId, value); } } private string _statusImg; public string StatusImg { get { return _statusImg; } set { this.RaiseAndSetIfChanged(ref _statusImg, value); } } private string _value; public string Value { get { return _value; } set { this.RaiseAndSetIfChanged(ref _value, value); } } private string _unit; public string Unit { get { return _unit; } set { this.RaiseAndSetIfChanged(ref _unit, value); } } private TrendData[] _trendTail; public TrendData[] TrendTail { get { return _trendTail; } set { this.RaiseAndSetIfChanged(ref _trendTail, value); } } private decimal _reference; public decimal Reference { get { return _reference; } set { this.RaiseAndSetIfChanged(ref _reference, value); } } } public class TrendData : ReactiveObject { private decimal _value; public decimal Value { get { return _value; } set { this.RaiseAndSetIfChanged(ref _value, value); } } private decimal _time; public decimal Time { get { return _time; } set { this.RaiseAndSetIfChanged(ref _time, value); } } }}
Does anyone know what I'm doing wrong? Or have any questions about my implementation?