2013-06-20 29 views

回答

0

我对LinearAxis做了类似的事情。您必须创建自己的从DateTimeAxis继承的轴。我不知道这将是对你的情况有什么不同,但这里是我做了一个LinearAxis:

chart.XAxis = new IRLinearAxis() 
     { 
      ... 
      ShowLabels = true, 
      LabelFormatString = "feet",//This only works because I overrode the format function in the IRLinearAxis class 

     }; 

和类:

class IRLinearAxis : LinearAxis 
{ 
    protected override string GetFormattedDataValueInternal(double dataValue, string formatString) 
    { 
     return String.Format("{0} " + formatString, base.GetFormattedDataValueInternal(dataValue, ""));//ignore the formatString and just use the units that were passed as the formatString 
    } 

} 

我敢肯定有一个更优雅的方式传入你的单位并保持格式化,但这对我有用。

+0

我可以告诉你这里是新的。如果这适用于您,请选择此作为接受的答案,并且如果有用,请选择upvote。 – NielW