Hello,
I am using Smart GWT 3.0, fantastic product!
I am doing some graphing. I can now get a graph to appear, but the XAxis does not see it as a date, instead as just a string value. So not spaced over time, but over intervals values. How can I get the XAxis to recognize the type. And even though my data source has the date field as type "date" I am getting a datetime back, while I just wanted the date.
Here is code that generates a graph, ugly perhaps, but seems to work ... Sorry just learning the API.
You guys rock! Really fun product.
Thanks,
Evan
private FacetChart createChart () {
FacetChart raviChart = new FacetChart();
Facet dateFacet = new Facet("rdate");
Facet legendFacet = new Facet("type");
legendFacet.setValues(
new FacetValue("ravi1", "Ravi 1")
);
raviChart.setFacets(dateFacet, legendFacet);
raviChart.setValueProperty("ravi");
raviChart.setData(GetRecordList());
raviChart.setChartType(ChartType.LINE);
raviChart.setShowDataPoints(Boolean.TRUE);
raviChart.setAutoRotateLabels(false);
raviChart.setTitle(CHART_TITLE);
return raviChart;
}
private RecordList GetRecordList () {
RecordList myRecList = new RecordList();
Record[] recArray = listGridHRAVI.getRecordList().toArray();
for(int i = 0; i < recArray.length; i++) {
Record record = recArray[i];
Record entryRecord = new Record();
Date valueDate = record.getAttributeAsDate("rdate");
entryRecord.setAttribute("rdate", valueDate);
entryRecord.setAttribute("type", "ravi1");
entryRecord.setAttribute("ravi", record.getAttribute("ravi"));
System.out.println("Date and RAVI " + record.getAttributeAsDate("rdate") + ", " +
record.getAttribute("ravi"));
myRecList.add(entryRecord);
}
return myRecList;
}
I am using Smart GWT 3.0, fantastic product!
I am doing some graphing. I can now get a graph to appear, but the XAxis does not see it as a date, instead as just a string value. So not spaced over time, but over intervals values. How can I get the XAxis to recognize the type. And even though my data source has the date field as type "date" I am getting a datetime back, while I just wanted the date.
Here is code that generates a graph, ugly perhaps, but seems to work ... Sorry just learning the API.
You guys rock! Really fun product.
Thanks,
Evan
private FacetChart createChart () {
FacetChart raviChart = new FacetChart();
Facet dateFacet = new Facet("rdate");
Facet legendFacet = new Facet("type");
legendFacet.setValues(
new FacetValue("ravi1", "Ravi 1")
);
raviChart.setFacets(dateFacet, legendFacet);
raviChart.setValueProperty("ravi");
raviChart.setData(GetRecordList());
raviChart.setChartType(ChartType.LINE);
raviChart.setShowDataPoints(Boolean.TRUE);
raviChart.setAutoRotateLabels(false);
raviChart.setTitle(CHART_TITLE);
return raviChart;
}
private RecordList GetRecordList () {
RecordList myRecList = new RecordList();
Record[] recArray = listGridHRAVI.getRecordList().toArray();
for(int i = 0; i < recArray.length; i++) {
Record record = recArray[i];
Record entryRecord = new Record();
Date valueDate = record.getAttributeAsDate("rdate");
entryRecord.setAttribute("rdate", valueDate);
entryRecord.setAttribute("type", "ravi1");
entryRecord.setAttribute("ravi", record.getAttribute("ravi"));
System.out.println("Date and RAVI " + record.getAttributeAsDate("rdate") + ", " +
record.getAttribute("ravi"));
myRecList.add(entryRecord);
}
return myRecList;
}
Comment