【问题标题】:Is it possible to display the x-axis values of the DataVisualization.Charting.Chart in hexadecimal?是否可以以十六进制显示 DataVisualization.Charting.Chart 的 x 轴值?
【发布时间】:2014-06-19 08:25:18
【问题描述】:

最近开始在 DataVisualization.Charting 命名空间中使用 .NET 4 中包含的 Chart 控件。我正在做一个项目,在校准期间,FPGA 中使用的延迟值显示在折线图的 x 轴上。该值在别处用作十六进制值。

想知道是否有办法以十六进制格式显示 x 轴标签。这并不重要,因为可以相对轻松地在运行后简单地转换值,但肯定会是一种增强。非常感谢任何帮助。

【问题讨论】:

    标签: c# charts label hex axis


    【解决方案1】:

    Axis 对象中的LabelStyle 具有Format 属性,因此您可以使用任何标准的 C# 格式化字符串。你可以这样设置

    chart1.ChartAreas[0].AxisX.LabelStyle.Format = "X4";
    

    【讨论】:

    • 感谢您的回复。不幸的是,我从代码中得到了 FormatException:chartCalibrate.ChartAreas[0].AxisX.LabelStyle.Format = "x2";
    • 这很好用。抛出异常的值是什么??
    猜你喜欢
    • 1970-01-01
    • 2014-02-07
    • 1970-01-01
    • 2014-12-20
    • 2020-02-13
    • 1970-01-01
    • 2011-07-22
    • 2013-10-21
    • 2019-02-02
    相关资源
    最近更新 更多