This is a migrated thread and some comments may be shown as answers.

RadHtmlChart : 0x800a138f - JavaScript runtime error: Unable to get property 'length' of undefined or null reference

2 Answers 112 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Gauri
Top achievements
Rank 1
Gauri asked on 10 Mar 2015, 04:14 PM
While loading the boxplot chart I'm getting above error. I will appreciate if you can help me figure out, why.

I have spent a lot of time on this with no luck.

Thanks.
Gauri

Here is the chart design 
<telerikUI:RadHtmlChart runat="server" ID="chartDrilldownPLOS" Width="770" Height="230">
                    <Appearance>
                        <FillStyle BackgroundColor="White"></FillStyle>
                    </Appearance>
                    <ChartTitle>
                        <Appearance Visible="false"></Appearance>
                    </ChartTitle>
                    <PlotArea>
                        <Series>
                            <telerikUI:BoxPlotSeries
                                DataLowerField="Q1Min"
                                DataQ1Field="Q2Min"
                                DataMedianField="GroupMean"
                                DataQ3Field="Q3Max"
                                DataUpperField="Q4Max">
                                
                                <Appearance FillStyle-BackgroundColor="#165b8c"></Appearance>

                                <TooltipsAppearance Color="#165b8c" BackgroundColor="#67adda">
                                    <ClientTemplate>
                                        Minumum: #=dataItem.Q1Min# <br />
                                        25th Percentile: #=dataItem.Q2Min# <br />
                                        Median: #=dataItem.GroupMean# <br />
                                        75th Percentile: #=dataItem.Q3Max# <br />
                                        Maximum: #=dataItem.Q4Max# <br />
                                    </ClientTemplate>
                                </TooltipsAppearance>
                            </telerikUI:BoxPlotSeries>
                        </Series>
                        <XAxis>
                            <MinorGridLines Visible="false" />
                            <MajorGridLines Visible="false" />
                            <Items></Items>
                        </XAxis>
                        <YAxis>
                            <MinorGridLines Visible="false" />
                        </YAxis>
                        
                    </PlotArea>
                </telerikUI:RadHtmlChart>


Here is the code to load it

        private void LoadChartDrilldownPLOS(int drilldownLevel, string hospitals, string surgeons)
        {
            using (var chartingctx = new ChartingDataContext())
            {
                var resultFromDb = chartingctx.getPLOSDrillDown(sourceType, riskCategory, riskLevel,
                    cbbDateType.SelectedValue == "1" ? true : false, dtpStartDate.SelectedDate, dtpEndDate.SelectedDate,
                    hospitals, surgeons, chkIndexOperation.Checked, drilldownLevel);

                chartDrilldownPLOS.PlotArea.XAxis.Items.Clear();
                DataTable datatable = new DataTable();
                datatable.Columns.Add("Q1Min");
                datatable.Columns.Add("Q2Min");
                datatable.Columns.Add("Q3Max");
                datatable.Columns.Add("Q4Max");
                datatable.Columns.Add("GroupMean");
                foreach (var result in resultFromDb)
                {
                    chartDrilldownPLOS.PlotArea.XAxis.Items.Add(new AxisItem(result.DateGroup));
                    datatable.Rows.Add(new object[] { result.Q1Min ?? 0, result.Q2Min ?? 0, result.Q3Max ?? 0, result.Q4Max ?? 0, 
                        result.GroupMean ?? 0 });
                }
                                
                chartDrilldownPLOS.DataSource = datatable;
                chartDrilldownPLOS.DataBind();
            }
            drilldownTypePLOS = drilldownLevel;
        }









































2 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 11 Mar 2015, 09:23 AM
Hi Gauri,

I would suggest that you hardcode some dummy data and provide it below, so that I can run the example and investigate the issue. Can you also tell me which version of Telerik UI you are using?

Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gauri
Top achievements
Rank 1
answered on 11 Mar 2015, 01:03 PM
I fund the solution. The chart always needs 6 elements and this code was using 5 elements. So it was not able t plot the chart.
Tags
Chart (HTML5)
Asked by
Gauri
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Gauri
Top achievements
Rank 1
Share this question
or