Zedgraph 硬码轴
Zedgraph Hard code axis
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轴的代码,在我硬编码之前,这是图
硬编码后变成这样,求助
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";
}
}
找到答案,我需要在图中的格式事件中添加事件,通过每个标签对其进行硬编码
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轴的代码,在我硬编码之前,这是图
硬编码后变成这样,求助
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";
}
}
找到答案,我需要在图中的格式事件中添加事件,通过每个标签对其进行硬编码