Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
like image 996
doornetd Avatar asked Oct 21 '22 18:10

doornetd


1 Answers

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

like image 156
user4265037 Avatar answered Oct 27 '22 14:10

user4265037