Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用asp.net在c#中绘制图表_C#_Timeline_Charts_Timelinemarkers - Fatal编程技术网

使用asp.net在c#中绘制图表

使用asp.net在c#中绘制图表,c#,timeline,charts,timelinemarkers,C#,Timeline,Charts,Timelinemarkers,我们可以设计一个y轴值为xyz、abc等,x轴值为日期的点图吗。 这意味着xyz可能在2012年11月28日,但实际x轴值将以一个月的间隔固定 该点应映射到适当的点 如果我们可以设计,请告诉我如何操作。使用点的标准值,并将日期添加为AxisLabel public Series CreateSeries(Dictionary<DateTime, double> values) { var series = new Series(); //Our x Value

我们可以设计一个y轴值为xyz、abc等,x轴值为日期的点图吗。 这意味着xyz可能在2012年11月28日,但实际x轴值将以一个月的间隔固定

该点应映射到适当的点


如果我们可以设计,请告诉我如何操作。

使用
点的标准值
,并将日期添加为
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;
}
public系列CreateSeries(字典值)
{
var系列=新系列();
//我们的x值
var x=0;
//循环查看按日期排序的值集合
foreach(values.OrderBy(item=>item.Key)中的var值)
{
//使用我们的虚拟值添加一个点
series.Points.Add(
新数据点(x,value.value)
{
//AxisLabel设置X轴标签-此处:我们的日期字符串
AxisLabel=item.Key.ToSortDateString()
});
//增加我们的假人
x++;
}
返回序列;
}

您使用的是什么图表库?您好,我使用的是mscharts库。谢谢你的回复。它真的帮助了我:)