如何将TChart点系列底部文字隐藏起来?

时间:2014-08-12 01:21:13

标签: visual-studio-2005 teechart

我使用的是TChart版本.Net& VS2005。

添加点序列的问题。

TChart点系列底部文字如何隐藏?

请帮帮我。谢谢。 =)

我的代码:

    private void GridNotch()
    {
        Steema.TeeChart.Styles.Points NotchPoint = new Steema.TeeChart.Styles.Points();
        TChart1.Series.Add(NotchPoint);

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

        axis.StartPosition = 5;
        axis.EndPosition = 5;

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

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

        TChart1.Series[TChart1.Series.Count - 1].CustomVertAxis = axis;

        if (dt_Notch.Columns.Count == 0)
        {
            dt_Notch.Columns.Add("Value", typeof(int));
            dt_Notch.Columns.Add("Label", typeof(string));

            DataRow row;
            row = dt_Notch.NewRow();
            row["Value"] = "100";
            row["Label"] = "B5";
            dt_Notch.Rows.Add(row);
        }

        TChart1.Series[TChart1.Series.Count - 1].XValues.DataMember = "Value";
        TChart1.Series[TChart1.Series.Count - 1].YValues.DataMember = "Value";
        TChart1.Series[TChart1.Series.Count - 1].LabelMember = "Label";
        TChart1.Series[TChart1.Series.Count - 1].DataSource = dt_Notch;
    }

我的图表:enter image description here 想要图表:enter image description here

1 个答案:

答案 0 :(得分:1)

我看到你在代码中指定了“B5”:

row["Label"] = "B5";

您可以删除该标签或强制您的底部轴显示值而不是标签:

TChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Value;