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

3 posts, 0 answers
  1. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 10 Mar 2015 Link to this post

    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. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 11 Mar 2015 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 11 Mar 2015 Link to this post

    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.
Back to Top