Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

cewolf and Struts

 
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;
}


 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!