Jump to content

lotus4

Members
  • Posts

    11
  • Joined

  • Last visited

lotus4's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. ah, wow! i've found this topic: http://old.nabble.com/Relative-paths-to-an-image-td20342359.html it's seems to be a jdk 1.6 problem (strange..). Anyway if you put your resources in classpath it will work! ;)
  2. I''ve got the same problem. I want to reference a subreport in a previous folder like this: ../mysubreport.jasper Every time ireport couldn't find that one. Any suggestion? Thx
  3. Hi, i've made a stackedarea chart with my own customize method. On axis i would like to put a date vertically. I've used PeriodAxis axis = new PeriodAxis(""); axis.setVerticalTickLabels(true); with no result. Is there some way to put them vertical??? See my attach Thanx
  4. ah! i've found my error: the customize method has this signature: public void customize(JFreeChart jFreeChart, JRChart jasperChart) I've used jasperChart, while jFreeChart reference must be used. Anyway, this is the piece of code. Now i'm facing with Period axis to set a specific interval of time, because now it prints a random interval series Code:public void customize(JFreeChart jFreeChart, JRChart jasperChart) { Plot plot = jFreeChart.getPlot(); XYPlot myPlot = (XYPlot)plot; //dataset timeseries TimeSeriesCollection inputDataSet = (TimeSeriesCollection )myPlot.getDataset(); //dataset per stacked area graph TimeTableXYDataset ti = new TimeTableXYDataset(); List seriesList = inputDataSet.getSeries(); //loop through series items to copy to other dataset: TimeTableXYDataset Iterator it = seriesList.iterator(); while (it.hasNext()) { TimeSeries serie = (TimeSeries)it.next(); int itemCount = serie.getItemCount(); for(int i =0; i<itemCount; i++) { //add serie to other dataset ti.add(serie.getTimePeriod(i), serie.getValue(i), (String)serie.getKey(), false); } } //stacked area render to draw the correct graph StackedXYAreaRenderer2 s = new StackedXYAreaRenderer2(); myPlot.setDataset(ti); myPlot.setRenderer(s); myPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); myPlot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); //axis formatter PeriodAxis p = new PeriodAxis("");// p.setAutoRangeTimePeriodClass(Day.class);// p.setMajorTickTimePeriodClass(Minute.class); p.setFixedAutoRange(new Double("12.4")); PeriodAxisLabelInfo[] info = new PeriodAxisLabelInfo[2]; info[0] = new PeriodAxisLabelInfo(Minute.class, new SimpleDateFormat("hh:mm")); // info[1] = new PeriodAxisLabelInfo(Year.class, new SimpleDateFormat("yyyy")); info[1] = new PeriodAxisLabelInfo(Day.class, new SimpleDateFormat("dd-MMM-yyyy")); p.setLabelInfo(info); myPlot.setDomainAxis(p); }
  5. ah! i've found my error: the customize method has this signature: public void customize(JFreeChart jFreeChart, JRChart jasperChart) I've used jasperChart, while jFreeChart reference must be used. Anyway, this is the piece of code. Now i'm facing with Period axis to set a specific interval of time, because now it prints a random interval series. Code:public class CustomReport implements JRChartCustomizer { @Override public void customize(JFreeChart jFreeChart, JRChart jasperChart) { Plot plot = jFreeChart.getPlot(); XYPlot myPlot = (XYPlot)plot; //dataset timeseries TimeSeriesCollection inputDataSet = (TimeSeriesCollection )myPlot.getDataset(); //dataset per stacked area graph TimeTableXYDataset ti = new TimeTableXYDataset(); List seriesList = inputDataSet.getSeries(); //loop through series items to copy to other dataset: TimeTableXYDataset Iterator it = seriesList.iterator(); while (it.hasNext()) { TimeSeries serie = (TimeSeries)it.next(); int itemCount = serie.getItemCount(); for(int i =0; i<itemCount; i++) { //add serie to other dataset ti.add(serie.getTimePeriod(i), serie.getValue(i), (String)serie.getKey(), false); } } //stacked area render to draw the correct graph StackedXYAreaRenderer2 s = new StackedXYAreaRenderer2(); myPlot.setDataset(ti); myPlot.setRenderer(s); myPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); myPlot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); //axis formatter PeriodAxis p = new PeriodAxis("");// p.setAutoRangeTimePeriodClass(Day.class);// p.setMajorTickTimePeriodClass(Minute.class); p.setFixedAutoRange(new Double("12.4")); PeriodAxisLabelInfo[] info = new PeriodAxisLabelInfo[2]; info[0] = new PeriodAxisLabelInfo(Minute.class, new SimpleDateFormat("hh:mm")); // info[1] = new PeriodAxisLabelInfo(Year.class, new SimpleDateFormat("yyyy")); info[1] = new PeriodAxisLabelInfo(Day.class, new SimpleDateFormat("dd-MMM-yyyy")); p.setLabelInfo(info); myPlot.setDomainAxis(p); }
  6. You're right, matt.. it's not easy at all. I've found, i dont know how :), this post: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=49900 it deals about the same issue that i noticed. User bklawans lists the guidelines to deal with it (i copy here for comfort): Basically, you have to create a time based stacked area chart, then change the type of the x-axis to a time period axis. This involves writing a chart customizer that makes some pretty big changes to the underlying JFreeChart You want the area chart to be time based, so you have to author the report using a time series chart The first thing your customizer has to do is convert the data set - JFreeChart requires a TimeTableXYDataset for stacked area charts, and JasperReports will have created the chart using a TimeSeriesCollection. You can get the TimeSeriesCollection by calling chart.getPlot().getDataset() on the chart passed in to the customizer. You create a new TimeTableXYDataset. Then for each series in the original dataset loop through all the items in the series. Add a new entry to your dataset using the period, value and key of the original item. Set the dataset in the chart's plot to the one you just created. Create a StackedXYAreaRender2, and set that in the plot. To avoid some JFreeChart issues set the plot's dataset rendering order and series rendering order to FORWARD. Finally, create a PeriodAxis, set the date intervals as appropriate for you chart, and then set that as the domain axis in the plot. I've written this piece of code in my customize method: JRChartPlot plot = jasperChart.getPlot(); //dataset timeseries JRFillTimeSeriesPlot myPlot = (JRFillTimeSeriesPlot)plot; JRFillTimeSeriesDataset inputDataSet = (JRFillTimeSeriesDataset)myPlot.getChart().getDataset(); JRTimeSeries[] timeSeriesArray = inputDataSet.getSeries(); System.out.println(inputDataSet.getSeries().length); But it seems that my graph (a time series graph) implementing JRFillTimeSeriesPlot and JRFillTimeSeriesDataset and no XYPlot and TimeSeriesCollection. Those Classes (JRFillTimeSeriesPlot and JRFillTimeSeriesDataset) have not so good API so i can't do nothing with it.How could i loop through my dataset to copy its entries into a new dataset di associate to my original plot (note that i can't set a rendere to a JRFillTimeSeriesPlot .. o.O)?
  7. Hi, your replies are very interesting. Thank you for that. I've followed your guidelines writing my customize method like this: JRChartPlot plot = jasperChart.getPlot(); //dataset timeseries JRFillTimeSeriesPlot myPlot = (JRFillTimeSeriesPlot)plot; JRFillTimeSeriesDataset inputDataSet = (JRFillTimeSeriesDataset)myPlot.getChart().getDataset(); JRTimeSeries[] timeSeriesArray = inputDataSet.getSeries(); System.out.println(inputDataSet.getSeries().length); i ve refer to a time series graph with 3 series (lines), but it prints on console just 1 serie.Debugging the code i see that the methot getSeries does not return the whole series but just one, all the others fields of JRFillTimeSeriesDataset object are private and so inaccesible. How could i loop throgh them?? Thank you
  8. Yes, a timeseries graph probably could resolve this issue, but if i needed a different type of graph? It should be possible to 'filter' only the labels and not the values behind them.
  9. One more hint: i ve attached 2 files: not_filtered.pdf: a graph without filters (the exact one) filtered.pdf: a graph with a filter like this: $F{HTTP_DATE}.getMinutes() == 0 || $F{HTTP_DATE}.getMinutes() == 30 which excludes most of the dates, but with them, values too, distorting the graph semantic
  10. Hi, is it possibile to filter the label in a chart? i ve got a lot of date minute per minute but i wanna show into my chart, not the whole timeline, like the attach, but only few date (e.g. every 30 min: 2011-24-02 00:00, 2011-24-02 00:30, 2011-24-02 10:00 and not 2011-24-02 00:01, 2011-24-02 00:02, 2011-24-02 10:03 etc.. I've use filtering clause but it filter result deleting it and so distorting the graph curve. Thanks in advance Marco
  11. Hi to all, i'm facing with the issue to create a list of values to pass to "key expression" and "values expression" fields in the chart form. My input from db is not complete and has to be worked to obtain aggregate result useful form my graph. In particular, i have to draw a pie and this is my result set from datasource. ------------------------------------------- column1 column2 row1 2 2.3 row2 1 1.2 row3 3 3 ----------------------------------------------- i have to draw a pie with each slice corresponding to column1 and column2 and with slice's values corresponding to the aggregation of all the rows. e.g. avg (2,1,3) and avg(2.3, 1.2, 3) I think to put a sort of list into "key expression" section like this: {"column1", "column2"} and another sort of list into "value expression" section likie this: {avg (2,1,3), avg(2.3, 1.2, 3)} Obiouvsly it doesn't work :) Any ideas??? PS: i have attached a png from excel that explay better what is my desideratum. An aggregation pie where BE1, BE2 is column name and the percentages are the aggregation result Post Edited by lotus4 at 02/24/2011 14:17
×
×
  • Create New...