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

Chart not shown

3 Answers 58 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christian Setzkorn
Top achievements
Rank 1
Christian Setzkorn asked on 19 Dec 2011, 11:08 AM
Hi,

I believe I have registred telerik properly.

This:

<%= Html.Telerik().Menu()
        .Name("Menu")
        .Items(items =>
        {
            items.Add().Text("Item 11");
            items.Add().Text("Item 2");
        })
%>

shows a menu.

However, this:

<%= Html.Telerik().Chart()
        .Name("chart")
        .Title(title => title
            .Text("Representative Sales vs. Total Sales")
        )
        .Series(series => {
            series.Bar(new int[] { 2015, 6003, 6881 }).Name("Representative Sales");
            series.Bar(new int[] { 15458, 26598, 27623 }).Name("Total Sales");
        })
        .CategoryAxis(axis => axis
            .Categories(new string[] { "Aug 2010", "Sept 2010", "Oct 2010" })
        )
%>

shows nothing (code on the same page). I really do not know why. Any ideas? Thanks.

Christian

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 20 Dec 2011, 09:06 AM
Hello Christian,

I tried to reproduce the problem, but everything works properly on my side. The most likely reasons that the Chart is not displayed are:
  1. If you are using Internet Explorer, you need to enable Binary and Script behaviors from the Internet Options. More information on how to do that is available in the Troubleshooting section of the Chart's documentation.
  2. The Chart and the Menu depend on different JavaScript files to run properly. You should make sure that telerik.chart.min.js and telerik.common.min.js are included in the page you are displaying the Chart on.
If neither of these is the cause in your scenario, I will need a sample project which recreates the problem in order to investigate further.


All the best,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Von
Top achievements
Rank 1
answered on 09 Jan 2012, 04:15 AM
Hi Christian,

I recently used the Chart control and I had the same problem when doing the AjaxBinding. What I did is created a new Telerik MVC 3 project and put a Chart control on the auto-created Home page. Copied the sample code from here and it worked fine. So I went back to my application and compared what's the difference. My application was built from the standard MVC 3 application (non-Telerik). I noticed that I miseed registering Telerik like so:
@(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)))

I know you mentioned that you already registered Telerik but there is one thing that I missed doing that might help in your scenario and that is explicitly including the two required scripts for chart: (1) telerik.common.min.js and (2) telerik.chart.min.js (keep in mind you can also use the non-compressed js files).

I wonder why in the Telerik-based project you don't need to include the scripts and the chart will work. But the chart won't work in a standard MVC project is you do not include those two scripts. Running the Telerik-based project, I checked in fiddler and the two scripts are not even being called. Any thoughts no this Telerik team?

0
Atanas Korchev
Telerik team
answered on 09 Jan 2012, 09:26 AM
Hi,

 All Telerik UI components include their JavaScript files automatically. They do so by using the ScriptRegistrar. If you don't add a ScriptRegistrar to your project all features which need JavaScript won't work (the Chart won't work at all as it is entirely rendered via JavaScript). 

All the best,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Chart
Asked by
Christian Setzkorn
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Von
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or