Developer Guide

Let us assume the following (standard) scenario in which Cewolf might be a solution.
You have a running web application and you want to know which pages are most visited by your users. You want to have a vertical bar chart which looks like the one below

verticalbar

1. Prepare Your Application

If you have not yet downloaded the Cewolf distribution, this is the point when you should do it (look at Download). Put the cewolf.jar file into your web application's /WEB-INF/lib directory.
That should be all you have to do to prepare your application for Cewolf usage. If you encounter any problems in using the Cewolf tags (e.g. "No Tags" is displayed in your containers console) you can additionally put the cewolf.tld file from the distribution's etc directory into a directory of your choice under your web application's root and reference this file as the cewolf tag library from your JSPs.

2. Provide a DatasetProducer

As Cewolf uses a MVC (Model-View-Control) approach the data which are shown in your chart are separated from the view defined in the JSP page. So you can change them separately. To provide the chart with the correct data you must provide an object which implements the interfacede.laures.cewolf.DatasetProducer. This object is asked to produce data every time a chart is rendered. Below you see an implementation of a DatasetProducer which could be used to provide data needed for our example scenario.

to be continued ...

3. Install the Cewolf Servlet in your Web App

tbd.

4. Define the chart in your JSP

<%@page contentType="text/html"%>
<%@taglib uri='/WEB-INF/cewolf.tld' prefix='cewolf' %>
<jsp:useBean id="pageViews" class="de.laures.cewolf.example.PageViewCountData"/>
<cewolf:chart
id="horizontalBarChart"
title="HorizontalBarChart"
renderer="servlet/chart"
width="300" height="300"
type="horizontalBar"
xAxisLabel="Page"
yAxisLabel="Views">
<cewolf:data producer="pageViews" />
</cewolf:chart>

SourceForge Logo