2017-02-20 83 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

描述