Why is only one data displayed in LineChart? - jasper-reports
I got all the Reportstuff working, get a PDF generated and redirected as servlet response.
The Report opens up and the data I pass is there (tested with textfields...data is there). When I try to display the data in a line chart, it just shows one data point. I have grouped the chart on the 'day' data, as i want to have a new chart for every day (which also works, as there are 31 charts for my 31 days in testdata.
Plus I have multiple lines to display, bound by the 'type' data. So I want four lines on every diagram: the data itself (type=1), the min-value (type=2), the average value(type=3) and the max-value (type=3). But it just won't work...Where is my mistake?
Here's the code:
JasperReport:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="jasper_report_template" pageWidth="595" pageHeight="842" whenNoDataType="NoPages" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="c5395651-075a-4d6a-a971-d283cab77f63">
<parameter name="ReportTitle" class="java.lang.String"/>
<parameter name="Author" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="day" class="java.lang.Integer">
<fieldDescription><![CDATA[day]]></fieldDescription>
</field>
<field name="type" class="java.lang.Integer">
<fieldDescription><![CDATA[type]]></fieldDescription>
</field>
<field name="time" class="java.lang.String">
<fieldDescription><![CDATA[time]]></fieldDescription>
</field>
<field name="kwh" class="java.lang.Double">
<fieldDescription><![CDATA[kwh]]></fieldDescription>
</field>
<sortField name="day"/>
<sortField name="type"/>
<group name="DayGroup" minHeightToStartNewPage="60">
<groupExpression><![CDATA[$F{day}]]></groupExpression>
<groupHeader>
<band height="210" splitType="Stretch">
<lineChart>
<chart evaluationTime="Group" evaluationGroup="DayGroup">
<reportElement x="-20" y="10" width="560" height="200" uuid="9abe6b47-1c6f-4bd0-a684-abf9e91b4adc"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Group" resetGroup="DayGroup" incrementType="Group" incrementGroup="DayGroup"/>
<categorySeries>
<seriesExpression><![CDATA[$F{type}]]></seriesExpression>
<categoryExpression><![CDATA[$F{time}]]></categoryExpression>
<valueExpression><![CDATA[$F{kwh}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot>
<plot/>
<categoryAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</valueAxisFormat>
</linePlot>
</lineChart>
</band>
</groupHeader>
</group>
</jasperReport>
Servlet:
JRBeanCollectionDataSource jrbcds = new JRBeanCollectionDataSource(BasicDataHandler.getInstance().getThatBeanList());
String path = getServletContext().getRealPath("/reports/");
JasperReport jasReport = JasperCompileManager.compileReport(path+ "/template_all_month_line_graph.jrxml");
JasperPrint jasPrint;
jasPrint = JasperFillManager.fillReport(jasReport, null, jrbcds);
ServletOutputStream sos = response.getOutputStream();
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasPrint, sos);
BasicDataHandler:
package sc2pdf.datahandlers;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import sc2pdf.datasets.DailyDataSet;
import sc2pdf.javabeans.DataObject;
public class BasicDataHandler {
private static BasicDataHandler myself=null;
private Map<Integer, DailyDataSet> data = null;
private Map<Integer, DailyDataSet> min_data = null;
private Map<Integer, DailyDataSet> avg_data = null;
private Map<Integer, DailyDataSet> max_data = null;
public BasicDataHandler() {
data = new HashMap<Integer, DailyDataSet>(); //holds all the real data values; key: DAY_OF_MONTH; value DailyDataSet for every day of month
min_data = new HashMap<Integer, DailyDataSet>(); //holds all the min data values; key: DAY_OF_WEEK; value DailyDataSet for every day of week
avg_data = new HashMap<Integer, DailyDataSet>(); //holds all the average data values; key: DAY_OF_WEEK; value DailyDataSet for every day of week
max_data = new HashMap<Integer, DailyDataSet>(); //holds all the max data values; key: DAY_OF_WEEK; value DailyDataSet for every day of week
}
public static BasicDataHandler getInstance() {
if (myself == null) {
myself = new BasicDataHandler();
}
return myself;
}
private void registerDailyDataSet(DailyDataSet ds) {
Calendar c = Calendar.getInstance();
c.setTime(ds.getDay());
Integer tmp = new Integer(c.get(Calendar.DAY_OF_MONTH));
data.put(tmp, ds);
}
private void registerCalcValueMinDailyDataSet(DailyDataSet ds) {
Calendar c = Calendar.getInstance();
c.setTime(ds.getDay());
Integer tmp = new Integer(c.get(Calendar.DAY_OF_WEEK));
min_data.put(tmp, ds);
}
private void registerCalcValueAvgDailyDataSet(DailyDataSet ds) {
Calendar c = Calendar.getInstance();
c.setTime(ds.getDay());
Integer tmp = new Integer(c.get(Calendar.DAY_OF_WEEK));
avg_data.put(tmp, ds);
}
private void registerCalcValueMaxDailyDataSet(DailyDataSet ds) {
Calendar c = Calendar.getInstance();
c.setTime(ds.getDay());
Integer tmp = new Integer(c.get(Calendar.DAY_OF_WEEK));
max_data.put(tmp, ds);
}
public void registerDataObject(DataObject dob) {
Calendar c = Calendar.getInstance();
c.setTime(dob.getTimeAsDate());
Integer key = c.get(Calendar.DAY_OF_MONTH);
DailyDataSet ds = data.get(key);
if(ds == null) {
registerDailyDataSet(new DailyDataSet(dob.getTimeAsDate()));
ds = data.get(key);
}
ds.addDataObject(dob);
Integer keyCalcValues = c.get(Calendar.DAY_OF_WEEK);
ds = min_data.get(keyCalcValues);
DataObject t;
if(ds == null) {
registerCalcValueMinDailyDataSet(new DailyDataSet(dob.getTimeAsDate()));
ds = min_data.get(keyCalcValues);
ds.addDataObject(new DataObject(dob.getTimeAsDate(),dob.getKwh(),DataObject.TYPE_MIN));
}else{
t = ds.getDataObjectByWeekday(dob.getTimeAsDate());
if(t==null) {
t=new DataObject(dob.getTimeAsDate(),dob.getKwh(),DataObject.TYPE_MIN);
ds.addDataObject(t);
}
if(t.getKwh()>dob.getKwh())
t.setKwh(dob.getKwh());
}
ds = avg_data.get(keyCalcValues);
if(ds == null) {
registerCalcValueAvgDailyDataSet(new DailyDataSet(dob.getTimeAsDate()));
ds = avg_data.get(keyCalcValues);
ds.addDataObject(new DataObject(dob.getTimeAsDate(),dob.getKwh(),DataObject.TYPE_AVG));
}else{
t = ds.getDataObjectByWeekday(dob.getTimeAsDate());
if(t==null) {
t=new DataObject(dob.getTimeAsDate(),dob.getKwh(),DataObject.TYPE_AVG);
ds.addDataObject(t);
}
if(t.getKwh()>dob.getKwh())
t.setKwh(dob.getKwh());
}
ds = max_data.get(keyCalcValues);
if(ds == null) {
registerCalcValueMaxDailyDataSet(new DailyDataSet(dob.getTimeAsDate()));
ds = max_data.get(keyCalcValues);
ds.addDataObject(new DataObject(dob.getTimeAsDate(),dob.getKwh(),DataObject.TYPE_MAX));
}else{
t = ds.getDataObjectByWeekday(dob.getTimeAsDate());
if(t==null) {
t=new DataObject(dob.getTimeAsDate(),dob.getKwh(),DataObject.TYPE_MAX);
ds.addDataObject(t);
}
if(t.getKwh()<dob.getKwh())
t.setKwh(dob.getKwh());
}
}
public List<DataObject> getThatBeanList() {
List<DataObject> rl = new ArrayList<DataObject>();
Iterator<Integer> iter = data.keySet().iterator();
Calendar c = Calendar.getInstance();
while (iter.hasNext()) {
Integer keyToDo = iter.next();
DailyDataSet dds = data.get(keyToDo);
rl.addAll(dds.getData());
c.setTime(dds.getDay());
Integer dayKey = c.get(Calendar.DAY_OF_WEEK);
DailyDataSet dsmin = min_data.get(dayKey);
rl.addAll(dsmin.getData());
DailyDataSet dsavg = avg_data.get(dayKey);
rl.addAll(dsavg.getData());
DailyDataSet dsmax = max_data.get(dayKey);
rl.addAll(dsmax.getData());
}
return rl;
}
}
DailyDataSet:
package sc2pdf.datasets;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import sc2pdf.javabeans.DataObject;
public class DailyDataSet {
private Date day;
private Collection<DataObject> data;
public DailyDataSet() {
this(new Date());
}
public DailyDataSet(Date d) {
this.day=d;
this.data = new ArrayList<DataObject>();
}
public void addDataObject(Date d, double k) {
this.data.add(new DataObject(d,k));
}
public void addDataObject(DataObject d) {
this.data.add(d);
}
public Date getDay() {
return day;
}
public Collection<DataObject> getData(){
return data;
}
public DataObject getDataObject(Date toSearch) {
Iterator<DataObject> iter = data.iterator();
Calendar c = Calendar.getInstance();
c.setTime(toSearch);
while (iter.hasNext()) {
DataObject dob = iter.next();
Calendar c2 = Calendar.getInstance();
c2.setTime(dob.getTimeAsDate());
if(c.equals(c2)) {
return dob;
}
}
return null;
}
public DataObject getDataObjectByWeekday(Date toSearch) {
Iterator<DataObject> iter = data.iterator();
Calendar c = Calendar.getInstance();
c.setTime(toSearch);
while (iter.hasNext()) {
DataObject dob = iter.next();
Calendar c2 = Calendar.getInstance();
c2.setTime(dob.getTimeAsDate());
if(c.get(Calendar.DAY_OF_WEEK) == c2.get(Calendar.DAY_OF_WEEK)) {
if(c.get(Calendar.HOUR_OF_DAY) == c2.get(Calendar.HOUR_OF_DAY)) {
if(c.get(Calendar.MINUTE) == c2.get(Calendar.MINUTE)) {
return dob;
}
}
}
}
return null;
}
}
DataObject:
package sc2pdf.javabeans;
import java.util.Calendar;
import java.util.Date;
public class DataObject {
private Date timeAsDate;
private Integer day;
private String timeAsString;
private double kwh;
private Integer type;
public static final Integer TYPE_DATA = 1;
public static final Integer TYPE_MIN = 2;
public static final Integer TYPE_AVG = 3;
public static final Integer TYPE_MAX = 4;
/**
* Constructor
*/
public DataObject() {
this(new Date(),0);
}
public DataObject(int day, int month, int year, int hour, int minute, double k) {
this(day,month,year,hour,minute,k,TYPE_DATA);
}
public DataObject(int day, int month, int year, int hour, int minute, double k, Integer typ) {
Calendar c = Calendar.getInstance();
c.set(year,month,day,hour,minute);
this.day=new Integer(c.get(Calendar.DAY_OF_MONTH));
this.timeAsDate=c.getTime();
this.kwh=k;
this.type=typ;
generateTimeAsString();
}
public DataObject(Date t, double p) {
this(t,p,TYPE_DATA);
}
public DataObject(Date t, double p, Integer ty) {
this.timeAsDate=t;
this.kwh=p;
this.type=ty;
Calendar c = Calendar.getInstance();
c.setTime(t);
this.day=new Integer(c.get(Calendar.DAY_OF_MONTH));
generateTimeAsString();
}
public void generateTimeAsString() {
Calendar c = Calendar.getInstance();
c.setTime(timeAsDate);
timeAsString = c.get(Calendar.HOUR_OF_DAY) +
":"+
c.get(Calendar.MINUTE);
}
public String getTime() {
return timeAsString != null?timeAsString:"WRONG STRING";
}
public void setTime(String s) {
this.timeAsString = s;
}
public Integer getDay() {
return day;
}
public void setDay(Integer day) {
this.day = day;
}
public double getKwh() {
return kwh;
}
public void setKwh(double kwh) {
this.kwh = kwh;
}
public Date getTimeAsDate() {
return timeAsDate;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String toString() {
return (type.equals(DataObject.TYPE_DATA)?"DATA: ":(type.equals(DataObject.TYPE_MIN)?" MIN: ":(type.equals(DataObject.TYPE_AVG)?" AVG: ":" MAX: ")))+this.timeAsDate.toString()+": "+this.kwh;
}
}
the data as it get delivered to the report (format: [type==1?"DATA: ":type==2?"MIN: ":type==3?"AVG: ":"MAX: "]+Date+kWh
DATA: Tue Jan 01 00:00:07 CET 2019: 2.501
DATA: Tue Jan 01 00:15:07 CET 2019: 2.679
DATA: Tue Jan 01 00:30:07 CET 2019: 2.93
DATA: Tue Jan 01 00:45:07 CET 2019: 2.363
DATA: Tue Jan 01 01:00:07 CET 2019: 2.589
DATA: Tue Jan 01 01:15:07 CET 2019: 2.423
DATA: Tue Jan 01 01:30:07 CET 2019: 2.531
DATA: Tue Jan 01 01:45:07 CET 2019: 2.976
DATA: Tue Jan 01 02:00:07 CET 2019: 2.369
DATA: Tue Jan 01 02:15:07 CET 2019: 2.636
DATA: Tue Jan 01 02:30:07 CET 2019: 2.391
DATA: Tue Jan 01 02:45:07 CET 2019: 2.667
DATA: Tue Jan 01 03:00:07 CET 2019: 2.88
DATA: Tue Jan 01 03:15:07 CET 2019: 2.378
DATA: Tue Jan 01 03:30:07 CET 2019: 2.723
DATA: Tue Jan 01 03:45:07 CET 2019: 2.511
DATA: Tue Jan 01 04:00:07 CET 2019: 2.789
DATA: Tue Jan 01 04:15:07 CET 2019: 2.867
DATA: Tue Jan 01 04:30:07 CET 2019: 3.101
DATA: Tue Jan 01 04:45:07 CET 2019: 3.321
DATA: Tue Jan 01 05:00:07 CET 2019: 2.438
DATA: Tue Jan 01 05:15:07 CET 2019: 2.616
DATA: Tue Jan 01 05:30:07 CET 2019: 3.146
DATA: Tue Jan 01 05:45:07 CET 2019: 5.882
DATA: Tue Jan 01 06:00:07 CET 2019: 4.814
DATA: Tue Jan 01 06:15:07 CET 2019: 4.593
DATA: Tue Jan 01 06:30:07 CET 2019: 5.078
DATA: Tue Jan 01 06:45:07 CET 2019: 5.69
DATA: Tue Jan 01 07:00:07 CET 2019: 9.734
DATA: Tue Jan 01 07:15:07 CET 2019: 12.63
DATA: Tue Jan 01 07:30:07 CET 2019: 14.304
DATA: Tue Jan 01 07:45:07 CET 2019: 14.52
DATA: Tue Jan 01 08:00:07 CET 2019: 14.988
DATA: Tue Jan 01 08:15:07 CET 2019: 14.984
DATA: Tue Jan 01 08:30:07 CET 2019: 14.748
DATA: Tue Jan 01 08:45:07 CET 2019: 13.859
DATA: Tue Jan 01 09:00:07 CET 2019: 12.038
DATA: Tue Jan 01 09:15:07 CET 2019: 15.084
DATA: Tue Jan 01 09:30:07 CET 2019: 14.787
DATA: Tue Jan 01 09:45:07 CET 2019: 15.069
DATA: Tue Jan 01 10:00:07 CET 2019: 15.764
DATA: Tue Jan 01 10:15:07 CET 2019: 16.71
DATA: Tue Jan 01 10:30:07 CET 2019: 15.549
DATA: Tue Jan 01 10:45:07 CET 2019: 14.21
DATA: Tue Jan 01 11:00:07 CET 2019: 14.073
DATA: Tue Jan 01 11:15:07 CET 2019: 12.233
DATA: Tue Jan 01 11:30:07 CET 2019: 13.17
DATA: Tue Jan 01 11:45:07 CET 2019: 11.973
DATA: Tue Jan 01 12:00:07 CET 2019: 11.982
DATA: Tue Jan 01 12:15:07 CET 2019: 10.907
DATA: Tue Jan 01 12:30:07 CET 2019: 8.087
DATA: Tue Jan 01 12:45:07 CET 2019: 4.575
DATA: Tue Jan 01 13:00:07 CET 2019: 2.96
DATA: Tue Jan 01 13:15:07 CET 2019: 1.884
DATA: Tue Jan 01 13:30:07 CET 2019: 0.995
DATA: Tue Jan 01 13:45:07 CET 2019: 2.691
DATA: Tue Jan 01 14:00:07 CET 2019: 1.826
DATA: Tue Jan 01 14:15:07 CET 2019: 2.487
DATA: Tue Jan 01 14:30:07 CET 2019: 2.984
DATA: Tue Jan 01 14:45:07 CET 2019: 2.808
DATA: Tue Jan 01 15:00:07 CET 2019: 3.539
DATA: Tue Jan 01 15:15:07 CET 2019: 2.49
DATA: Tue Jan 01 15:30:07 CET 2019: 3.473
DATA: Tue Jan 01 15:45:07 CET 2019: 6.41
DATA: Tue Jan 01 16:00:07 CET 2019: 6.977
DATA: Tue Jan 01 16:15:07 CET 2019: 6.854
DATA: Tue Jan 01 16:30:07 CET 2019: 12.807
DATA: Tue Jan 01 16:45:07 CET 2019: 10.83
DATA: Tue Jan 01 17:00:07 CET 2019: 8.435
DATA: Tue Jan 01 17:15:07 CET 2019: 8.633
DATA: Tue Jan 01 17:30:07 CET 2019: 4.887
DATA: Tue Jan 01 17:45:07 CET 2019: 3.594
DATA: Tue Jan 01 18:00:07 CET 2019: 3.36
DATA: Tue Jan 01 18:15:07 CET 2019: 4.145
DATA: Tue Jan 01 18:30:07 CET 2019: 9.11
DATA: Tue Jan 01 18:45:07 CET 2019: 8.714
DATA: Tue Jan 01 19:00:07 CET 2019: 7.982
DATA: Tue Jan 01 19:15:07 CET 2019: 6.545
DATA: Tue Jan 01 19:30:07 CET 2019: 6.764
DATA: Tue Jan 01 19:45:07 CET 2019: 7.394
DATA: Tue Jan 01 20:00:07 CET 2019: 9.887
DATA: Tue Jan 01 20:15:07 CET 2019: 7.292
DATA: Tue Jan 01 20:30:07 CET 2019: 5.972
DATA: Tue Jan 01 20:45:07 CET 2019: 6.924
DATA: Tue Jan 01 21:00:07 CET 2019: 6.426
DATA: Tue Jan 01 21:15:07 CET 2019: 5.675
DATA: Tue Jan 01 21:30:07 CET 2019: 5.973
DATA: Tue Jan 01 21:45:07 CET 2019: 5.936
DATA: Tue Jan 01 22:00:07 CET 2019: 6.06
DATA: Tue Jan 01 22:15:07 CET 2019: 5.646
DATA: Tue Jan 01 22:30:07 CET 2019: 4.484
DATA: Tue Jan 01 22:45:07 CET 2019: 2.481
DATA: Tue Jan 01 23:00:07 CET 2019: 2.49
DATA: Tue Jan 01 23:15:07 CET 2019: 2.423
DATA: Tue Jan 01 23:30:07 CET 2019: 2.49
DATA: Tue Jan 01 23:45:07 CET 2019: 2.955
MIN: Tue Jan 01 00:00:07 CET 2019: 2.154
MIN: Tue Jan 01 00:15:07 CET 2019: 2.093
MIN: Tue Jan 01 00:30:07 CET 2019: 2.052
MIN: Tue Jan 01 00:45:07 CET 2019: 2.126
MIN: Tue Jan 01 01:00:07 CET 2019: 2.139
MIN: Tue Jan 01 01:15:07 CET 2019: 2.171
MIN: Tue Jan 01 01:30:07 CET 2019: 2.162
MIN: Tue Jan 01 01:45:07 CET 2019: 2.178
MIN: Tue Jan 01 02:00:07 CET 2019: 2.049
MIN: Tue Jan 01 02:15:07 CET 2019: 2.033
MIN: Tue Jan 01 02:30:07 CET 2019: 2.034
MIN: Tue Jan 01 02:45:07 CET 2019: 2.129
MIN: Tue Jan 01 03:00:07 CET 2019: 2.159
MIN: Tue Jan 01 03:15:07 CET 2019: 2.165
MIN: Tue Jan 01 03:30:07 CET 2019: 2.001
MIN: Tue Jan 01 03:45:07 CET 2019: 2.006
MIN: Tue Jan 01 04:00:07 CET 2019: 2.313
MIN: Tue Jan 01 04:15:07 CET 2019: 1.992
MIN: Tue Jan 01 04:30:07 CET 2019: 2.082
MIN: Tue Jan 01 04:45:07 CET 2019: 1.982
MIN: Tue Jan 01 05:00:07 CET 2019: 2.217
MIN: Tue Jan 01 05:15:07 CET 2019: 2.088
MIN: Tue Jan 01 05:30:07 CET 2019: 2.09
MIN: Tue Jan 01 05:45:07 CET 2019: 1.923
MIN: Tue Jan 01 06:00:07 CET 2019: 1.928
MIN: Tue Jan 01 06:15:07 CET 2019: 2.337
MIN: Tue Jan 01 06:30:07 CET 2019: 2.333
MIN: Tue Jan 01 06:45:07 CET 2019: 2.397
MIN: Tue Jan 01 07:00:07 CET 2019: 2.135
MIN: Tue Jan 01 07:15:07 CET 2019: 2.45
MIN: Tue Jan 01 07:30:07 CET 2019: 2.288
MIN: Tue Jan 01 07:45:07 CET 2019: 2.405
MIN: Tue Jan 01 08:00:07 CET 2019: 2.093
MIN: Tue Jan 01 08:15:07 CET 2019: 2.403
MIN: Tue Jan 01 08:30:07 CET 2019: 3.309
MIN: Tue Jan 01 08:45:07 CET 2019: 2.904
and a screenshot from my output:
my pdf looks like this atm...
dummy cvs(separated by '|') valueset:
day|type|time|kwh
1|1|00:15|0.9
1|1|00:30|1.2
1|2|00:15|0.8
1|2|00:30|1
1|3|00:15|0.8
1|3|00:30|1.1
1|4|00:15|1
1|4|00:30|1.5
2|1|00:15|0.7
2|1|00:30|1
2|2|00:15|0.6
2|2|00:30|0.9
2|3|00:15|0.7
2|3|00:30|1
2|4|00:15|0.8
2|4|00:30|1.1
expected outcome (the red line would be data of type '1', the green of type'2', the blue of type'3' and the yellow of type'4'; there should be as many charts, as different days (which would be solved via grouping, which already works):
expected chart
Related
Single planning calendar with fullday off
I have a problem with Single planning calendar. I set fullday to false and set a startHour (8h) and endHour (17h). But when i want to resize an appointment the startDate is not correct. handleAppointmentResize: function (oEvent) { var oAppointment = oEvent.getParameter("appointment"), oStartDate = oEvent.getParameter("startDate"), oEndDate = oEvent.getParameter("endDate"), sAppointmentTitle = oAppointment.getTitle(); console.log(oStartDate); console.log(oEndDate); For exemple : I have an appointment : Wed Apr 06 2022 09:00:00 to Wed Apr 06 2022 13:00:00 I reduce them to 09:00 - 10:00 The result is Mon Apr 04 2022 19:30:00 GMT+0200 (heure d’été d’Europe centrale) Wed Apr 06 2022 09:00:00 GMT+0200 (heure d’été d’Europe centrale) If i switch fullday to true, the result is ok ! Thanks for help Resolve with upgrade of Sapui5 version
Search data field by year in Janusgraph
I have a 'Date' property on my 'Patent' node class that is formatted like this: ==>Sun Jan 28 00:08:00 UTC 2007 ==>Tue Jan 27 00:10:00 UTC 1987 ==>Wed Jan 10 00:04:00 UTC 2001 ==>Sun Jan 17 00:08:00 UTC 2010 ==>Tue Jan 05 00:10:00 UTC 2010 ==>Thu Jan 28 00:09:00 UTC 2010 ==>Wed Jan 04 00:09:00 UTC 2012 ==>Wed Jan 09 00:12:00 UTC 2008 ==>Wed Jan 24 00:04:00 UTC 2018 And is stored as class java.util.Date in the database. Is there a way to search this field to return all the 'Patents' for a particular year? I tried variations of g.V().has("Patent", "date", 2000).values(). However, it doesn't return any results or an error message. Is there a way to search this property field by year or do I need to create a separate property that just contains year?
You do not need to create a separate property for the year. JanusGraph recognizes the Date data type and can filter by date values. gremlin> dateOfBirth1 = new GregorianCalendar(2000, 5, 6).getTime() ==>Tue Jun 06 00:00:00 MDT 2000 gremlin> g.addV("person").property("name", "Person 1").property("dateOfBirth", dateOfBirth1) ==>v[4144] gremlin> dateOfBirth2 = new GregorianCalendar(2001, 5, 6).getTime() ==>Wed Jun 06 00:00:00 MDT 2001 gremlin> g.addV("person").property("name", "Person 2").property("dateOfBirth", dateOfBirth2) ==>v[4328] gremlin> dateOfBirthFrom = new GregorianCalendar(2000, 0, 1).getTime() ==>Sat Jan 01 00:00:00 MST 2000 gremlin> dateOfBirthTo = new GregorianCalendar(2001, 0, 1).getTime() ==>Mon Jan 01 00:00:00 MST 2001 gremlin> g.V().hasLabel("person"). ......1> has("dateOfBirth", gte(dateOfBirthFrom)). ......2> has("dateOfBirth", lt(dateOfBirthTo)). ......3> values("name") ==>Person 1
in RDD how do you get apply function like MIN/MAX for an Iterable class
I would like to find out the efficient way to apply function to an RDD: Here is what I am trying to do : I have defined the following class: case class Type(Key: String, category: String, event: String, date: java.util.Date, value: Double) case class Type2(Key: String, Mdate: java.util.Date, label: Double) then a loaded an RDD: val TypeRDD: RDD[Type] = types.map(s=>s.split(",")).map(s=>Type(s(0), s(1), s(2),dateFormat.parse(s(3).asInstanceOf[String]), s(4).toDouble)) val Type2RDD: RDD[Type2] = types2.map(s=>s.split(",")).map(s=>Type2(s(0), dateFormat.parse(s(1).asInstanceOf[String]), s(2).toDouble)) Then I try to create two new RDD - one that has Type.Key = Type2.Key and another one that has Type.Key not in Type2 val grpType = TypeRDD.groupBy(_.Key1) vl grpType2 = Type2RDD.groupBy(_.Key1) //get data where they Key1 does not exists in Type2 and return the values in grpType1 val tempresult = grpType fullOuterJoin grpType2 val result = tempresult.filter(_._2._2.isEmpty).map(_._2._1) //get data where Type.Key == Type2.Key val result2 = grpType.join.grpType2.map(_._2) UPDATED: typeRDD = (19,EVENT1,TEST1,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT1,TEST1,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT2,TEST2,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) (21,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) (21,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) (24,EVENT2,TEST2,Sun Aug 21 00:00:00 EDT 3396,1.0) (24,EVENT2,TEST2,Sun Aug 21 00:00:00 EDT 3396,1.0) (40,EVENT1,TEST1,Sun Aug 21 00:00:00 EDT 3396,1.0) type2RDD = (24,Wed Dec 22 00:00:00 EST 3080,1.0) (40,Wed Jan 22 00:00:00 EST 3080,1.0) SO FOR THE RESULT 1 : I would like to get the following (19,EVENT1,TEST1,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT1,TEST1,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT2,TEST2,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) (19,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) (21,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) (21,EVENT3,TEST3,Sun Aug 21 00:00:00 EDT 3396,1.0) FOR RESULT 2 : (24,EVENT2,TEST2,Sun Aug 21 00:00:00 EDT 3396,1.0) (24,EVENT2,TEST2,Sun Aug 21 00:00:00 EDT 3396,1.0) (40,EVENT1,TEST1,Sun Aug 21 00:00:00 EDT 3396,1.0) AND I THEN WANT TO COUNT THE NUMBER OF EVENTS PER KEY RESULT : 19 EVENT1 2 19 EVENT2 1 19 EVENT3 2 21 EVENT3 2 RESULT2: 24 EVENT2 2 40 EVENT1 1 THEN I WANT TO GET THE MIN/MAX/AVG FOR THE EVENTS 1. RESULT1 MIN EVENT COUNT = 1 RESULT1 MAX EVENT COUNT = 5 RESULT1 AVG EVENT COUNT = 10/4 = 2.5
Maybe a bug in temporal reasoning on drools?
I want to test a scenario with temporal reasoning on drools. I have a Message class with timestamp field. when each event of this class received by drools, inserted into working memory and called fireAllRules(). in every firing I want to print timestamp of paired message ml and mo, that is ml after[0s,160s] mo. when I write my rule like below every things is Ok. rule "Rule 1" when ml: Message() mo: Message(ml after[0s,160s] this) then System.out.println("ml:"+new Date(ml.timestamp)); System.out.println("mo:"+new Date(mo.timestamp)); end output: Message received{"timestamp":"Feb 8 19:39:45", ... } ml:Sun Feb 08 19:39:45 IRST 1970 mo:Sun Feb 08 19:39:45 IRST 1970 Message received{"timestamp":"Feb 8 19:40:04", ... } ml:Sun Feb 08 19:40:04 IRST 1970 mo:Sun Feb 08 19:39:45 IRST 1970 ml:Sun Feb 08 19:40:04 IRST 1970 mo:Sun Feb 08 19:40:04 IRST 1970 Message received{"timestamp":"Feb 8 19:40:15", ... } ml:Sun Feb 08 19:40:15 IRST 1970 mo:Sun Feb 08 19:40:04 IRST 1970 ml:Sun Feb 08 19:40:15 IRST 1970 mo:Sun Feb 08 19:39:45 IRST 1970 ml:Sun Feb 08 19:40:15 IRST 1970 mo:Sun Feb 08 19:40:15 IRST 1970 But when I rewrite rule in this form the output is not good. rule "Rule 1" when ml: Message() mo: Message(this before[0s,160s] ml) then System.out.println("ml:"+new Date(ml.timestamp)); System.out.println("mo:"+new Date(mo.timestamp)); end output: Message received{"timestamp":"Feb 8 19:41:40", ... } ml:Sun Feb 08 19:41:40 IRST 1970 mo:Sun Feb 08 19:41:40 IRST 1970 Message received{"timestamp":"Feb 8 19:41:57", ... } ml:Sun Feb 08 19:41:57 IRST 1970 mo:Sun Feb 08 19:41:57 IRST 1970 Message received{"timestamp":"Feb 8 19:42:02", ... } ml:Sun Feb 08 19:42:02 IRST 1970 mo:Sun Feb 08 19:42:02 IRST 1970 Why in second form the output is not good? this problem observed when I used two parameters for temporal operators and "this" is the first operand. Is "this before[0s,160s] ml" equals to "ml after[0s,160s] this"? The second form is a bug?
SBT 0.12.1 downloads wrong SNAPSHOT
I deploy some SNAPSHOT dependencies to Sonatype OSS using mvn. Sonatype stores a number of old snapshots for each coordinate. A directory listing of my deployed SNAPSHOTs is at the bottom of this question. In my sbt Play! project, I added the Sonatype SNAPSHOT repository as a resolver. val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings( // Add your own project settings here resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/" ) However, the wrong SNAPSHOT is downloaded each time. While sbt should download the last deployed SNAPSHOT (20130109.225335-6) but it downloads the first deployed SNAPSHOT (20130109.210948-1). $ rm -r ~/.ivy2/cache/edu.washington.cs.knowitall.chunkedextractor/ $ sbt clean compile [info] Loading project definition from /scratch/github/knowitall/documentextractor/project [info] Set current project to documentextractor (in build file:/scratch/github/knowitall/documentextractor/) [success] Total time: 0 s, completed Jan 9, 2013 3:06:41 PM [info] Updating {file:/scratch/github/knowitall/documentextractor/}documentextractor... [info] downloading http://repo.typesafe.com/typesafe/snapshots/edu/washington/cs/knowitall/chunkedextractor/chunkedextractor_2.9.2/1.0.1-SNAPSHOT/chunkedextractor_2.9.2-1.0.1-20130109.210948-1.jar ... [info] [SUCCESSFUL ] edu.washington.cs.knowitall.chunkedextractor#chunkedextractor_2.9.2;1.0.1-SNAPSHOT!chunkedextractor_2.9.2.jar (1079ms) [info] Done updating. Any idea how I can fix this and make sbt download the most recent SNAPSHOT? Is this an sbt-specific problem or does it have to do with Play!? Here is the directory listing of my artifact's snapshots on Sonatype. https://oss.sonatype.org/content/repositories/snapshots/edu/washington/cs/knowitall/chunkedextractor/chunkedextractor_2.9.2/1.0.1-SNAPSHOT/ chunkedextractor_2.9.2-1.0.1-20130109.210948-1-javadoc.jar Wed Jan 09 15:09:55 CST 2013 361379 chunkedextractor_2.9.2-1.0.1-20130109.210948-1-javadoc.jar.md5 Wed Jan 09 15:09:56 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.210948-1-javadoc.jar.sha1 Wed Jan 09 15:09:56 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.210948-1-sources.jar Wed Jan 09 15:09:53 CST 2013 17175 chunkedextractor_2.9.2-1.0.1-20130109.210948-1-sources.jar.md5 Wed Jan 09 15:09:54 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.210948-1-sources.jar.sha1 Wed Jan 09 15:09:53 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.210948-1.jar Wed Jan 09 15:09:48 CST 2013 178994 chunkedextractor_2.9.2-1.0.1-20130109.210948-1.jar.md5 Wed Jan 09 15:09:49 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.210948-1.jar.sha1 Wed Jan 09 15:09:49 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.210948-1.pom Wed Jan 09 15:09:49 CST 2013 3725 chunkedextractor_2.9.2-1.0.1-20130109.210948-1.pom.md5 Wed Jan 09 15:09:50 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.210948-1.pom.sha1 Wed Jan 09 15:09:50 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.222121-2-javadoc.jar Wed Jan 09 16:21:29 CST 2013 363291 chunkedextractor_2.9.2-1.0.1-20130109.222121-2-javadoc.jar.md5 Wed Jan 09 16:21:30 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.222121-2-javadoc.jar.sha1 Wed Jan 09 16:21:30 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.222121-2-sources.jar Wed Jan 09 16:21:27 CST 2013 17195 chunkedextractor_2.9.2-1.0.1-20130109.222121-2-sources.jar.md5 Wed Jan 09 16:21:27 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.222121-2-sources.jar.sha1 Wed Jan 09 16:21:27 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.222121-2.jar Wed Jan 09 16:21:21 CST 2013 177267 chunkedextractor_2.9.2-1.0.1-20130109.222121-2.jar.md5 Wed Jan 09 16:21:22 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.222121-2.jar.sha1 Wed Jan 09 16:21:22 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.222121-2.pom Wed Jan 09 16:21:23 CST 2013 3725 chunkedextractor_2.9.2-1.0.1-20130109.222121-2.pom.md5 Wed Jan 09 16:21:23 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.222121-2.pom.sha1 Wed Jan 09 16:21:23 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.223017-3-javadoc.jar Wed Jan 09 16:30:25 CST 2013 363291 chunkedextractor_2.9.2-1.0.1-20130109.223017-3-javadoc.jar.md5 Wed Jan 09 16:30:26 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.223017-3-javadoc.jar.sha1 Wed Jan 09 16:30:25 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.223017-3-sources.jar Wed Jan 09 16:30:22 CST 2013 17195 chunkedextractor_2.9.2-1.0.1-20130109.223017-3-sources.jar.md5 Wed Jan 09 16:30:23 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.223017-3-sources.jar.sha1 Wed Jan 09 16:30:23 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.223017-3.jar Wed Jan 09 16:30:18 CST 2013 177267 chunkedextractor_2.9.2-1.0.1-20130109.223017-3.jar.md5 Wed Jan 09 16:30:18 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.223017-3.jar.sha1 Wed Jan 09 16:30:18 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.223017-3.pom Wed Jan 09 16:30:19 CST 2013 3725 chunkedextractor_2.9.2-1.0.1-20130109.223017-3.pom.md5 Wed Jan 09 16:30:19 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.223017-3.pom.sha1 Wed Jan 09 16:30:19 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.224717-4-javadoc.jar Wed Jan 09 16:47:24 CST 2013 363343 chunkedextractor_2.9.2-1.0.1-20130109.224717-4-javadoc.jar.md5 Wed Jan 09 16:47:24 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.224717-4-javadoc.jar.sha1 Wed Jan 09 16:47:24 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.224717-4-sources.jar Wed Jan 09 16:47:21 CST 2013 17198 chunkedextractor_2.9.2-1.0.1-20130109.224717-4-sources.jar.md5 Wed Jan 09 16:47:22 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.224717-4-sources.jar.sha1 Wed Jan 09 16:47:22 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.224717-4.jar Wed Jan 09 16:47:17 CST 2013 177369 chunkedextractor_2.9.2-1.0.1-20130109.224717-4.jar.md5 Wed Jan 09 16:47:18 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.224717-4.jar.sha1 Wed Jan 09 16:47:17 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.224717-4.pom Wed Jan 09 16:47:18 CST 2013 3725 chunkedextractor_2.9.2-1.0.1-20130109.224717-4.pom.md5 Wed Jan 09 16:47:19 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.224717-4.pom.sha1 Wed Jan 09 16:47:18 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225244-5-javadoc.jar Wed Jan 09 16:52:52 CST 2013 363343 chunkedextractor_2.9.2-1.0.1-20130109.225244-5-javadoc.jar.md5 Wed Jan 09 16:52:52 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225244-5-javadoc.jar.sha1 Wed Jan 09 16:52:52 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225244-5-sources.jar Wed Jan 09 16:52:49 CST 2013 17198 chunkedextractor_2.9.2-1.0.1-20130109.225244-5-sources.jar.md5 Wed Jan 09 16:52:50 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225244-5-sources.jar.sha1 Wed Jan 09 16:52:50 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225244-5.jar Wed Jan 09 16:52:45 CST 2013 177369 chunkedextractor_2.9.2-1.0.1-20130109.225244-5.jar.md5 Wed Jan 09 16:52:46 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225244-5.jar.sha1 Wed Jan 09 16:52:45 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225244-5.pom Wed Jan 09 16:52:46 CST 2013 3725 chunkedextractor_2.9.2-1.0.1-20130109.225244-5.pom.md5 Wed Jan 09 16:52:47 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225244-5.pom.sha1 Wed Jan 09 16:52:46 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225335-6-javadoc.jar Wed Jan 09 16:53:42 CST 2013 363343 chunkedextractor_2.9.2-1.0.1-20130109.225335-6-javadoc.jar.md5 Wed Jan 09 16:53:43 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225335-6-javadoc.jar.sha1 Wed Jan 09 16:53:42 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225335-6-sources.jar Wed Jan 09 16:53:40 CST 2013 17198 chunkedextractor_2.9.2-1.0.1-20130109.225335-6-sources.jar.md5 Wed Jan 09 16:53:40 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225335-6-sources.jar.sha1 Wed Jan 09 16:53:40 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225335-6.jar Wed Jan 09 16:53:35 CST 2013 177369 chunkedextractor_2.9.2-1.0.1-20130109.225335-6.jar.md5 Wed Jan 09 16:53:36 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225335-6.jar.sha1 Wed Jan 09 16:53:36 CST 2013 40 chunkedextractor_2.9.2-1.0.1-20130109.225335-6.pom Wed Jan 09 16:53:36 CST 2013 3725 chunkedextractor_2.9.2-1.0.1-20130109.225335-6.pom.md5 Wed Jan 09 16:53:37 CST 2013 32 chunkedextractor_2.9.2-1.0.1-20130109.225335-6.pom.sha1 Wed Jan 09 16:53:37 CST 2013 40 maven-metadata.xml Wed Jan 09 16:53:43 CST 2013 1244 maven-metadata.xml.md5 Wed Jan 09 16:53:44 CST 2013 32 maven-metadata.xml.sha1 Wed Jan 09 16:53:43 CST 2013 40 UPDATE: build.properties specifies sbt.version=0.11.3. Maybe Play is forcing this older version of sbt.
Try if one of these might help you: 1) run 'update' 2) modify dependency to "groupId" %% "artifactId" % "version" changing() and run 'update'