title: Displaying a chart in a view with razor
body: <p>I have a web application and i need to add a chart in my view :</p>
  
  <pre><code>   @{
      ViewBag.Title = "Travail";
      Layout = "~/Views/Shared/Template.cshtml";
  
  }
  
      @using System.Web.Helpers;
      @section logout {
          &lt;a href='@Url.Action("Retour", "Client")'&gt;&lt;img src="~/Content/images/home-icon.png" /&gt;&lt;/a&gt;
          &lt;a href='@Url.Action("Logout", "Home")' style="margin-left: 91.6%"&gt;&lt;img src="~/Content/images/images.jpg" style="width:37px; height:37px" /&gt;&lt;/a&gt;
          }
      @{
          var ar = new Planning.Models.Arbre();
          var dataView = ar.Get_List_Tache();
          List&lt;string&gt; descr = new List&lt;string&gt;();
          List&lt;int&gt; avance = new List&lt;int&gt;();
          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);}
  
  
          }
      &lt;div&gt;@chartXml.Write()&lt;/div&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/MBcVG.jpg" alt="capture">
  how can i display the chart in this view?Any suggestions?</p>