简体   繁体   English

图表控件-第一个X值和Y轴之间的间隙

[英]Chart control - Gap between first X value and Y-axis

I'm using a line chart to plot some values, where the x-axis has a set of strings and the y-axis has a double value between 0 and 1. Everything works correctly except there is a gap between the first x value and the y-axis the image shows. 我正在使用折线图绘制一些值,其中x轴具有一组字符串,y轴具有介于0和1之间的双精度值。一切正常,除了第一个x值和图像显示的y轴

In this question the solution is setting the x-axis maximum and minimum value. 在此问题中 ,解决方案是设置x轴的最大值和最小值。 However, I can't seem to do it in this case as the values are strings and not doubles / dates. 但是,在这种情况下,我似乎无法执行此操作,因为值是字符串,而不是双精度/日期。

Given that you are using strings, this may or may not help. 鉴于您正在使用字符串,这可能有帮助,也可能没有帮助。 Try setting the IsXValueIndexed property of your underlying series to be false. 尝试将基础系列的IsXValueIndexed属性设置为false。

See this MSDN article for reference: http://msdn.microsoft.com/en-us/library/system.web.ui.datavisualization.charting.series.isxvalueindexed(v=vs.110).aspx 请参阅此MSDN文章以供参考: http : //msdn.microsoft.com/zh-cn/library/system.web.ui.datavisualization.charting.series.isxvalueindexed(v=vs.110).aspx

要删除边距,您需要设置

chart.ChartAreas[0].AxisX.IsMarginVisible = false;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM