Code:
01.
@page "/"
02.
@layout MainLayout
03.
04.
<
TelerikChart
>
05.
<
ChartTitle
Text
=
"Unrecoverable Errors Per Minute vs. Signal Level"
/>
06.
<
ChartCategoryAxes
>
07.
<
ChartCategoryAxis
Type
=
"@ChartCategoryAxisType.Category"
/>
08.
</
ChartCategoryAxes
>
09.
<
ChartValueAxes
>
10.
<
ChartValueAxis
>
11.
<
ChartValueAxisLabels
Visible
=
"true"
/>
12.
</
ChartValueAxis
>
13.
</
ChartValueAxes
>
14.
<
ChartTooltip
Visible
=
"true"
>
15.
<
Template
>
16.
@{
17.
// Null for ChartData2 series
18.
var data = context.DataItem as ModelData;
19.
<
div
class
=
"card"
style
=
"font-size: 0.8rem; color: black"
>
20.
<
span
>@($"{data.Value}")</
span
>
21.
<
span
>@($"{data.Type}")</
span
>
22.
</
div
>
23.
}
24.
</
Template
>
25.
</
ChartTooltip
>
26.
<
ChartSeriesItems
>
27.
<
ChartSeries
Type
=
"ChartSeriesType.Line"
28.
Data
=
"@ChartData1"
29.
CategoryField
=
"@nameof(ModelData.Type)"
30.
Field
=
"@nameof(ModelData.Value)"
>
31.
</
ChartSeries
>
32.
<
ChartSeries
Type
=
"ChartSeriesType.Line"
33.
Data
=
"@ChartData2"
34.
CategoryField
=
"@nameof(ModelData.Type)"
35.
Field
=
"@nameof(ModelData.Value)"
>
36.
</
ChartSeries
>
37.
</
ChartSeriesItems
>
38.
</
TelerikChart
>
39.
40.
@code {
41.
public class ModelData
42.
{
43.
public string Type { get; set; }
44.
public double Value { get; set; }
45.
}
46.
47.
public List<
ModelData
> ChartData1 = new List<
ModelData
>() { new ModelData() { Type = "S1", Value = 1 } };
48.
public List<
ModelData
> ChartData2 = new List<
ModelData
>() { new ModelData() { Type = "S2", Value = 5 } };
49.
}
Getting runtine error "System.NullReferenceException" at line 18 while mouse hover on chartdata2 series point