2014-09-19 2 views
0

Я хочу, чтобы проверить этот пример с MVC4КРАСИВАЯ АНАЛИТИКА КАРТА В MVC4 не работает?

<html> 
<head> 
    <title>Beautiful Analytics Chart</title> 
<script type='text/javascript' src='js/lib/prototype.js'></script> 
<script type='text/javascript' src='js/lib/raphael.js'></script> 
<script type='text/javascript' src='js/analytics.js'></script> 
</head> 
<body> 
<div id='line-chart-holder'></div> 
<table id="d1" style='display: none;'> 
    <tfoot> 
     <tr> 
     <th>3/02</th> 
     <th>3/03</th> 
     <th>3/09</th> 
     <th>3/16</th> 
     </tr> 
    </tfoot> 
<tbody class='data'> 
    <tr> 
     <td>70</td> 
     <td>70</td> 
     <td>210</td> 
     <td>490</td> 
    </tr> 
</tbody> 
<tbody class='line1'> 
    <tr> 
     <td>70 Views</td> 
     <td>70 Views</td> 
     <td>210 Views</td> 
     <td>490 Views</td> 
    </tr> 
</tbody> 
<tbody class='line2'> 
    <tr> 
     <td>Mar 2nd 2011</td> 
     <td>Mar 3rd 2011</td> 
     <td>Mar 9th 2011</td> 
     <td>Mar 16th 2011</td> 
    </tr> 
</tbody> 
</table> 
<script type='text/javascript'> 
    Element.observe(window,'load', function(){ 
     var w = 840; // you can make this dynamic so it fits as you would like 
     var linechart = Raphael('line-chart', w, 250); // init the raphael obj and give it a width plus height 
     drawLine({ // call the drawLine function 
     holder: linechart, // pass through the raphael obj 
     data_holder: 'd2', // find the table data source by id 
     mastercolor: '#01A8F0', // set the line color 
     spewidth: w, // pass in the same width 
     showarea: true, // show the area 
     mousecoords: 'rect' // rect (uses blanket mode) | circle (pinpoints the points) 
     }); 
    }); 
</script> 
</body> 
</html> 

Я беру этот пример из http://joedesigns.com/labs/Beautiful-Analytics-Chart/. При использовании Asp.net MVC4 он не генерирует svm, однако, если я использую любой редактор html и его выполнение работает.

Я добавил raphae.js, используя пакет nuget, но prototype.js и analytics.js были добавлены manaully в папку Script.

любая причина, по которой его не работает?

это мой взгляд

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <title>@ViewBag.Title - My ASP.NET Application</title> 
    @Styles.Render("~/Content/css") 
    @Scripts.Render("~/bundles/modernizr") 
    <script type='text/javascript' src="~/Scripts/jquery-1.10.2.min.js"></script> 
    <script type='text/javascript' src="~/Scripts/jquery.validate.min.js"></script> 
    <script type='text/javascript' src="~/Scripts/jquery.validate.unobtrusive.min.js"></script> 
    <script type='text/javascript' src="~/Scripts/prototype.js"></script> 
    <script type='text/javascript' src="~/Scripts/raphael-min.js"></script> 
    <script type='text/javascript' src="~/Scripts/analytics.js"></script> 

    <script type='text/javascript'> 
    Element.observe(window, 'load', function() { 
     var w = 840; // you can make this dynamic so it fits as you would like 
     var linechart = Raphael('line-chart-holder', w, 250); // init the raphael obj and give it a width plus height 
     drawLine({ // call the drawLine function 
      holder: linechart, // pass through the raphael obj 
      data_holder: 'd1', // find the table data source by id 
      mastercolor: '#01A8F0', // set the line color 
      spewidth: w, // pass in the same width 
      showarea: true, // show the area 
      mousecoords: 'rect' // rect (uses blanket mode) | circle (pinpoints the points) 
     }); 
    }); 


    </script> 


</head> 
<body> 
    <div class="navbar navbar-inverse navbar-fixed-top"> 
     <div class="container"> 
      <div class="navbar-header"> 
       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> 
        <span class="icon-bar"></span> 
        <span class="icon-bar"></span> 
        <span class="icon-bar"></span> 
       </button> 
       @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) 
      </div> 
      <div class="navbar-collapse collapse"> 
       <ul class="nav navbar-nav"> 
        <li>@Html.ActionLink("Home", "Index", "Home")</li> 
        <li>@Html.ActionLink("About", "About", "Home")</li> 
        <li>@Html.ActionLink("Contact", "Contact", "Home")</li> 
       </ul> 
       @Html.Partial("_LoginPartial") 
      </div> 
     </div> 
    </div> 
    <div class="container body-content"> 

     @RenderBody() 
     <hr /> 
     <footer> 
      <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p> 
     </footer> 
    </div> 

    @Scripts.Render("~/bundles/jquery") 
    @Scripts.Render("~/bundles/bootstrap") 
    @RenderSection("scripts", required: false) 
</body> 
</html> 

расположение и мой взгляд индекс

@{ 
    ViewBag.Title = "Home Page"; 
} 
<div id='line-chart-holder'></div> 
<table id="d1" style='display: none;'> 
    <tfoot> 
     <tr> 
      <th>3/02</th> 
      <th>3/03</th> 
      <th>3/09</th> 
      <th>3/16</th> 
     </tr> 
    </tfoot> 
    <tbody class='data'> 
     <tr> 
      <td>70</td> 
      <td>70</td> 
      <td>210</td> 
      <td>490</td> 
     </tr> 
    </tbody> 
    <tbody class='line1'> 
     <tr> 
      <td>70 Views</td> 
      <td>70 Views</td> 
      <td>210 Views</td> 
      <td>490 Views</td> 
     </tr> 
    </tbody> 
    <tbody class='line2'> 
     <tr> 
      <td>Mar 2nd 2011</td> 
      <td>Mar 3rd 2011</td> 
      <td>Mar 9th 2011</td> 
      <td>Mar 16th 2011</td> 
     </tr> 
    </tbody> 
</table> 
+0

вы хотите, чтобы показать свой Mvc соответствующий код, как мы должны помогать? –

+0

@EhsanSajjad Я добавил код, я использую шаблон проекта для создания приложений Asp.net MVC – Cyberguille

ответ

0

Я нашел решение моей проблемы. Хотя я бы хотел понять, почему, когда я добавляю файл analyttic.js, папка Script и ссылка в заголовке не работает?

Решение моей проблемы был введен код analytic.js на мой взгляд, индекс

@{ 
    ViewBag.Title = "Home Page"; 
} 
<div id='line-chart-holder'></div> 
<table id="d1" style='display: none;'> 
    <tfoot> 
     <tr> 
      <th>3/02</th> 
      <th>3/03</th> 
      <th>3/09</th> 
      <th>3/16</th> 
     </tr> 
    </tfoot> 
    <tbody class='data'> 
     <tr> 
      <td>70</td> 
      <td>70</td> 
      <td>210</td> 
      <td>490</td> 
     </tr> 
    </tbody> 
    <tbody class='line1'> 
     <tr> 
      <td>70 Views</td> 
      <td>70 Views</td> 
      <td>210 Views</td> 
      <td>490 Views</td> 
     </tr> 
    </tbody> 
    <tbody class='line2'> 
     <tr> 
      <td>Mar 2nd 2011</td> 
      <td>Mar 3rd 2011</td> 
      <td>Mar 9th 2011</td> 
      <td>Mar 16th 2011</td> 
     </tr> 
    </tbody> 
</table> 

<script type='text/javascript'> 

....///Code of analytic.js////// http://joedesigns.com/labs/Beautiful-Analytics-Chart/js/analytics.js 
</script> 
Смежные вопросы