gpt4 book ai didi

c# - 如何显示 StringLabelValue?

转载 作者:太空宇宙 更新时间:2023-11-03 11:13:08 33 4
gpt4 key购买 nike

我使用的是 Teechart 版本 .Net & VS2005

X-axis日期和时间图表类型,Y-axis被添加到Point Series。

我想显示 StringLabelValue

我的代码:

private void GridPoint()
{
datatable dt_point = new datatable();

Steema.TeeChart.Styles.Points Pinpoint = new Steema.TeeChart.Styles.Points();
TChart1.Series.Add(Pinpoint);

Pinpoint.Pointer.Visible = false;
Pinpoint.Pointer.InflateMargins = false;
Pinpoint.Pointer.Transparency = 100;
Pinpoint.Pointer.Pen.Visible = false;
Pinpoint.Marks.Color = Color.White;
Pinpoint.Marks.Pen.Color = Color.White;
Pinpoint.Marks.Shadow.Visible = false;
Pinpoint.Marks.Visible = true;

Steema.TeeChart.Axis axis = new Steema.TeeChart.Axis();
TChart1.Axes.Custom.Add(axis);

axis.StartPosition = 9;
axis.EndPosition = 9;

axis.Labels.Items.Add(0, " ");
axis.Labels.Items.Add(2000, " ");
axis.Labels.Items[0].Visible = false;
axis.Labels.Items[1].Visible = false;

axis.Title.Caption = "";
axis.Title.Font.Color = Color.Black;

TChart1.Series[0].CustomVertAxis = axis;
TChart1.Series[0].Clear();

if (dt_Point.Columns.Count == 0)
{
dt_Point.Columns.Add("SetTime", typeof(DateTime));
dt_Point.Columns.Add("Value", typeof(int));
dt_Point.Columns.Add("Label", typeof(string));
}

DataRow row;
row = dt_Point.NewRow();
row["SetTime"] = "2012-08-02 18:14:24";
row["Value"] = 100;
row["Label"] = "Point";
dt_Point.Rows.Add(row);

TChart1.Series[0].XValues.DataMember = "SetTime";
TChart1.Series[0].YValues.DataMember = "Value";
TChart1.Series[0].DataMember = "Label";
TChart1.Series[0].DataSource = dt_Point;
}

显示图表:

我要显示图表:

最佳答案

我建议您将 XValues.DateTime 设置为 true 并更改 Bottom 的 DateTimeFormatStyle轴标签以实现您想要的结果:

//XValues as DateTimeValues.
Pinpoint.XValues.DateTime = true;

//Labels axes style and format
tChart1.Axes.Bottom.Labels.DateTimeFormat = "hh:mm:ss";
tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Value;

关于c# - 如何显示 StringLabelValue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13391458/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com