use of org.jfree.data.time.TimeTableXYDataset in project cubrid-manager by CUBRID.
the class CombinedBarTimeSeriesChart method createTableSeriesDataset.
/**
* Creates a table dataset for series
*
* @return Series 2.
*/
private XYDataset createTableSeriesDataset() {
timeTableXYCollection = new TimeTableXYDataset();
for (Map.Entry<String, String> entry : valueMap.entrySet()) {
String key = entry.getKey();
timeTableXYCollection.add(new Second(), 0, key);
}
return timeTableXYCollection;
}
use of org.jfree.data.time.TimeTableXYDataset in project cubrid-manager by CUBRID.
the class CombinedBarTimeSeriesChart method updateFromScratch.
/**
* update series chart from scratch
*
*/
public void updateFromScratch() {
if (isAreaRender) {
((TimeTableXYDataset) seriesdataset).clear();
} else {
((TimeSeriesCollection) seriesdataset).removeAllSeries();
if (seriesMap != null) {
seriesMap.clear();
for (Map.Entry<String, String> entry : valueMap.entrySet()) {
String key = entry.getKey();
TimeSeries series = new TimeSeries(key);
seriesMap.put(key, series);
((TimeSeriesCollection) seriesdataset).addSeries(series);
}
}
}
}
use of org.jfree.data.time.TimeTableXYDataset in project xwiki-platform by xwiki.
the class TableTimeTableXYDatasetBuilder method setParameters.
@Override
public void setParameters(Map<String, String> parameters) throws MacroExecutionException {
String timePeriodTypeString = parameters.get(TIMEPERIOD_TYPE_PARAM);
if (timePeriodTypeString != null) {
this.timePeriodType = TimePeriodType.forName(timePeriodTypeString);
if (this.timePeriodType == null) {
throw new MacroExecutionException(String.format("Invalid time period type [%s].", timePeriodTypeString));
}
}
dataset = new TimeTableXYDataset(localeConfiguration.getTimeZone(), localeConfiguration.getLocale());
}
use of org.jfree.data.time.TimeTableXYDataset in project xwiki-platform by xwiki.
the class TableTimeTableXYBuilderTest method testBuildTimeTableXY.
@Test
public void testBuildTimeTableXY() throws Exception {
String content = "| Date | column 2 | column 3 | column 4\n" + "| 2012-01-01 10:30:10 | 12 | 13 | 14 \n" + "| 2012-01-01 10:30:20 | 22 | 23 | 24 \n";
setUpContentExpectation(content);
getDataSource().buildDataset(content, map("type", "xy_line_and_shape", "dataset", "timetable_xy", "range", "A2-D3", "locale", "en_US", "date_format", "yyyy-MM-dd kk:mm:ss", "domain_axis_type", "date"), null);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss", new Locale("en"));
ChartModel chartModel = getDataSource().getChartModel();
Assert.assertTrue(chartModel.getDataset() instanceof TimeTableXYDataset);
Assert.assertTrue(chartModel.getAxis(0) instanceof DateAxis);
Assert.assertTrue(chartModel.getAxis(1) instanceof ValueAxis);
TimeTableXYDataset dataset = (TimeTableXYDataset) chartModel.getDataset();
Assert.assertTrue(dataset.getSeriesCount() == 3);
Assert.assertTrue(dataset.getSeriesKey(0).equals(" column 2 "));
Assert.assertTrue(dataset.getSeriesKey(1).equals(" column 3 "));
Assert.assertTrue(dataset.getSeriesKey(2).equals(" column 4"));
Assert.assertTrue(dataset.getTimePeriod(0).getStart().equals(new Date(0)));
Assert.assertTrue(dataset.getTimePeriod(0).getEnd().equals(dateFormat.parse("2012-01-01 10:30:10")));
Assert.assertTrue(dataset.getTimePeriod(1).getStart().equals(dateFormat.parse("2012-01-01 10:30:10")));
Assert.assertTrue(dataset.getTimePeriod(1).getEnd().equals(dateFormat.parse("2012-01-01 10:30:20")));
}
use of org.jfree.data.time.TimeTableXYDataset in project xwiki-platform by xwiki.
the class TableTimeTableXYBuilderTest method testYearInterval.
@Test
public void testYearInterval() throws Exception {
String content = "| Date | column 2 | column 3 | column 4\n" + "| 1970 | 12 | 13 | 14 \n" + "| 1971 | 22 | 23 | 24 \n";
setUpContentExpectation(content);
getDataSource().buildDataset(content, map("type", "xy_line_and_shape", "dataset", "timetable_xy", "range", "A2-D3", "locale", "en_US", "date_format", "yyyy", "domain_axis_type", "date", "time_period", "year"), null);
ChartModel chartModel = getDataSource().getChartModel();
Assert.assertTrue(chartModel.getDataset() instanceof TimeTableXYDataset);
Assert.assertTrue(chartModel.getAxis(0) instanceof DateAxis);
Assert.assertTrue(chartModel.getAxis(1) instanceof ValueAxis);
}
Aggregations