franta-hg@1: franta-hg@1: franta-hg@1:
franta-hg@1: Let us assume the following (standard) scenario in which Cewolf
franta-hg@1: might be a solution.
franta-hg@1: You have a running web application and you want to know which pages are
franta-hg@1: most visited by your users. You want to have a vertical bar chart which
franta-hg@1: looks like the one below
franta-hg@1:
franta-hg@1:
If you have not yet downloaded the Cewolf distribution, this is the
franta-hg@1: point when you should do it (look at Download). Put the cewolf.jar file into your
franta-hg@1: web application's /WEB-INF/lib directory.
franta-hg@1: That should be all you have to do to prepare your application for
franta-hg@1: Cewolf usage. If you encounter any problems in using the Cewolf tags
franta-hg@1: (e.g. "No Tags" is displayed in your containers console) you can
franta-hg@1: additionally put the cewolf.tld file from the distribution's etc
franta-hg@1: directory into a directory of your choice under your web application's
franta-hg@1: root and reference this file as the cewolf tag library from your JSPs.
As Cewolf uses a MVC (Model-View-Control) approach the data which franta-hg@1: are shown in your chart are separated from the view defined in the JSP franta-hg@1: page. So you can change them separately. To provide the chart with the franta-hg@1: correct data you must provide an object which implements the interfacede.laures.cewolf.DatasetProducer. franta-hg@1: This object is asked to produce data every time a chart is rendered. franta-hg@1: Below you see an implementation of a DatasetProducer which could be used franta-hg@1: to provide data needed for our example scenario.
franta-hg@1:franta-hg@1: to be continued ... franta-hg@1:
<%@page contentType="text/html"%>franta-hg@1: franta-hg@1: franta-hg@1:
<%@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>