PlotFaces Design Discussion

PlotFaces takes a different, more code based, approach to charting than other JSF libraries and as such you won’t see hundreds of attributes on the JSF chart tags. For simple charts an attribute base approach to configuration works well. For example a page author could specify the x-axis label with an attribute like this xaxislabel=”foo” and never need to get near anything that looks like code. The problem comes though when you want to expose forty different axis options for twelve different axes which is perfectly possible with jqPlot – placing 500+ attributes on an element is not a solution that is going to work.

To get around this attribute explosion PlotFaces provides an API that allows a programmer to build a chart model quickly and simply in code and expose it through a single attribute, the page designer then places the chart on the page in the desired location. On the face of it this seems to (partially) defeat the point of using JSF, the whole idea is not to write display code but that is exactly what the programmers are doing. It is our belief is that charts are usually something of a special case in an application. Before any interesting1 chart can be added to a page a data model must already have be provided which requires development effort, adding an options model as well shouldn’t cause a great deal of extra work but at the same time allows the use of all the jqPlot options. Finally, should it turn out that the page designers do need the flexibility to completely customize the chart it is fairly simple

1 Interesting in this sense means a chart that shows data that can change, a stock price graph would be an obvious example.

Posted in PlotFaces and tagged , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *