We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

EJChart Error

Hi,

I am commenting out this line in the declarative section 

//.Load("onChartLoad")

Now I am trying to programmatically call the same in ready function

    $(document).ready(function () {
        var chartObj = $("#ejChart").ejChart("instance");
        onChartLoad(chartObj);
    });

But I am getting the following error:

ej.web.all.min.js:10 Uncaught ejChart: methods/properties can be accessed only after plugin creation
Error: ejChart: methods/properties can be accessed only after plugin creation
    at t.throwError (http://localhost:65480/Scripts/ej/ej.web.all.min.js:10:27404)
    at x.n.fn.(anonymous function) [as ejChart] (http://localhost:65480/Scripts/ej/ej.web.all.min.js:10:21413)
    at HTMLDocument.<anonymous> (http://localhost:65480/:48:38)
    at c (http://localhost:65480/Scripts/jquery-1.10.2.min.js:21:26036)
    at Object.fireWith [as resolveWith] (http://localhost:65480/Scripts/jquery-1.10.2.min.js:21:26840)
    at Function.ready (http://localhost:65480/Scripts/jquery-1.10.2.min.js:21:3305)
    at HTMLDocument.q (http://localhost:65480/Scripts/jquery-1.10.2.min.js:21:717)

Where and how do I call the function programmatically instead of declarative style?

Thanks,

Deepak

4 Replies

DD Dharanidharan Dharmasivam Syncfusion Team October 5, 2016 07:12 AM UTC

Hi Deepak, 

Thanks for using Syncfusion product. 
We have analyzed your query. You are trying to  get the instance for the chart in the $(document).ready() method, at this point, chart won’t get loaded in the page and hence you are getting this exception. In this case, you can use window.onload() function, this will be executed only after the page is fully loaded, so that you can get instance for the chart. Find the code snippet below, 

Code Snippet: 
ASP.NET MVC 

window.onload = function () { 
        var chart = $("#Container").ejChart("instance"); 
        onChartLoad(chart); 
    } 

 
Screenshot: 
   
  
 For your reference, we have attached the sample. Kindly find the attachment below, 
  
Thanks, 
Dharani. 



LA lavanyadeepak October 5, 2016 07:23 AM UTC

Two quick questions.

1) Isn't $(document).ready and window.onload identical?

2) I tried to use your sample application. The web.config bombed

<assemblies>
<add assembly="Syncfusion.EJ"/>
<add assembly="Syncfusion.EJ.Mvc"/>
</assemblies>

When I comment this code, I got the error as below

Server Error in '/' Application.

Compilation Error

Description:An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message:CS0246: The type or namespace name 'Syncfusion' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 2:  @using Syncfusion.JavaScript.Models;
Line 3:  @using MvcApplication1.Controllers;
Line 4:  @using Syncfusion.JavaScript
Line 5:  @using Syncfusion.MVC.EJ
Line 6:   

Source File:c:\Users\dvasudev\Desktop\Sample-970312072\mvc - Copy\MvcApplication1\Views\Home\Index.cshtml Line:4






Version Information:Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408



LA lavanyadeepak October 5, 2016 07:35 AM UTC

Bumping into more errors adding references from GAC:

1>  No way to resolve conflict between "Syncfusion.Linq.Base, Version=14.3450.0.49, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" and "Syncfusion.Linq.Base, Version=14.3350.0.49, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89". Choosing "Syncfusion.Linq.Base, Version=14.3450.0.49, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" arbitrarily.
1>  Consider app.config remapping of assembly "Syncfusion.Linq.Base, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" from Version "14.3350.0.49" [D:\Program Files (x86)\Syncfusion\Essential Studio\14.3.0.49\Assemblies\3.5\Syncfusion.Linq.Base.dll] to Version "14.3450.0.49" [D:\Program Files (x86)\Syncfusion\Essential Studio\14.3.0.49\Assemblies\4.5\Syncfusion.Linq.Base.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Syncfusion.Linq.Base" culture="neutral" publicKeyToken="3d67ed1f87d44c89" /><bindingRedirect oldVersion="0.0.0.0-14.3450.0.49" newVersion="14.3450.0.49" /></dependentAssembly></assemblyBinding>
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
1>  MvcApplication1 -> C:\Users\dvasudev\Desktop\Sample-970312072\mvc - Copy\MvcApplication1\bin\MvcApplication1.dll


DD Dharanidharan Dharmasivam Syncfusion Team October 5, 2016 02:04 PM UTC

Hi Deepak, 
  
We have analyzed your queries. Kindly find the responses for your queries below. 
  
Query 1: Isn't $(document).ready and window.onload identical? 
Functions $(document).ready and window.onload are not identical. Since  $(document).ready function will be executed once the Dom is ready and  window.onload function will be executed only after the page is fully loaded. 
  
For more information on $(document).ready and window.onload, kindly follow the link below, 
  
Query 2: I tried to use your sample application. The web.config bombed 
Sorry for the inconvenience caused. We have attached the sample, kindly find the sample from below link, 
  
Thanks, 
Dharani. 


Loader.
Up arrow icon