【问题标题】:Displaying a chart in a view with razor [duplicate]用剃刀在视图中显示图表[重复]
【发布时间】:2013-07-19 20:08:31
【问题描述】:

我有一个网络应用程序,我需要在我的视图中添加一个图表:

   @{
    ViewBag.Title = "Travail";
    Layout = "~/Views/Shared/Template.cshtml";

}

    @using System.Web.Helpers;
    @section logout {
        <a href='@Url.Action("Retour", "Client")'><img src="~/Content/images/home-icon.png" /></a>
        <a href='@Url.Action("Logout", "Home")' style="margin-left: 91.6%"><img src="~/Content/images/images.jpg" style="width:37px; height:37px" /></a>
        }
    @{
        var ar = new Planning.Models.Arbre();
        var dataView = ar.Get_List_Tache();
        List<string> descr = new List<string>();
        List<int> avance = new List<int>();
        foreach( Planning.Models.Tache tac in dataView){
            descr.Add(tac.Tache_description);
            avance.Add(tac.Avancement);
       }
        Chart chartXml;
        var filePathName = "_ChartFiles/XmlChart.xml";
        if (File.Exists(Server.MapPath(filePathName)))
        {
            chartXml = new Chart(width: 200,
                                 height: 200);
        } 
        else{
        chartXml = new Chart(width: 200,
                                 height: 200);
        chartXml.AddTitle("Avancement de taches");
        chartXml.AddSeries(
            name: "Les taches",
            axisLabel: "Les taches",
            xValue: descr,
            yValues: avance);
        chartXml.SaveXml(path: filePathName);}


        }
    <div>@chartXml.Write()</div>

如何在此视图中显示图表?有什么建议吗?

【问题讨论】:

    标签: c# .net asp.net-mvc razor charts


    【解决方案1】:

    【讨论】:

    • 请看我的编辑。现在的问题是模板没有显示,只有图表在这里
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-14
    • 2018-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多