Hi,
I make an application at school. This app must show the area under a function by drawing rectangles, trapezium or with the Simpson method.
Is there a way to draw rectangle on the graph like this :
http://imgur.com/mUcowS5
Thank's
(Sorry for my english, I speak french)
Draw Rectangle on graph
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Draw Rectangle on graph
Do you want to show the grey bars or the red circle on the chart?
Re: Draw Rectangle on graph
I want to show the grey bars. Actually, I have the red line (a sinus function) and i want to draw the grey rectangles.
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Draw Rectangle on graph
Do you already have the height of the bars that you want to plot, and their start and end values on the x-axis?
Then, I suggest to use a second dataset, eventually plotted to a secondary y-axis.
Then, I suggest to use a second dataset, eventually plotted to a secondary y-axis.
Re: Draw Rectangle on graph
A rectangle is defined like this :
start point : (x,0)
width : ((x+delta) - x) delta is the difference between two point on the sinus
height : f(x) : f represent the sinus function
start point : (x,0)
width : ((x+delta) - x) delta is the difference between two point on the sinus
height : f(x) : f represent the sinus function
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Draw Rectangle on graph
Then just use an XYIntervalSeriesCollection as secondary dataset. You can plot that to the same axis as the first dataset, since the x and y values will be quite similar.