Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cewolf and Struts

 
Abebe Belew
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hellow,
I am trying to integrate cewolf with a working struts app. and I am stuck.
I am not able to render a line chart in the jsp using this code but is seams to produce a bar chart if I change the chart type to verticalbar in the jsp,
what am I doing wrong? Please help. Below is code.

datasetProducer

public class ViewChart implements DatasetProducer, Serializable {

public String[] categories;
private int[] values;
public String[] seriesNames;


public ViewChart(Map map) {

categories = new String[map.size()];
seriesNames = new String[map.size()];
values = new int[map.size()];
Iterator iter = map.keySet().iterator();
int count = 0;
while(iter.hasNext()){
String key = iter.next().toString();
seriesNames[count] = key;
Double currentValue = (Double) map.get(key);
values[count] = currentValue.intValue();
categories[count] = " ";
count++;
}
}

public Object produceDataset(Map arg0) throws datasetProduceException {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();

for (int i = 0; i < categories.length; i++) {
int currentValue = values[i];
dataset.addValue(currentValue, seriesNames[i], categories[i]);
}

return dataset;
}


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic