-1

I've managed to draw a bezier curve using Chart Control in C#.NET. However, there is 2 points on the curve that is drawn wrongly. I've tried many ways around that but was unsuccessful.

The highlighted area should not drop below the x-axis, it should be more of a straight line. Any ideas?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Ahmed Mohamed
  • 403
  • 2
  • 12
  • 20
  • 1
    The curves look correct as Bezier curves try to be as 'round' as they can. You will need to add __more__ Points to control their behaviour closer. I don't quite understand your last question. Also, showing us some code might help.. – TaW Jun 19 '14 at 12:46
  • I did add more points, but still it would do that at the inflection point. My last question was an error on my part though and fixed it. – Ahmed Mohamed Jun 19 '14 at 13:24
  • 1
    How many points did you add? 3 or 4 won't do. Try 100! – TaW Jun 19 '14 at 13:28
  • 1
    Also: Adding a few more points to the left and right will help to reduce the swing of the curve. You are using the Spline type of the Chart, right? – TaW Jun 19 '14 at 13:48
  • Yes I am. I now trying to add real values to the datapoints and see if it helps. – Ahmed Mohamed Jun 19 '14 at 13:49

2 Answers2

1

Of course it will go under 0, there is nothing wrong with the chart. As you already mentioned, you are using bezier curves. I suggest you to study those curves a bit to understand how they work. Wikipedia article about Beziér curves (one of the few helpful articles on wiki :)

If you don't want to go under 0 in your readings you can use the Max() function with 0 as one of its parameters.

Techie
  • 76
  • 5
  • I'd like to avoid the curve from dropping below 0. Is it possible to control that in Bezier curve? I added points at averages x positions to try to control the shape of the curve, but it didn't work. Every time it will drop below 0 at the inflection point. – Ahmed Mohamed Jun 19 '14 at 13:27
0

this chart uses curved line on drawing change the curved line to straight line chart by using "line" chart type