简体   繁体   English

如何在C#中显示没有数据点的图表?

[英]How to display a chart in C# that has no data points?

I'm making a candlestick chart in C# for a bitcoin trading helper. 我正在用C#制作一个比特币交易助手的烛台图表。 When the form loads, the chart is just an empty white space because there are no data points initially. 加载表单时,图表只是一个空的空白区域,因为最初没有数据点。 Is there any way to display the grid lines and the axes when there are no data points? 有没有数据点时有没有办法显示网格线和轴? Thank you! 谢谢!

EDIT: A data point is added ~1 minute after loading, so aesthetically I think it would look better to have the empty grid lines and axes than to simply hide the chart altogether. 编辑:加载后约1分钟添加一个数据点,所以在美学上我认为拥有空的网格线和轴看起来比仅仅隐藏图表更好。

This is all I've added to the load method: 这就是我在load方法中添加的所有内容:

chart1.Titles.Add("Candlestick Chart");
//chart grid lines colors
chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Gray;

I think you can add empty point for the Chart series data points chart3.Series[0].Points.Add(); 我想你可以为Chart系列数据点图表添加空点.Series [0] .Points.Add(); chart3.Series[0].Points[0].IsEmpty = true; chart3.Series [0] .Points [0] .IsEmpty = true; check this: https://www.syncfusion.com/kb/73/how-do-i-set-emptypoint-for-the-chart-series-data-points 检查一下: https//www.syncfusion.com/kb/73/how-do-i-set-emptypoint-for-the-chart-series-data-points

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

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