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

"n is not a constructor"

2 Answers 781 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Howard
Top achievements
Rank 1
Howard asked on 07 Mar 2019, 07:40 PM

I am using version 2019.1.220 with Kendo UI for ASP.NET MVC, having upgraded recently from 2016.1.112, and I am now getting a Javascript error: "n is not a constructor". My chart is fairly simple:

@(Html.Kendo().Chart(Model.Errors)
    .Name("AppErrorsChart")
    .Title("Error BreakDown By % Frequency?")
    .Legend(legend => legend
        .Position(ChartLegendPosition.Top)
    )
    .Series(series =>
    {
        series.Pie<int>(model => model.Count, model => model.Type)
        .Labels(labels => labels
            .Visible(true)
            .Template("#= category # - #= kendo.format('{0:P}', percentage)#")
        );
    })
    .Tooltip(tooltip => tooltip.Visible(true).Template("#= dataItem.Error# (#= value#)").Color("#FFF"))
    .Events(e => e.SeriesClick("onCategorySeriesClick").AxisLabelClick("onCategorySeriesClick")
    )
)

 

Here is a Dojo that I created that demonstrates this: https://dojo.telerik.com/OBUzIVif

 

The error is in kendo.web.js, as shown in the attached screenshot.

 

Please advise on a course of action. Thank you.

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 11 Mar 2019, 09:54 AM
Hello Howard,

The problem is specifically in having a reference to kendo.web.min.js. When there is a kendo.all.min.js reference, all Kendo UI widgets are already included in the page and you should not reference subsets of the Kendo UI library (web, dataviz, etc.).

In this scenario, when kendo.web.min.js is referenced after kendo.all.min.js, it overwrites the plugins registered by the "all" file and widgets that are not part of the "web" subset, including the Chart, cannot be loaded. You can see in the Dojo that if you remove the "web" reference, the Chart loads successfully.

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Howard
Top achievements
Rank 1
answered on 11 Mar 2019, 04:51 PM
Great, thank you so much. We had the references to both when using the 2016 version and it did not cause any problems, so there was no reason for us to think any different this time.
Tags
Chart
Asked by
Howard
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Howard
Top achievements
Rank 1
Share this question
or