I tried to build a code sample with RadLegend but it throws an exception. i attached my code sample
{Com.Telerik.Android.Common.Exceptions.MissingLayoutPartException: Layout part with id com.companyname.TelerikChart:id/notification_background is missing from the specified layout. at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <034d4a9852dd45bea9353cc7776c99f0>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.FinishCreateInstance (System.String constructorSignature, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0004f] in <034d4a9852dd45bea9353cc7776c99f0>:0 at Com.Telerik.Widget.Primitives.Legend.RadLegendView..ctor (Android.Content.Context p0) [0x0007a] in <3df33cbb9c2a44bbb60084f618a2993d>:0 at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&) at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <43dbbdc147f2482093d8409abb04c233>:0 --- End of managed Com.Telerik.Android.Common.Exceptions.MissingLayoutPartException stack trace ---com.telerik.android.common.exceptions.MissingLayoutPartException: Layout part with id com.companyname.TelerikChart:id/notification_background is missing from the specified layout. at com.telerik.android.common.Util.getLayoutPart(Util.java:139) at com.telerik.android.common.Util.getLayoutPart(Util.java:118) at com.telerik.widget.primitives.legend.RadLegendView.<init>(RadLegendView.java:80) at com.telerik.widget.primitives.legend.RadLegendView.<init>(RadLegendView.java:48) at md573f120baf816a4fba7033ee5f3e60d3f.MainActivity.n_onCreate(Native Method) at md573f120baf816a4fba7033ee5f3e60d3f.MainActivity.onCreate(MainActivity.java:29) at android.app.Activity.performCreate(Activity.java:7009) at android.app.Activity.performCreate(Activity.java:7000) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)}
Xaml code is
<telerikChart:RadCartesianChart x:Name="chart" BackgroundColor="Transparent">
<telerikChart:RadCartesianChart.BindingContext>
<viewModel:CategoricalViewModel/>
</telerikChart:RadCartesianChart.BindingContext>
<telerikChart:RadCartesianChart.HorizontalAxis>
<telerikChart:CategoricalAxis/>
</telerikChart:RadCartesianChart.HorizontalAxis>
<telerikChart:RadCartesianChart.VerticalAxis>
<telerikChart:NumericalAxis/>
</telerikChart:RadCartesianChart.VerticalAxis>
<telerikChart:RadCartesianChart.Series>
<telerikChart:LineSeries CategoryBinding="Category" ValueBinding="Value" ItemsSource="{Binding CategoricalData}" DisplayName="Speed (mph) vs Time" />
</telerikChart:RadCartesianChart.Series>
<telerikChart:RadCartesianChart.Grid>
<telerikChart:CartesianChartGrid MajorLinesVisibility="XY" MajorLineThickness="1"/>
</telerikChart:RadCartesianChart.Grid>
</telerikChart:RadCartesianChart>
<telerikChart:RadLegend LegendItemFontColor="White"
LegendItemFontSize="20"
LegendProvider="{x:Reference Name=chart}" />
ViewModel code is
public class CategoricalData
{
public object Category { get; set; }
public double Value { get; set; }
}
public class CategoricalViewModel
{
private static Random random = new Random();
private static string[] categories = new string[] { "Greenings", "Perfecto", "NearBy", "Family", "Fresh" };
public CategoricalViewModel()
{
this.CategoricalData = GetCategoricalData();
}
public ObservableCollection<CategoricalData> CategoricalData { get; set; }
public static ObservableCollection<CategoricalData> GetCategoricalData()
{
var data = new ObservableCollection<CategoricalData>();
for (int i = 0; i < categories.Length; i++)
{
data.Add(new CategoricalData() { Value = random.Next(50, 100), Category = categories[i] });
}
return data;
}
}