I'm facing issue while binding RadCartesianChart, application is crashing. With the help of application log both x-axis and y-axis value are passing but still getting null reference exception.
Logged the stack. Please help
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.UI.Xaml.Controls.Chart.PresenterBase.CreateContentPresenter(Object content, DataTemplate template)
at Telerik.UI.Xaml.Controls.Chart.Axis.CreateLabelVisual(AxisLabelModel label)
at Telerik.UI.Xaml.Controls.Chart.Axis.GetLabelVisual(AxisLabelModel label, Int32 index)
at Telerik.UI.Xaml.Controls.Chart.Axis.MeasureLabel(AxisLabelModel label, Object content)
at Telerik.Charting.AxisModel.MeasureCo
----Stack----
at Telerik.UI.Xaml.Controls.Chart.PresenterBase.CreateContentPresenter(Object content, DataTemplate template)
at Telerik.UI.Xaml.Controls.Chart.Axis.CreateLabelVisual(AxisLabelModel label)
at Telerik.UI.Xaml.Controls.Chart.Axis.GetLabelVisual(AxisLabelModel label, Int32 index)
at Telerik.UI.Xaml.Controls.Chart.Axis.MeasureLabel(AxisLabelModel label, Object content)
at Telerik.Charting.AxisModel.MeasureCore(RadSize availableSize)
at Telerik.Charting.AxisModel.Measure(RadSize availableSize)
at Telerik.Charting.CartesianChartAreaModel.AxisStack.Measure(RadSize availableSize)
at Telerik.Charting.CartesianChartAreaModel.PrepareAxesStacks(RadSize availableSize)
at Telerik.Charting.CartesianChartAreaModel.ArrangeAxes(RadRect availableRect)
at Telerik.Charting.ChartAreaModelWithAxes.ArrangeOverride(RadRect rect)
at Telerik.Core.Node.Arrange(RadRect rect, Boolean shouldRoundLayout)
at Telerik.Core.RootElement.Arrange()
at Telerik.UI.Xaml.Controls.Chart.RadChartBase.CallUpdateUI()
at Telerik.UI.Xaml.Controls.Chart.RadChartBase.InvalidateLayout()
-------------
Thanks
Hi,
I have following code for line chart and I would like to change the X value filed from number (1,2,3 ... ,12) to name of the months (Jan, Feb... Dec). Down below is my code.
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="1500px" Height="500px" DataSourceID="dsResults" InvokeLoadData="OnPageLoad" >
<Legend>
<Appearance Position="Right" BackgroundColor="#cccccc" Visible="true">
<TextStyle FontSize="14" Bold="true" />
</Appearance>
</Legend>
<PlotArea>
<Series>
<telerik:LineSeries Name="CY Percent Obligated" DataFieldY="CY_PCT_OBS">
<Appearance>
<FillStyle BackgroundColor="#003300" />
</Appearance>
<MarkersAppearance MarkersType="Square" BackgroundColor="#003300" BorderColor="ForestGreen" />
<LabelsAppearance Visible="false">
</LabelsAppearance>
<TooltipsAppearance BackgroundColor="White">
<ClientTemplate>
#=dataItem.CY_PCT_OBS#
</ClientTemplate>
</TooltipsAppearance>
</telerik:LineSeries>
<telerik:LineSeries Name="Percent Obligated 2017" DataFieldY="PY1_PCT_OBS">
<Appearance>
<FillStyle BackgroundColor="#009933" />
</Appearance>
<MarkersAppearance MarkersType="Square" BackgroundColor="#009933" BorderColor="ForestGreen" />
<LabelsAppearance Visible="false">
</LabelsAppearance>
<TooltipsAppearance BackgroundColor="White">
<ClientTemplate>
#=dataItem.PY1_PCT_OBS#
</ClientTemplate>
</TooltipsAppearance>
</telerik:LineSeries>
...
</Series>
<XAxis BaseUnit="Months" MinValue="1" MaxValue="12" DataLabelsField="FM" MajorTickType="Outside" Color="Black" Width="2px">
<LabelsAppearance DataFormatString="MM" RotationAngle="0" Skip="0" Step="1">
<TextStyle Bold="true" FontSize="16" Color="Black" />
</LabelsAppearance>
<TitleAppearance Position="Center" RotationAngle="0" Text="Fiscal month"></TitleAppearance>
</XAxis>
<YAxis Color="Black" Width="2px">
<LabelsAppearance DataFormatString="{0}%" RotationAngle="0" Skip="0" Step="1">
<TextStyle Bold="true" Color="Black" />
</LabelsAppearance>
<TitleAppearance Position="Center" RotationAngle="0" Text="Percentage"></TitleAppearance>
</YAxis>
</PlotArea>
</telerik:RadHtmlChart >