简体   繁体   English

使用ASP.NET在C#中进行图表绘制

[英]charting in c# using asp.net

Can we design a point chart with y axis values say xyz,abc etc and x axis with dates. 我们可以设计一个点图,其中y轴的值表示xyz,abc等,而x轴的日期。 This means xyz may be in 28/11/2012 but the actual x axis values would be fixed with say one month interval. 这意味着xyz可能在2012年11月28日,但是实际的x轴值将固定为一个月的间隔。

The point should be mapped on the proper spot. 该点应映射在适当的位置。

If we can design this, then please let me know how. 如果可以设计,请告诉我。

Use standard values for the Points and add the date as AxisLabel Points使用标准值,并将日期添加为AxisLabel

public Series CreateSeries(Dictionary<DateTime, double> values)
{
    var series = new Series();

    //Our x Value   
    var x = 0;
    //Loop through our values-Collection ordered by the date
    foreach (var value in values.OrderBy(item => item.Key))
    {
        //Add a point using our dummy value
        series.Points.Add(
            new DataPoint(x, value.Value) 
            {
                //AxisLabel sets the X-Axis-Label - here: our datestring
                AxisLabel = item.Key.ToShortDateString() 
            });
        //increment our dummy
        x++;
    }

    return series;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM