Zedgraph硬编码轴

时间:2015-02-16 01:07:37

标签: c# zedgraph

tempTime = new DateTime(1989, 1, 1, Convert.ToInt32(tempTime.ToString("HH")) + 1, 0, 0);

string[] labels = new string[(totalMinutes / 60) + 3];
for (int a = 0; a < (totalMinutes / 60) + 3; a++)
{
    tempTime = tempTime.AddHours(1);
    labels[a] = tempTime.ToString("hh") + tempTime.ToString("tt");
}
//for (int i = 1; i < 20; i++)
//    labels[i] = "" + i * 2;
graph.XAxis.Type = AxisType.Text;
graph.XAxis.Scale.TextLabels = labels;

上面是我硬编码zed图x轴的代码,在我硬编码之前,这就是图形

http://i.stack.imgur.com/SNrm7.png

将代码应用到硬编码后,就会变成这样,请帮忙

1 个答案:

答案 0 :(得分:0)

    string XAxis_ScaleFormatEvent(GraphPane pane, Axis axis, double val, int index)
    {
        if (index == 0)
        {
            return "this is 0 index";
        }
        else
        {
            return "else this is not 0 index";
        }
    }

找到答案,我需要在图表中添加事件内部格式事件,每个标签硬编码