こんにちは、ASP.NET MVC 3 プロジェクトで値間の距離が異なるグラフを提示したいと思います。したがって、xCords には文字列を使用し、yCords には float を使用しています。
public FileContentResult CreateChart()
{
string[] xCords; float[] yCords;
[... "fill xCords an yCords" ...]
Chart bytes = new Chart(width: 800, height: 400)
.AddSeries(
chartType: "line",
xValue: xCords,
yValues: yCords
);
return File(bytes.GetBytes("png"), "image/png");
}
問題は、すべての値の間に同じ距離があることです。したがって、ドット プロットというより棒グラフに近い名前を付けることができます。その理由は x 値の型文字列にあると想像できますが、修正方法がわかりません。
編集: xCords のタイプを DateTime に変更したときに xCords を生成する方法:
xCords = new DateTime[stockAquires.Count];
{
foreach (StockAquire stockAquire in stockAquires)
{
xCords[stockAquires.IndexOf(stockAquire)] = stockAquire.RatingTime;
}
}
StockAquire には次のプロパティが含まれます: RatingTime
stockAquires には、StockAquire タイプのエントリが多数含まれています。