简体   繁体   中英

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. 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.

This is all I've added to the load method:

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(); 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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