Zedgraph textobj X 位置取决于文本长度?
我有一个 Zedgraph textobj,我想将其始终放置在相同的 x, y 位置(ASP.NET 图像)。我注意到文本并不总是显示在相同的起始 x 位置。它根据文本的长度而变化。我尝试通过用空格填充来使文本具有相同的长度。它有一点帮助,但结果并不总是一致的。我正在使用 PaneFraction 作为 coordType。
让一段文本始终显示在相同的 x 位置的正确方法是什么?我使用 textobj 作为标题,因为本机标题属性始终显示居中,并且我需要我的标题与图表左对齐。
I have a Zedgraph textobj which I want to place always in the same x, y position (ASP.NET image). I noticed that the text doesn't always show in the same starting x position. It shifts depending on the text's length. I tried to have the text to have the same length by padding it with spaces. It helped a little but the result is not always consistent. I am using PaneFraction for coordType.
What's the proper method to have a piece of text to always show in the same x position. I am using textobj as a title because the native title property always shows up centered and I need my title be left aligned to the graph.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,它不取决于文本长度,但是...
它取决于其他各种因素:
您没有提供任何代码,因此很难判断您是否以及在何处犯了错误(如果有)。但是,如果我是你,我会这样做:
我使用
ChartFraction
坐标而不是PaneFraction
(如 drharris 建议的那样)坐标以使标题与标题很好地对齐图表的左边框。否则它会完全冲到左侧(没有边距等...) - 这样看起来更好。但请确保您没有设置太大的字体大小 - 它可能会被剪裁在顶部
No, it does not depend on text lenght, however...
It depends on various other things:
You haven't provided any code, so it's hard to tell if and where you made the mistake (if any). But, if I were you, I would do something like that:
I'm using
ChartFraction
coordinates instead ofPaneFraction
(as drharris suggests) coordinates to have the title nicely aligned with the left border of the chart. Otherwise it would be flushed totally to the left side (no margin etc...) - it looks better this way.But make sure you didn't set too big font size - it could be clipped at the top
你在使用这个构造函数吗?
如果没有,请确保将alignH 设置为
AlignH.Left
,将alignV 设置为AlignV.Top
。那么 X 和 Y 应该是 0, 0。 coordType 的PaneFraction
应该是这里的正确选项,除非我没有理解你的意图。或者,您可以简单地下载 Zedgraph 代码,将其编辑为左对齐标题(或者更好的是,为此提供一个选项,这本来应该是完成的),然后在生产中使用它。开源之美。
Are you using this constructor?
If not, then be sure you're setting alignH to
AlignH.Left
and alignV toAlignV.Top
. Then X and Y should be 0, 0.PaneFraction
for the coordType should be the correct option here, unless I'm missing your intent.Alternatively, you can simply download Zedgraph code, edit it to Left-align the title (or even better, provide an option for this, which should have been done originally), and then use it in production. Beauty of open source.