Chart Not Showing All Data
<p>So i just started learning MVC, and Im learning to produce graph.
Im trying to pull data from SQL server and place it in X and Y axis.
My problem is, on the y axis, it populate till the end of my db but my x axis only shows 1 data from db.
Or am i doing everything wrong?
Do help. TQVM.</p>

<p>controller code:</p>

<pre><code>public ActionResult MyBarGraph()
    {
        DB.Open();
        DataTable data = DB.GetTable("SELECT * FROM tblproduct");
        DB.Close();
        Chart c = new Chart(width: 800, height: 200);
        foreach(DataRow item in data.Rows)
        {
            c.AddSeries(
            chartType: "column",
            xValue: new[] {item["productname"]},
            yValues: new[] { item["quantity"] });
        }
        c.Write("png");

        return null;
    }
</code></pre>

<p>view code:</p>

<pre><code>&lt;div&gt;
&lt;h2&gt;Bar Graph Example&lt;/h2&gt;
    &lt;img src="@Url.Action("MyBarGraph")" alt="SimpleChart" /&gt;
&lt;/div&gt;
</code></pre>

<p>image : </p>

<p><a href="https://i.stack.imgur.com/y9CQc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y9CQc.png" alt="only Apple is shown"></a></p>

<p>updated-image:</p>

<p><a href="https://i.stack.imgur.com/QyE0e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QyE0e.png" alt="new problem"></a></p>