2017-02-20 103 views
0

爲什麼此頁面不顯示佈局或ViewBag.Title? 「MyChart」呈現正常,但是當調用「Write」函數時,它會用渲染圖像替換所有頁面內容。有沒有辦法在渲染圖像之前或之後向頁面添加更多內容?剃刀布局缺失

@model cmCase.Models.xyz 

@{ 
    ViewBag.Title = "Index"; 
    Layout = "~/Views/Shared/_Layout.cshtml"; 
} 

<h2>Index</h2> 

<div class="well"> 
    @{ 
     var myChart = new Chart(width: 1000, height: 400, theme: ChartTheme.Green) 
      .AddTitle("Most Popular") 
      .AddSeries(name: "Employee", xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave" }, yValues: new[] { "2", "6", "4", "5", "3" }) 
      .AddSeries(name: "Employee12", xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave" },yValues: new[] { "2", "6", "4", "5", "3" })      
      .Write(); 
    } 
</div> 

回答

0

好吧,看起來像需要兩個步驟的過程。

的第一步是,以形成產生圖表一個網頁」

第二個步驟是在另一頁,以顯示所得到的圖像。

如這裏using charts in razor

描述