WeBWorK Problems

GraphTool for one-dimensional plots

Re: GraphTool for one-dimensional plots

by Glenn Rice -
Number of replies: 2

Basically, the y-range is chosen so that with the default y snap value of 1, the only horizontal line in the range is the x-axis.  So when JSXGraph snaps to coordinates, the only options are the points on the x-axis.

Implementing this in the way  you suggest would be very challenging.  JSXGraph is really a two dimensional graphing library, and filling between points would be difficult.  The fill would have to really be interpreted into a line segment.  Furthermore, JSXGraph doesn't actually even support filling between curves, much less between points.  The fill tool that the graph tool currently has was one of the most challenging things to implement.

I was thinking instead that there would be two interval tools.  One a bounded interval tool, and one an unbounded interval tool.  Both tools would work much like the current line tool.  You start by plotting one endpoint, and then by plotting the other.  For the bounded interval tool, when the second point is plotted, the interval would end.  For the unbounded interval tool, plotting the second point would really be more like choosing a direction.  Paired with this there would be another tool that is much like the current solid/dashed tool for curves, except it would be an open/closed endpoint (or hollow/filled dot) tool.  With this approach it takes care of all of the options for making line segments for (a,b), (a,b], etc if one wanted to use that sort of interval as opposed to open/closed dots.

In reply to Glenn Rice

Re: GraphTool for one-dimensional plots

by Alex Jordan -

If I tried my hand at making these tools, should they go into the repo, or should they use the generic extension capabilities of graphTool?

In reply to Alex Jordan

Re: GraphTool for one-dimensional plots

by Glenn Rice -

I am about to make a pull request that also does this.  I didn't know you were going to work on it.

I implemented it sort of how I described.  Although I only made one interval tool.  The ends of the board are interpreted as points at infinity.  Moving a point to those ends turns it into an arrow indicating continuation.