use of org.apache.qpid.disttest.charting.definition.SeriesDefinition in project qpid-broker-j by apache.
the class SeriesPainter method applySeriesAppearance.
public void applySeriesAppearance(JFreeChart chart, List<SeriesDefinition> seriesDefinitions, SeriesStrokeAndPaintApplier strokeAndPaintApplier) {
for (int i = 0; i < seriesDefinitions.size(); i++) {
SeriesDefinition seriesDefinition = seriesDefinitions.get(i);
if (seriesDefinition.getSeriesColourName() != null) {
strokeAndPaintApplier.setSeriesPaint(i, ColorFactory.toColour(seriesDefinition.getSeriesColourName()), chart);
}
if (seriesDefinition.getStrokeWidth() != null) {
// Negative width used to signify dashed
boolean dashed = seriesDefinition.getStrokeWidth() < 0;
float width = Math.abs(seriesDefinition.getStrokeWidth());
BasicStroke stroke = buildStrokeOfWidth(width, dashed);
strokeAndPaintApplier.setSeriesStroke(i, stroke, chart);
}
if (seriesDefinition.getShape() != null) {
Shape shape = buildShape(seriesDefinition.getShape());
strokeAndPaintApplier.setSeriesShape(i, shape, chart);
}
}
}
use of org.apache.qpid.disttest.charting.definition.SeriesDefinition in project qpid-broker-j by apache.
the class StatisticalBarChartBuilder method newDatasetHolder.
@Override
protected DatasetHolder newDatasetHolder() {
return new DatasetHolder() {
private final DefaultStatisticalCategoryDataset _dataset = new DefaultStatisticalCategoryDataset();
@Override
public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row) {
String x = row.dimensionAsString(0);
double mean = row.dimensionAsDouble(1);
double stdDev = row.dimensionAsDouble(2);
_dataset.add(mean, stdDev, seriesDefinition.getSeriesLegend(), x);
}
@Override
public void beginSeries(SeriesDefinition seriesDefinition) {
// unused
}
@Override
public void endSeries(SeriesDefinition seriesDefinition) {
// unused
}
@Override
public int getNumberOfDimensions() {
return 3;
}
@Override
public Dataset getPopulatedDataset() {
return _dataset;
}
};
}
use of org.apache.qpid.disttest.charting.definition.SeriesDefinition in project qpid-broker-j by apache.
the class TimeSeriesBuilderCallbackTest method testAddPointToSeries.
public void testAddPointToSeries() {
TimeSeriesHolder timeSeriesHolder = new TimeSeriesHolder();
SeriesDefinition seriesDefinition = mock(SeriesDefinition.class);
when(seriesDefinition.getSeriesLegend()).thenReturn(SERIES_LEGEND);
timeSeriesHolder.beginSeries(seriesDefinition);
timeSeriesHolder.addDataPointToSeries(seriesDefinition, new SeriesRow(_dates[0], _values[0]));
timeSeriesHolder.addDataPointToSeries(seriesDefinition, new SeriesRow(_dates[1], _values[1]));
timeSeriesHolder.addDataPointToSeries(seriesDefinition, new SeriesRow(_dates[2], _values[2]));
timeSeriesHolder.endSeries(seriesDefinition);
TimeSeriesCollection timeSeriesCollection = (TimeSeriesCollection) timeSeriesHolder.getPopulatedDataset();
TimeSeries actualTimeSeries = timeSeriesCollection.getSeries(SERIES_LEGEND);
for (int i = 0; i < NUMBER_OF_DATA_POINTS; i++) {
TimeSeriesDataItem dataItem0 = actualTimeSeries.getDataItem(i);
assertEquals(_dates[i].getTime(), dataItem0.getPeriod().getMiddleMillisecond());
assertEquals(_values[i], dataItem0.getValue());
}
}
use of org.apache.qpid.disttest.charting.definition.SeriesDefinition in project qpid-broker-j by apache.
the class JdbcUrlGeneratorTest method testGetJdbcUrlThrowsExceptionIfUrlProvidedAndSeriesDirectorySpecified.
public void testGetJdbcUrlThrowsExceptionIfUrlProvidedAndSeriesDirectorySpecified() {
String urlTemplate = "urlTemplate";
JdbcUrlGenerator jdbcUrlGenerator = new JdbcUrlGenerator(urlTemplate);
SeriesDefinition seriesDefinition = mock(SeriesDefinition.class);
when(seriesDefinition.getSeriesDirectory()).thenReturn("mydir");
try {
jdbcUrlGenerator.getJdbcUrl(seriesDefinition);
fail("Expected exception not thrown");
} catch (IllegalArgumentException e) {
// pass
}
}
use of org.apache.qpid.disttest.charting.definition.SeriesDefinition in project qpid-broker-j by apache.
the class JdbcUrlGeneratorTest method testGetJdbcUrlReturnsProvidedUrl.
public void testGetJdbcUrlReturnsProvidedUrl() {
String urlTemplate = "urlTemplate";
JdbcUrlGenerator jdbcUrlGenerator = new JdbcUrlGenerator(urlTemplate);
SeriesDefinition seriesDefinition = mock(SeriesDefinition.class);
String jdbcUrl = jdbcUrlGenerator.getJdbcUrl(seriesDefinition);
assertEquals(urlTemplate, jdbcUrl);
}
Aggregations