2

So, the premise of my program is to take in information that a user inputs from a textbox and then charting it. Unfortunately, I have to make it so that a user can leave some input blank. As a result, I am left trying to graph null data. The chart will just stop graphing at that point, even if there is data afterwards to be graphed. Is there any way for the chart to ignore null values?

2
  • which chart control you are using ? Commented Dec 9, 2011 at 1:40
  • Windows form default chart tool Commented Dec 9, 2011 at 2:13

2 Answers 2

3

Assuming you have got X axis values and at times the corresponding Y values are null then you should be looking at the EmptyPointStyle of the Series. here you can control the appearance and also set a specific label like "No Value" or "Value Needed" which would be seen on the graph.

In case you want to skip the value and join the adjacent points then set the Color property of the EmptyPointStyle

Chart1.Series[2].EmptyPointStyle.Color = System.Drawing.Color.Green;
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much! Is there anyway, however, to make it graph through the point like an average between the two adjacent points or just ignore that point completely? Thanks again for the help!
@dimabima Check my edit for skipping the point and if this helps try to mark it as answer
0

Without more detail of how you are doing the processing, you just need to have some method that can look at all of the textboxes and then pick which graph to generate, so, for example, if you have textboxes for company, department and building, and someone fills in company and building then you may need to call a separate class that extends the main graphing abstract class and it will know how to process the results.

Now, if you have 10 textboxes then covering all the bases is harder, but even then, you may need to dynamically generate the query to pull in the data and once you have the data then you just graph everything that was returned.

1 Comment

I'm taking the information from a file, which is saved into a list in my main program. The charting form will then use the list and tie it with a DateTime. I would just delete the whole x-value and be done with it, but other non-null data is probably associated with it, thus making it not possible to delete. I'm only slightly experienced with programming so I may not have interpreted what you said correctly, sorry. Maybe the new information can help? Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.